base-files: merge /etc/passwd on rw-rootfs
authorImran Khan <gururug@gmail.com>
Fri, 27 Nov 2020 06:19:02 +0000 (06:19 +0000)
committerDaniel Golle <daniel@makrotopia.org>
Fri, 27 Nov 2020 09:59:14 +0000 (09:59 +0000)
Support installations without root-overlayfs (and hence without /rom)
when migrating user accounts.

Signed-off-by: Imran Khan <gururug@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
[simplified patch, bumped PKG_RELEASE, cleaned message]

package/base-files/Makefile
package/base-files/files/lib/preinit/80_mount_root

index e13578860f005312e67f5e159de0d50215fbf5d3..c06b534bea05ae7687dd62112457038e19cb5fb0 100644 (file)
@@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk
 include $(INCLUDE_DIR)/feeds.mk
 
 PKG_NAME:=base-files
-PKG_RELEASE:=237
+PKG_RELEASE:=238
 PKG_FLAGS:=nonshared
 
 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
index 56d3fa379743efe6b494a7b15a7a45f3b93caa99..a15c972220c566b381b35e6095e7a9ee055fe8ae 100644 (file)
@@ -20,11 +20,13 @@ do_mount_root() {
        boot_run_hook preinit_mount_root
        [ -f /sysupgrade.tgz ] && {
                echo "- config restore -"
+               cp /etc/passwd /etc/group /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/passwd /tmp/group /tmp/shadow
                # Prevent configuration corruption on a power loss
                sync
        }