mirror of
https://github.com/openwrt/openwrt.git
synced 2025-02-12 05:35:38 +00:00
base-files: merge /etc/passwd et al at sysupgrade config restore
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
parent
2812ea3acb
commit
de7ca7dafa
@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk
|
|||||||
include $(INCLUDE_DIR)/feeds.mk
|
include $(INCLUDE_DIR)/feeds.mk
|
||||||
|
|
||||||
PKG_NAME:=base-files
|
PKG_NAME:=base-files
|
||||||
PKG_RELEASE:=232
|
PKG_RELEASE:=233
|
||||||
PKG_FLAGS:=nonshared
|
PKG_FLAGS:=nonshared
|
||||||
|
|
||||||
PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
|
PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
|
||||||
|
@ -2,6 +2,19 @@
|
|||||||
# Copyright (C) 2006 OpenWrt.org
|
# Copyright (C) 2006 OpenWrt.org
|
||||||
# Copyright (C) 2010 Vertical Communications
|
# Copyright (C) 2010 Vertical Communications
|
||||||
|
|
||||||
|
missing_lines() {
|
||||||
|
local file1 file2 line
|
||||||
|
file1="$1"
|
||||||
|
file2="$2"
|
||||||
|
oIFS="$IFS"
|
||||||
|
IFS=":"
|
||||||
|
while read line; do
|
||||||
|
set -- $line
|
||||||
|
grep -q "^$1:" "$file2" || echo "$*"
|
||||||
|
done < "$file1"
|
||||||
|
IFS="$oIFS"
|
||||||
|
}
|
||||||
|
|
||||||
do_mount_root() {
|
do_mount_root() {
|
||||||
mount_root
|
mount_root
|
||||||
boot_run_hook preinit_mount_root
|
boot_run_hook preinit_mount_root
|
||||||
@ -9,6 +22,9 @@ do_mount_root() {
|
|||||||
echo "- config restore -"
|
echo "- config restore -"
|
||||||
cd /
|
cd /
|
||||||
tar xzf /sysupgrade.tgz
|
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
|
||||||
# Prevent configuration corruption on a power loss
|
# Prevent configuration corruption on a power loss
|
||||||
sync
|
sync
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user