From 57be93c16d45ac1db024375e7f4108f9baec553c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 12 Feb 2024 11:56:57 +0100 Subject: [PATCH] base-files: sysupgrade: replace UMOUNT_ETCBACKUP_DIR with a local variable MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It was used inside do_save_conffiles() only. Signed-off-by: Rafał Miłecki --- package/base-files/files/sbin/sysupgrade | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade index e6ce3bd183..b88b017ac0 100755 --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -24,7 +24,6 @@ export NEED_IMAGE= export HELP=0 export FORCE=0 export TEST=0 -export UMOUNT_ETCBACKUP_DIR=0 # parse options while [ -n "$1" ]; do @@ -225,6 +224,8 @@ include /lib/upgrade do_save_conffiles() { local conf_tar="$1" + local umount_etcbackup_dir=0 + [ "$(rootfs_type)" = "tmpfs" ] && { echo "Cannot save config while running from ramdisk." >&2 ask_bool 0 "Abort" && exit @@ -241,7 +242,7 @@ do_save_conffiles() { RAMFS="$(mktemp -d -t sysupgrade.XXXXXX)" mkdir -p "$RAMFS/upper" "$RAMFS/work" mount -t overlay overlay -o lowerdir=$ETCBACKUP_DIR,upperdir=$RAMFS/upper,workdir=$RAMFS/work $ETCBACKUP_DIR && - UMOUNT_ETCBACKUP_DIR=1 || { + umount_etcbackup_dir=1 || { echo "Cannot mount '$ETCBACKUP_DIR' as tmpfs to avoid touching disk while saving the list of installed packages." >&2 ask_bool 0 "Abort" && exit } @@ -265,7 +266,7 @@ do_save_conffiles() { rm -f "$conf_tar" fi - [ "$UMOUNT_ETCBACKUP_DIR" -eq 1 ] && { + [ "$umount_etcbackup_dir" -eq 1 ] && { umount "$ETCBACKUP_DIR" rm -rf "$RAMFS" } -- 2.30.2