diff options
-rw-r--r-- | recipes-core/multitech/overlayfs-init-ubi/overlayfs.init | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/recipes-core/multitech/overlayfs-init-ubi/overlayfs.init b/recipes-core/multitech/overlayfs-init-ubi/overlayfs.init index f19abef..9e60961 100644 --- a/recipes-core/multitech/overlayfs-init-ubi/overlayfs.init +++ b/recipes-core/multitech/overlayfs-init-ubi/overlayfs.init @@ -10,7 +10,7 @@ LOWERDIR="/" USER_ORIG="$UPPERDIR/orig" USER_PARTITION="ubi0:user-data" # Erase the file system -DO_ERASE_PERSISTENT="/mnt/user/.persistent/mts_do_erase_persistent" +DO_ERASE_PERSISTENT=$(fw_printenv erase_persistent_f | cut -d '"' -f2 | grep -Eo '[0-9]+$' || true) # Remove files not hidden DO_CLEAR_PERSISTENT=$(fw_printenv default_reset_f | cut -d '"' -f2 | grep -Eo '[0-9]+$' || true) @@ -34,7 +34,7 @@ mnt_user() { fs="/run /dev /proc /sys /sys/kernel/security /dev/shm /dev/pts /sys/fs/cgroup /sys/fs/cgroup/unified /sys/fs/cgroup/systemd /sys/fs/cgroup/devices /sys/fs/cgroup/freezer /sys/fs/cgroup/pids /sys/fs/cgroup/memory /dev/mqueue /sys/kernel/debug /tmp /sys/fs/fuse/connections /sys/kernel/config /var/volatile" - + my_switch_root() { NEW_ROOT=$1 loginfo mountinfo @@ -88,6 +88,7 @@ do_erase_old() { ubiupdatevol ${DEV} -t 2>&1 | logpipe mnt_user + fw_setenv erase_persistent_f 0 } do_rw_mount() { @@ -97,8 +98,9 @@ do_rw_mount() { mnt_user # user_data is now accessible do_remove_old - if [[ -f $DO_ERASE_PERSISTENT ]] ; then + if [[ "$DO_ERASE_PERSISTENT" -eq 1 ]] ; then do_erase_old + fw_setenv default_reset_f 0 elif [[ "$DO_CLEAR_PERSISTENT" -eq 1 ]] ; then do_clear_old fi |