aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorChristian Buschau <cbuschau@d00t.de>2023-10-17 14:51:53 +0200
committerChristian Marangi <ansuelsmth@gmail.com>2023-10-20 00:36:32 +0200
commit67ce60c5f961c4248fa108cd0f949e2bade4536e (patch)
treedfa748c8395344515c26d083c1d388297f795510 /target/linux
parent3e1ac00ccbdaa0c396b36429ddbe83d2e3f6276f (diff)
downloadupstream-67ce60c5f961c4248fa108cd0f949e2bade4536e.tar.gz
upstream-67ce60c5f961c4248fa108cd0f949e2bade4536e.tar.bz2
upstream-67ce60c5f961c4248fa108cd0f949e2bade4536e.zip
armsr: preserve configuration during sysupgrade
Copy configuration to boot partition (partition 1) instead of root partition (partition 2) because the root partition is not writable if it's a suqashfs image. Move configuration back to root during preinit. Fixes: https://github.com/openwrt/openwrt/issues/13695 Signed-off-by: Christian Buschau <cbuschau@d00t.de>
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/armsr/base-files/lib/preinit/79_move_config19
-rw-r--r--target/linux/armsr/base-files/lib/upgrade/platform.sh3
2 files changed, 21 insertions, 1 deletions
diff --git a/target/linux/armsr/base-files/lib/preinit/79_move_config b/target/linux/armsr/base-files/lib/preinit/79_move_config
new file mode 100644
index 00000000000..864d4dfa644
--- /dev/null
+++ b/target/linux/armsr/base-files/lib/preinit/79_move_config
@@ -0,0 +1,19 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+move_config() {
+ local partdev parttype=ext4
+
+ . /lib/upgrade/common.sh
+
+ if export_bootdevice && export_partdevice partdev 1; then
+ part_magic_fat "/dev/$partdev" && parttype=vfat
+ if mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt; then
+ if [ -f "/mnt/$BACKUP_FILE" ]; then
+ mv -f "/mnt/$BACKUP_FILE" /
+ fi
+ umount /mnt
+ fi
+ fi
+}
+
+boot_hook_add preinit_mount_root move_config
diff --git a/target/linux/armsr/base-files/lib/upgrade/platform.sh b/target/linux/armsr/base-files/lib/upgrade/platform.sh
index 8263b9c7e3a..e72c6955e58 100644
--- a/target/linux/armsr/base-files/lib/upgrade/platform.sh
+++ b/target/linux/armsr/base-files/lib/upgrade/platform.sh
@@ -36,7 +36,8 @@ platform_check_image() {
platform_copy_config() {
local partdev parttype=ext4
- if export_partdevice partdev 2; then
+ if export_partdevice partdev 1; then
+ part_magic_fat "/dev/$partdev" && parttype=vfat
mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt
cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
umount /mnt