base-files: merge /etc/passwd support more than just /rom based installs
Imran K
gururug at gmail.com
Fri Nov 27 01:19:02 EST 2020
Support more than /rom only when migrating user accounts
Signed-by: Imran Khan <gururug at gmail.com>
---
diff --git a/package/base-files/files/lib/preinit/80_mount_root
b/package/base-files/files/lib/preinit/80_mount_root
index 56d3fa3797..1c5bdbc9d8 100644
--- a/package/base-files/files/lib/preinit/80_mount_root
+++ b/package/base-files/files/lib/preinit/80_mount_root
@@ -20,11 +20,17 @@ do_mount_root() {
boot_run_hook preinit_mount_root
[ -f /sysupgrade.tgz ] && {
echo "- config restore -"
- cd /
+ cp /etc/passwd /tmp/
+ cp /etc/group /tmp/
+ cp /etc/shadow /tmp/
+ cd /
tar xzf /sysupgrade.tgz
- missing_lines /rom/etc/passwd /etc/passwd >> /etc/passwd
- missing_lines /rom/etc/group /etc/group >> /etc/group
- missing_lines /rom/etc/shadow /etc/shadow >> /etc/shadow
+ missing_lines /tmp/passwd /etc/passwd >> /etc/passwd
+ missing_lines /tmp/group /etc/group >> /etc/group
+ missing_lines /tmp/shadow /etc/shadow >> /etc/shadow
+ rm /tmp/shadow 2>/dev/null
+ rm /tmp/passwd 2>/dev/null
+ rm /tmp/group 2>/dev/null
# Prevent configuration corruption on a power loss
sync
}
---
More information about the openwrt-devel
mailing list