mirror of
https://github.com/openwrt/openwrt.git
synced 2025-02-18 16:40:29 +00:00
base-files: sysupgrade: add function for conffiles retrieval
The find command to retrieve files from /etc/sysupgrade.conf and /lib/upgrade/keep.d/* is used twice in almost the same way. Move it into a function to consolidate, enhance readability and make future adjustments easier. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Acked-by: Paul Spooren <mail@aparcar.org> Reviewed-by: Philip Prindeville <philipp@redfish-solutions.com>
This commit is contained in:
parent
f17c300983
commit
93b6122212
@ -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:=242
|
PKG_RELEASE:=243
|
||||||
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/
|
||||||
|
@ -131,12 +131,19 @@ list_changed_conffiles() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list_static_conffiles() {
|
||||||
|
local filter=$1
|
||||||
|
|
||||||
|
find $(sed -ne '/^[[:space:]]*$/d; /^#/d; p' \
|
||||||
|
/etc/sysupgrade.conf /lib/upgrade/keep.d/* 2>/dev/null) \
|
||||||
|
\( -type f -o -type l \) $filter 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
add_conffiles() {
|
add_conffiles() {
|
||||||
local file="$1"
|
local file="$1"
|
||||||
( find $(sed -ne '/^[[:space:]]*$/d; /^#/d; p' \
|
|
||||||
/etc/sysupgrade.conf /lib/upgrade/keep.d/* 2>/dev/null) \
|
( list_static_conffiles "$find_filter"; list_changed_conffiles ) |
|
||||||
\( -type f -o -type l \) $find_filter 2>/dev/null;
|
sort -u > "$file"
|
||||||
list_changed_conffiles ) | sort -u > "$file"
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,9 +161,7 @@ add_overlayfiles() {
|
|||||||
|
|
||||||
# backup files from /etc/sysupgrade.conf and /lib/upgrade/keep.d, but
|
# backup files from /etc/sysupgrade.conf and /lib/upgrade/keep.d, but
|
||||||
# ignore those aready controlled by opkg conffiles
|
# ignore those aready controlled by opkg conffiles
|
||||||
find $(sed -ne '/^[[:space:]]*$/d; /^#/d; p' \
|
list_static_conffiles | sort -u |
|
||||||
/etc/sysupgrade.conf /lib/upgrade/keep.d/* 2>/dev/null) \
|
|
||||||
\( -type f -o -type l \) 2>/dev/null | sort -u |
|
|
||||||
grep -h -v -x -F -f $conffiles > "$keepfiles"
|
grep -h -v -x -F -f $conffiles > "$keepfiles"
|
||||||
|
|
||||||
# backup conffiles, but only those changed if '-u'
|
# backup conffiles, but only those changed if '-u'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user