1
1
# shellcheck shell=dash
2
- # Its broken okay?!?!
3
2
# shellcheck disable=SC2155
4
3
# shellcheck disable=SC2034
5
4
# shellcheck disable=SC1090
@@ -18,6 +17,42 @@ abort() {
18
17
exit 1
19
18
}
20
19
20
+ it_failed () {
21
+ ui_print " "
22
+ ui_print " ⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠"
23
+ ui_print " "
24
+ ui_print " Uh-oh, the installer encountered an issue!"
25
+ ui_print " It's probably one of these reasons:"
26
+ ui_print " 1) Installer is corrupt"
27
+ ui_print " 2) You didn't follow instructions"
28
+ ui_print " 3) You have an unstable internet connection"
29
+ ui_print " 4) Your ROM is broken"
30
+ ui_print " 5) There's a *tiny* chance we screwed up"
31
+ ui_print " Please fix any issues and retry."
32
+ ui_print " If you feel this is a bug or need assistance, head to our telegram"
33
+ mv ${EXT_DATA} /WebviewManager/logs ${EXT_DATA}
34
+ rm -rf ${EXT_DATA} /WebviewManager/*
35
+ mv ${EXT_DATA} /logs ${EXT_DATA} /WebviewManager/
36
+ ui_print " "
37
+ ui_print " ⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠⚠"
38
+ ui_print " "
39
+ abort
40
+ }
41
+ detect_ext_data () {
42
+ touch /sdcard/.rw && rm /sdcard/.rw && EXT_DATA=" /sdcard"
43
+ if test -z ${EXT_DATA} ; then
44
+ touch /storage/emulated/0/.rw && rm /storage/emulated/0/.rw && EXT_DATA=" /storage/emulated/0"
45
+ fi
46
+ if test -z ${EXT_DATA} ; then
47
+ touch /data/media/0/.rw && rm /data/media/0/.rw && EXT_DATA=" /data/media/0"
48
+ fi
49
+ if test -z ${EXT_DATA} ; then
50
+ ui_print " - Internal storage doesn't seem to be writable!"
51
+ it_failed
52
+ fi
53
+ }
54
+ detect_ext_data
55
+
21
56
mount_apex () {
22
57
$BOOTMODE || [ ! -d /system/apex ] && return
23
58
local APEX DEST
@@ -31,13 +66,11 @@ mount_apex() {
31
66
unzip -qo $APEX apex_payload.img -d /apex
32
67
loop_setup apex_payload.img
33
68
if [ -n " $LOOPDEV " ]; then
34
- ui_print " - Mounting $DEST "
35
69
mount -t ext4 -o ro,noatime $LOOPDEV $DEST
36
70
fi
37
71
rm -f apex_payload.img
38
72
elif [ -d $APEX ]; then
39
73
# APEX folders, bind mount directory
40
- ui_print " - Mounting $DEST "
41
74
mount -o bind $APEX $DEST
42
75
fi
43
76
done
@@ -74,10 +107,10 @@ umount_apex() {
74
107
cleanup () {
75
108
rm -rf $MODPATH /common 2> /dev/null
76
109
ui_print " "
77
- ui_print " ************************************** "
78
- ui_print " * MMT Extended by Zackptg5 @ XDA *"
79
- ui_print " * Modified by Androidacy *"
80
- ui_print " ************************************** "
110
+ ui_print " ***********************************"
111
+ ui_print " * MMT Extended by Zackptg5 *"
112
+ ui_print " * Modified by Androidacy *"
113
+ ui_print " ***********************************"
81
114
ui_print " "
82
115
}
83
116
@@ -153,8 +186,6 @@ install_script() {
153
186
-p) shift ; local INPATH=$NVBASE /post-fs-data.d;;
154
187
* ) local INPATH=$NVBASE /service.d;;
155
188
esac
156
- # shellcheck disable=SC2143
157
- [ " $( grep " #!/system/bin/sh" $1 ) " ] || sed -i " 1i #!/system/bin/sh" $1
158
189
local i; for i in " MODPATH" " LIBDIR" " MODID" " INFO" " MODDIR" ; do
159
190
case $i in
160
191
" MODPATH" ) sed -i " 1a $i =$NVBASE /modules/$MODID " $1 ;;
@@ -178,8 +209,8 @@ prop_process() {
178
209
}
179
210
180
211
# Check for min/max api version
181
- [ -z $MINAPI ] || { [ $API -lt $MINAPI ] && abort " ! Your system API of $API is less than the minimum api of $MINAPI ! Aborting!" ; }
182
- [ -z $MAXAPI ] || { [ $API -gt $MAXAPI ] && abort " ! Your system API of $API is greater than the maximum api of $MAXAPI ! Aborting!" ; }
212
+ [ -z $MINAPI ] || { [ $API -lt $MINAPI ] && ui_print " ! Your system API of $API is less than the minimum api of $MINAPI ! Aborting!" && it_failed ; }
213
+ [ -z $MAXAPI ] || { [ $API -gt $MAXAPI ] && ui_print " ! Your system API of $API is greater than the maximum api of $MAXAPI ! Aborting!" && it_failed ; }
183
214
184
215
# Set variables
185
216
[ $API -lt 26 ] && DYNLIB=false
198
229
199
230
# Debug
200
231
if $DEBUG ; then
201
- ui_print " - Debug mode"
202
- ui_print " Module install log will include debug info"
203
- ui_print " It's in /data/media/0/WebviewManager/logs"
204
- mkdir -p /data/media/0/WebviewManager/logs/
205
- exec 2> /data/media/0/WebviewManager/logs/install.log
232
+ ui_print " - Logging to [Internal Storage]/WebviewManager/logs"
233
+ mkdir -p " $EXT_DATA " /WebviewManager/logs/
234
+ exec 2> " $EXT_DATA " /WebviewManager/logs/install.log
206
235
set -x
207
236
fi
208
237
0 commit comments