summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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