Handle edge cases of early abort

This commit is contained in:
FriendlyNeighborhoodShane 2020-03-16 11:56:34 +05:30
parent 347fb418ca
commit 246fb5bfdd

View File

@ -281,7 +281,7 @@ install_lib() {
uninstall_pack() { uninstall_pack() {
if [ "$magisk" = "yes" ]; then if [ "$magisk" = "yes" ]; then
rm -rf "$root" || { log " "; log "Could not delete Magisk root ($root)"; } rm -rf "$root" || { log " "; log "Could not delete Magisk root ($root)"; }
else elif [ "$magisk" = "no" ]; then
for thing in $stuff_uninstall; do for thing in $stuff_uninstall; do
[ "$thing" ] && uninstall "$root/$thing"; [ "$thing" ] && uninstall "$root/$thing";
done; done;
@ -370,7 +370,7 @@ if [ "$action" = "installation" ]; then
for thing in $stuff_debloat; do for thing in $stuff_debloat; do
[ "$thing" ] && debloat "/$sysroot/$thing" "$root/$thing"; [ "$thing" ] && debloat "/$sysroot/$thing" "$root/$thing";
done; done;
else elif [ "$magisk" = "no" ]; then
for thing in $stuff_debloat; do for thing in $stuff_debloat; do
[ "$thing" ] && remove "/$sysroot/$thing" "$backupdir/$thing"; [ "$thing" ] && remove "/$sysroot/$thing" "$backupdir/$thing";
done; done;
@ -403,7 +403,7 @@ if [ "$action" = "installation" ]; then
datfreem="$(($(df -Pk "/data" | tail -n 1 | awk '{ print $4 }') / 1024))"; datfreem="$(($(df -Pk "/data" | tail -n 1 | awk '{ print $4 }') / 1024))";
log "Free data space is $datfreem"; log "Free data space is $datfreem";
[ "$datfreem" -lt "$packsizem" ] && abort "Not enough free space in your data!"; [ "$datfreem" -lt "$packsizem" ] && abort "Not enough free space in your data!";
else elif [ "$magisk" = "no" ]; then
sysfreem="$(($(df -Pk "/$sysroot/system" | tail -n 1 | awk '{ print $4 }') / 1024))"; sysfreem="$(($(df -Pk "/$sysroot/system" | tail -n 1 | awk '{ print $4 }') / 1024))";
log "Free system space is $sysfreem"; log "Free system space is $sysfreem";
[ "$sysfreem" -lt "$packsizem" ] && abort "Not enough free space in your system!"; [ "$sysfreem" -lt "$packsizem" ] && abort "Not enough free space in your system!";
@ -451,7 +451,7 @@ if [ "$action" = "installation" ]; then
touch "$modmnt/$modname/update" || abort "Could not create update in $modmnt/$modname"; touch "$modmnt/$modname/update" || abort "Could not create update in $modmnt/$modname";
[ "$modprop" ] && { echo "$modprop" > "$modmnt/$modname/module.prop" || abort "Could not create module.prop in $modmnt/$modname"; } [ "$modprop" ] && { echo "$modprop" > "$modmnt/$modname/module.prop" || abort "Could not create module.prop in $modmnt/$modname"; }
fi; fi;
else elif [ "$magisk" = "no" ]; then
[ "$postfs" ] && { mkdir -p "$(dirname "$root/$initdfile")"; echo "$postfs" > "$root/$initdfile" || abort "Could not create $initdfile in $root"; } [ "$postfs" ] && { mkdir -p "$(dirname "$root/$initdfile")"; echo "$postfs" > "$root/$initdfile" || abort "Could not create $initdfile in $root"; }
[ "$service" ] && { mkdir -p "$(dirname "$root/$initdfile")"; echo "$service" > "$root/$initdfile" || abort "Could not create $initdfile in $root"; } [ "$service" ] && { mkdir -p "$(dirname "$root/$initdfile")"; echo "$service" > "$root/$initdfile" || abort "Could not create $initdfile in $root"; }
[ "$addond" ] && { mkdir -p "$(dirname "$root/$addondfile")"; echo "$addond" > "$root/$addondfile" || abort "Could not create $addondfile in $root"; } [ "$addond" ] && { mkdir -p "$(dirname "$root/$addondfile")"; echo "$addond" > "$root/$addondfile" || abort "Could not create $addondfile in $root"; }