diff options
Diffstat (limited to 'recipes-core/multitech/overlayfs-init-ubi/overlayfs.init')
-rw-r--r-- | recipes-core/multitech/overlayfs-init-ubi/overlayfs.init | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/recipes-core/multitech/overlayfs-init-ubi/overlayfs.init b/recipes-core/multitech/overlayfs-init-ubi/overlayfs.init index 7fc7f7e..f19abef 100644 --- a/recipes-core/multitech/overlayfs-init-ubi/overlayfs.init +++ b/recipes-core/multitech/overlayfs-init-ubi/overlayfs.init @@ -12,7 +12,7 @@ USER_PARTITION="ubi0:user-data" # Erase the file system DO_ERASE_PERSISTENT="/mnt/user/.persistent/mts_do_erase_persistent" # Remove files not hidden -DO_CLEAR_PERSISTENT="/mnt/user/.persistent/mts_do_clear_persistent" +DO_CLEAR_PERSISTENT=$(fw_printenv default_reset_f | cut -d '"' -f2 | grep -Eo '[0-9]+$' || true) pid=$$ prefix="<3>overlayrootfs-generator[${pid}]: " @@ -31,7 +31,7 @@ mnt_user() { mount -t ubifs $USER_PARTITION $MNT_USER } -fs="/run /dev /proc /sys /sys/kernel/security /dev/shm /dev/pts /run /sys/fs/cgroup /sys/fs/cgroup/unified +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" @@ -69,7 +69,7 @@ do_clear_old() { mv "$FILE_PATH" "$MNT_USER/$FILE_NAME.old" 2>&1 | logpipe done do_remove_old - rm -f $DO_CLEAR_PERSISTENT + fw_setenv default_reset_f 0 } # Most efficient way to clear UBIFS file system @@ -99,7 +99,7 @@ do_rw_mount() { if [[ -f $DO_ERASE_PERSISTENT ]] ; then do_erase_old - elif [[ -f $DO_CLEAR_PERSISTENT ]] ; then + elif [[ "$DO_CLEAR_PERSISTENT" -eq 1 ]] ; then do_clear_old fi @@ -122,31 +122,14 @@ do_rw_mount() { umount -l /var/volatile >/dev/null 2>&1 cgroupmnts=$(sed -r -e 's/[^[:space:]]*[[:space:]]//' -e 's/[[:space:]]+.*//g' /proc/mounts | grep '^/orig') for mp in ${cgroupmnts} ; do - if [[ $mp != /orig ]] && [[ -d $mp ]] ; then + if [[ $mp != /orig ]] && [[ $mp != /orig/mnt* ]] && [[ -d $mp ]] ; then umount -l $mp >/dev/null 2>&1 fi done } - -TMP=/var/volatile -# Set the suffix number in /var/oem and /var/config to match root -fix_volume_names() { - if ! [[ $(cat /proc/cmdline) =~ root=ubi0:rootfs([0-9]+) ]] ; then - loginfo "Cannot find root=ubi0:rootfs in /proc/cmdline" - fi - vol_suffix=${BASH_REMATCH[1]} - echo $vol_suffix - sed -r "s/(ubi0:(oem|config))([0-9]*)/\1${vol_suffix}/" /etc/fstab >${TMP}/fstab - if ! cmp ${TMP}/fstab /etc/fstab ; then - loginfo "Updating fstab with new volume names" - cp ${TMP}/fstab /etc/fstab - fi -} - do_start() { do_rw_mount - fix_volume_names } case $1 in |