summaryrefslogtreecommitdiff
path: root/recipes-core/multitech/overlayfs-init-ubi/overlayfs.init
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-core/multitech/overlayfs-init-ubi/overlayfs.init')
-rw-r--r--recipes-core/multitech/overlayfs-init-ubi/overlayfs.init12
1 files changed, 6 insertions, 6 deletions
diff --git a/recipes-core/multitech/overlayfs-init-ubi/overlayfs.init b/recipes-core/multitech/overlayfs-init-ubi/overlayfs.init
index f19abef..445bcde 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
@@ -109,11 +111,9 @@ do_rw_mount() {
loginfo "/proc/mounts:"
cat /proc/mounts | grep overlay | logpipe
- mkdir -p ${OVERLAY}/var/persistent
-
- mount --bind ${MNT_USER}/.persistent ${OVERLAY}/var/persistent
loginfo "Switch root to $OVERLAY"
my_switch_root $OVERLAY
+ mount --bind /orig/mnt/user/.persistent/ /var/persistent
cat /proc/mounts | grep overlay | logpipe
mount -o remount,rw /
cat /proc/mounts | grep overlay | logpipe