- find /overlay/etc/ -type f | sed \
- -e 's,^/overlay/,/,' \
- -e '\,/META_[a-zA-Z0-9]*$,d' \
- -e '\,/functions.sh$,d' \
+
+ local packagesfiles=$1.packagesfiles
+ touch "$packagesfiles"
+
+ if [ "$SAVE_OVERLAY_PATH" = / ]; then
+ local conffiles=$1.conffiles
+ local keepfiles=$1.keepfiles
+
+ list_conffiles | cut -f2 -d ' ' | sort -u > "$conffiles"
+
+ # backup files from /etc/sysupgrade.conf and /lib/upgrade/keep.d, but
+ # ignore those aready controlled by opkg conffiles
+ list_static_conffiles | sort -u |
+ grep -h -v -x -F -f $conffiles > "$keepfiles"
+
+ # backup conffiles, but only those changed if '-u'
+ [ $SKIP_UNCHANGED = 1 ] &&
+ list_changed_conffiles | sort -u > "$conffiles"
+
+ # do not backup files from packages, except those listed
+ # in conffiles and keep.d
+ {
+ find /usr/lib/opkg/info -type f -name "*.list" -exec cat {} \;
+ find /usr/lib/opkg/info -type f -name "*.control" -exec sed \
+ -ne '/^Alternatives/{s/^Alternatives: //;s/, /\n/g;p}' {} \; |
+ cut -f2 -d:
+ } | grep -v -x -F -f $conffiles |
+ grep -v -x -F -f $keepfiles | sort -u > "$packagesfiles"
+ rm -f "$keepfiles" "$conffiles"
+ fi
+
+ # busybox grep bug when file is empty
+ [ -s "$packagesfiles" ] || echo > $packagesfiles
+
+ ( cd /overlay/upper/; find .$SAVE_OVERLAY_PATH \( -type f -o -type l \) $find_filter | sed \
+ -e 's,^\.,,' \
+ -e '\,^/etc/board.json$,d' \