base-files: sysupgrade: always imply -n if -f is not provided

This ensures that no random config giles get carried over.

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2023-01-23 09:49:44 +01:00
parent 6129f525d5
commit 492db67f64
2 changed files with 37 additions and 27 deletions

View File

@@ -1,27 +0,0 @@
From 9fb93fbd42f8f1f3036580b6666b40ab343509f8 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 17 Jun 2021 08:47:51 +0200
Subject: [PATCH 13/43] base-files: ignore sysupgrade that was not ours
Signed-off-by: John Crispin <john@phrozen.org>
---
package/base-files/files/lib/preinit/80_mount_root | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/package/base-files/files/lib/preinit/80_mount_root b/package/base-files/files/lib/preinit/80_mount_root
index 3f75411a43..7cf16e68e0 100644
--- a/package/base-files/files/lib/preinit/80_mount_root
+++ b/package/base-files/files/lib/preinit/80_mount_root
@@ -17,7 +17,8 @@ missing_lines() {
do_mount_root() {
mount_root
boot_run_hook preinit_mount_root
- [ -f /sysupgrade.tgz ] && {
+ (tar tzf /sysupgrade.tgz | grep -q ucentral) 2> /dev/null
+ [ $? -eq 0 ] && {
echo "- config restore -"
cp /etc/passwd /etc/group /etc/shadow /tmp
cd /
--
2.25.1

View File

@@ -0,0 +1,37 @@
From 60cf08fa4ce44d7c3d3c6264a933f4c6e5b2e831 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Mon, 23 Jan 2023 09:47:54 +0100
Subject: [PATCH] base-files: sysupgrade: always assume -n if -f is not
provided
Signed-off-by: John Crispin <john@phrozen.org>
---
package/base-files/files/sbin/sysupgrade | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade
index 5a2d459013..f55237b935 100755
--- a/package/base-files/files/sbin/sysupgrade
+++ b/package/base-files/files/sbin/sysupgrade
@@ -9,7 +9,7 @@ export MTD_ARGS=""
export MTD_CONFIG_ARGS=""
export INTERACTIVE=0
export VERBOSE=1
-export SAVE_CONFIG=1
+export SAVE_CONFIG=0
export SAVE_OVERLAY=0
export SAVE_OVERLAY_PATH=
export SAVE_PARTITIONS=1
@@ -345,9 +345,6 @@ if [ -n "$CONF_IMAGE" ]; then
esac
get_image "$CONF_IMAGE" "cat" > "$CONF_TAR"
export SAVE_CONFIG=1
-elif ask_bool $SAVE_CONFIG "Keep config files over reflash"; then
- [ $TEST -eq 1 ] || do_save_conffiles "$CONF_TAR"
- export SAVE_CONFIG=1
else
[ $TEST -eq 1 ] || rm -f "$CONF_TAR"
export SAVE_CONFIG=0
--
2.34.1