summaryrefslogtreecommitdiff
path: root/recipes-core/multitech/overlayfs-init-ubi
diff options
context:
space:
mode:
authorSerhii Voloshynov <serhii.voloshynov@globallogic.com>2023-05-26 13:02:47 +0300
committerSerhii Voloshynov <serhii.voloshynov@globallogic.com>2023-05-26 13:02:47 +0300
commit778a912b4c0f78af3793a6c2a9cbe10c08fd6175 (patch)
tree620f096575ca68675f2766b714f4db0696747130 /recipes-core/multitech/overlayfs-init-ubi
parent6fb979d380594a150ca8915c43ae3bed9a4a13a9 (diff)
downloadmeta-mlinux-778a912b4c0f78af3793a6c2a9cbe10c08fd6175.tar.gz
meta-mlinux-778a912b4c0f78af3793a6c2a9cbe10c08fd6175.tar.bz2
meta-mlinux-778a912b4c0f78af3793a6c2a9cbe10c08fd6175.zip
improve removing nonpersistent data
Diffstat (limited to 'recipes-core/multitech/overlayfs-init-ubi')
-rw-r--r--recipes-core/multitech/overlayfs-init-ubi/overlayfs.init28
1 files changed, 6 insertions, 22 deletions
diff --git a/recipes-core/multitech/overlayfs-init-ubi/overlayfs.init b/recipes-core/multitech/overlayfs-init-ubi/overlayfs.init
index 9e60961..263aa62 100644
--- a/recipes-core/multitech/overlayfs-init-ubi/overlayfs.init
+++ b/recipes-core/multitech/overlayfs-init-ubi/overlayfs.init
@@ -52,28 +52,13 @@ my_switch_root() {
/sbin/pivot_root $NEW_ROOT $NEW_ROOT/orig
}
-do_remove_old() {
- shopt -s dotglob
- rm -rf $MNT_USER/*.old
- shopt -u dotglob
-}
-
-# select files for deletion
-do_clear_old() {
- # when "clear user data" is requested - mark all non-hidden files for deletion
+do_remove_nonpersistent() {
loginfo "Clearing user data. Persistent data will be left "
-
- for FILE_PATH in "$MNT_USER"/*; do
- FILE_NAME=$(basename "$FILE_PATH")
- # rename all files and folders that exist in /mnt/user
- mv "$FILE_PATH" "$MNT_USER/$FILE_NAME.old" 2>&1 | logpipe
- done
- do_remove_old
- fw_setenv default_reset_f 0
+ rm -rf $MNT_USER/*
}
# Most efficient way to clear UBIFS file system
-do_erase_old() {
+do_erase_all() {
loginfo "Erasing user data"
# Sys must be mounted to use ubifs utilities
mount -t sysfs sysfs /sys
@@ -96,13 +81,12 @@ do_rw_mount() {
mount -t tmpfs inittemp /mnt
mnt_user # user_data is now accessible
- do_remove_old
-
if [[ "$DO_ERASE_PERSISTENT" -eq 1 ]] ; then
- do_erase_old
+ do_erase_all
fw_setenv default_reset_f 0
elif [[ "$DO_CLEAR_PERSISTENT" -eq 1 ]] ; then
- do_clear_old
+ do_remove_nonpersistent
+ fw_setenv default_reset_f 0
fi
mkdir -p $UPPERDIR $WORKDIR $OVERLAY $USER_ORIG ${MNT_USER}/.persistent