-
Notifications
You must be signed in to change notification settings - Fork 14
/
customize.sh
executable file
·46 lines (42 loc) · 1.62 KB
/
customize.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
ui_print " "
ui_print " Mod detection and patching now happens at boot"
ui_print " The boot script handles everything now"
ui_print " "
ui_print " Also note that disabled mods will be ignored!"
ui_print " "
# Escape each backslash and space since shell will expand it during echo
sed -i -e 's/\\/\\\\/g' -e 's/\ /\\ /g' $MODPATH/AudioModificationLibrary.sh
# Separate AML into individual files for each audio mod
mkdir $MODPATH/.scripts
while read line; do
case $line in
\#*) if [ "$uuid" ]; then
echo " " >> $MODPATH/.scripts/$uuid.sh
fi
uuid=$(echo "$line" | sed "s/#//");;
*) echo "$line" >> $MODPATH/.scripts/$uuid.sh;;
esac
done < $MODPATH/AudioModificationLibrary.sh
rm -f $MODPATH/AudioModificationLibrary.sh
# Generate libs var for faster script running
for i in $MODPATH/.scripts/*; do
libs="$libs-name \"$(basename $i | sed "s/~.*//")\" "
done
libs="$(echo $libs | sed "s/\" /\" -o /g")"
sed -i -e "s|<libs>|$libs|" $MODPATH/service.sh
# Set vars in script
[ -z $KSU ] && KSU=false
[ -z $SERVICED ] && SERVICED=$NVBASE/service.d
amldir=$NVBASE/aml
for i in API amldir KSU MAGISK_VER; do
for j in post-fs-data service uninstall; do
sed -i "s|$i=|$i=$(eval echo \$$i)|" $MODPATH/$j.sh
done
done
# Place fallback script in the event idiot user deletes aml module in file explorer
mkdir $SERVICED 2>/dev/null
cp -f $MODPATH/uninstall.sh $SERVICED/aml.sh
chmod 0755 $SERVICED/aml.sh
sed -i -e "3a[ -d \"\$moddir/$MODID\" -a ! -f \"\$moddir/$MODID/disable\" ] && exit 0" -e "s|^moddir=.*|moddir=$NVBASE/modules|" $SERVICED/aml.sh
echo 'rm -f $0' >> $SERVICED/aml.sh
rm -f $MODPATH/install.zip