backuptool_ab: Make tmp actually tmpfs
Change-Id: I668e0f24486197d762981bef4c9f2437c4fa9c14
diff --git a/prebuilt/common/bin/backuptool_ab.sh b/prebuilt/common/bin/backuptool_ab.sh
index 4867e4e..47fd293 100755
--- a/prebuilt/common/bin/backuptool_ab.sh
+++ b/prebuilt/common/bin/backuptool_ab.sh
@@ -11,6 +11,7 @@
# Scripts in /system/addon.d expect to find backuptool.functions in /tmp
mkdir -p /postinstall/tmp/
+mountpoint /postinstall/tmp >/dev/null 2>&1 || mount -t tmpfs tmpfs /postinstall/tmp
cp -f /postinstall/system/bin/backuptool_ab.functions /postinstall/tmp/backuptool.functions
# Preserve /system/addon.d in /tmp/addon.d
@@ -65,8 +66,7 @@
# we have no /sbin/sh in android, only recovery
# use /system/bin/sh here instead
sed -i '0,/#!\/sbin\/sh/{s|#!/sbin/sh|#!/system/bin/sh|}' $script
- # we can't count on /tmp existing on an A/B device, so utilize /postinstall/tmp
- # as a pseudo-/tmp dir
+ # we can't count on /tmp existing on an A/B device, so utilize /postinstall/tmp as tmpfs
sed -i 's|. /tmp/backuptool.functions|. /postinstall/tmp/backuptool.functions|g' $script
$script $1
done
@@ -90,6 +90,7 @@
run_stage post-restore
restore_addon_d
rm -rf $C
+ umount /postinstall/tmp
rm -rf /postinstall/tmp
sync
fi