|
@@ -23,10 +23,9 @@ ui_print() {
|
|
|
|
|
|
cleanup() {
|
|
|
ui_print "Cleaning up files"
|
|
|
- cd ../
|
|
|
- rm -rf system
|
|
|
- rm -rf bin
|
|
|
- rm toybox
|
|
|
+ rm -rf $TMP/system
|
|
|
+ rm -rf $TMP/bin
|
|
|
+ rm $TMP/toybox
|
|
|
|
|
|
ui_print "Unmounting partitions"
|
|
|
umount -l "$SYSTEM_MNT"
|
|
@@ -34,12 +33,20 @@ cleanup() {
|
|
|
umount -l /system_ext || true
|
|
|
}
|
|
|
|
|
|
-error_no_space() {
|
|
|
- ui_print "Not enough space for GApps! Aborting"
|
|
|
+error() {
|
|
|
+ ui_print "$1"
|
|
|
cleanup
|
|
|
exit 1
|
|
|
}
|
|
|
|
|
|
+error_no_space() {
|
|
|
+ error "Not enough space for GApps! Aborting"
|
|
|
+}
|
|
|
+
|
|
|
+error_mounting() {
|
|
|
+ error "Could not mount $1! Aborting"
|
|
|
+}
|
|
|
+
|
|
|
get_block_for_mount_point() {
|
|
|
grep -v "^#" /etc/recovery.fstab | grep "[[:blank:]]$1[[:blank:]]" | tail -n1 | tr -s [:blank:] ' ' | cut -d' ' -f1
|
|
|
}
|
|
@@ -170,8 +177,7 @@ mkdir -p "$SYSTEM_MNT" || true
|
|
|
if mount -o rw "$SYSTEM_BLOCK" "$SYSTEM_MNT"; then
|
|
|
ui_print "$SYSTEM_MNT mounted"
|
|
|
else
|
|
|
-ui_print "Could not mount $SYSTEM_MNT! Aborting"
|
|
|
-exit 1
|
|
|
+error_mounting "$SYSTEM_MNT"
|
|
|
fi
|
|
|
SYSTEM_OUT="${SYSTEM_MNT}/system"
|
|
|
|
|
@@ -190,8 +196,7 @@ if [ -n "$PRODUCT_BLOCK" ]; then
|
|
|
if mount -o rw "$PRODUCT_BLOCK" /product; then
|
|
|
ui_print "/product mounted"
|
|
|
else
|
|
|
- ui_print "Could not mount /product"
|
|
|
- exit 1
|
|
|
+ error_mounting "/product"
|
|
|
fi
|
|
|
fi
|
|
|
if [ -n "$SYSTEM_EXT_BLOCK" ]; then
|
|
@@ -199,8 +204,7 @@ if [ -n "$SYSTEM_EXT_BLOCK" ]; then
|
|
|
if mount -o rw "$SYSTEM_EXT_BLOCK" /system_ext; then
|
|
|
ui_print "/system_ext mounted"
|
|
|
else
|
|
|
- ui_print "Could not mount /system_ext"
|
|
|
- exit 1
|
|
|
+ error_mounting "/system_ext"
|
|
|
fi
|
|
|
fi
|
|
|
|