forked from openwrt/openwrt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: openwrt#13695 Signed-off-by: Christian Buschau <cbuschau@d00t.de>
- Loading branch information
Showing
2 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters