base-files: - add sysupgrade support for keepfile hints * introduces /lib/upgrade...
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 5 Oct 2010 19:24:12 +0000 (19:24 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 5 Oct 2010 19:24:12 +0000 (19:24 +0000)
SVN-Revision: 23258

package/base-files/Makefile
package/base-files/files/etc/sysupgrade.conf [new file with mode: 0644]
package/base-files/files/lib/upgrade/keep.d/base-files-essential [new file with mode: 0644]
package/base-files/files/sbin/sysupgrade

index 9598823cb15c0a32a11b0037899c784112e3e64f..ff6dbc0871fed3ac0dd0945dfdda3e05dbf7eea7 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=base-files
-PKG_RELEASE:=58
+PKG_RELEASE:=59
 
 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
 PKG_BUILD_DEPENDS:=opkg/host
@@ -54,6 +54,8 @@ define Package/base-files/conffiles
 /etc/shells
 /etc/sysctl.conf
 /etc/rc.local
+/etc/config/
+/etc/dropbear/
 $(call $(TARGET)/conffiles)
 endef
 
diff --git a/package/base-files/files/etc/sysupgrade.conf b/package/base-files/files/etc/sysupgrade.conf
new file mode 100644 (file)
index 0000000..e06fd5e
--- /dev/null
@@ -0,0 +1,5 @@
+## This file contains files and directories that should
+## be preserved during an upgrade.
+
+# /etc/example.conf
+# /etc/openvpn/
diff --git a/package/base-files/files/lib/upgrade/keep.d/base-files-essential b/package/base-files/files/lib/upgrade/keep.d/base-files-essential
new file mode 100644 (file)
index 0000000..e35aae5
--- /dev/null
@@ -0,0 +1,10 @@
+# Essential files that will be always kept
+/etc/banner
+/etc/hosts
+/etc/inittab
+/etc/group
+/etc/passwd
+/etc/profile
+/etc/shells
+/etc/sysctl.conf
+/etc/rc.local
index 1210e6e509fdf6d64c05da030b2b5c7b303fb996..3d76bb3a0ecaabca2710e89bfbaafd7c94f48921 100755 (executable)
@@ -55,8 +55,9 @@ EOF
 
 add_uci_conffiles() {
        local file="$1"
-       ( find /etc/config /etc/passwd /etc/group /etc/dropbear \
-               /etc/firewall.user /etc/rc.local -type f;
+       ( find $(sed -ne '/^[[:space:]]*$/d; /^#/d; p' \
+               /etc/sysupgrade.conf /lib/upgrade/keep.d/* 2>/dev/null) \
+               -type f 2>/dev/null;
          opkg list-changed-conffiles ) | sort -u > "$file"
        return 0
 }