mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-03-09 15:40:20 +00:00
Update sysupgrade from upstream and force save package list
This commit is contained in:
parent
e8c603fb2f
commit
645a5656af
1 changed files with 25 additions and 19 deletions
|
@ -13,7 +13,7 @@ export SAVE_CONFIG=1
|
||||||
export SAVE_OVERLAY=0
|
export SAVE_OVERLAY=0
|
||||||
export SAVE_OVERLAY_PATH=
|
export SAVE_OVERLAY_PATH=
|
||||||
export SAVE_PARTITIONS=1
|
export SAVE_PARTITIONS=1
|
||||||
export SAVE_INSTALLED_PKGS=0
|
export SAVE_INSTALLED_PKGS=1
|
||||||
export SKIP_UNCHANGED=0
|
export SKIP_UNCHANGED=0
|
||||||
export CONF_IMAGE=
|
export CONF_IMAGE=
|
||||||
export CONF_BACKUP_LIST=0
|
export CONF_BACKUP_LIST=0
|
||||||
|
@ -113,16 +113,16 @@ EOF
|
||||||
[ "$CONF_BACKUP" = "-" ] && export VERBOSE=0
|
[ "$CONF_BACKUP" = "-" ] && export VERBOSE=0
|
||||||
|
|
||||||
missing_lines() {
|
missing_lines() {
|
||||||
local file1 file2 line
|
local file1 file2 line
|
||||||
file1="$1"
|
file1="$1"
|
||||||
file2="$2"
|
file2="$2"
|
||||||
oIFS="$IFS"
|
oIFS="$IFS"
|
||||||
IFS=":"
|
IFS=":"
|
||||||
while read line; do
|
while read line; do
|
||||||
set -- $line
|
set -- $line
|
||||||
grep -q "^$1:" "$file2" || echo "$*"
|
grep -q "^$1:" "$file2" || echo "$*"
|
||||||
done < "$file1"
|
done < "$file1"
|
||||||
IFS="$oIFS"
|
IFS="$oIFS"
|
||||||
}
|
}
|
||||||
|
|
||||||
list_conffiles() {
|
list_conffiles() {
|
||||||
|
@ -143,12 +143,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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,9 +173,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'
|
||||||
|
@ -228,7 +233,7 @@ include /lib/upgrade
|
||||||
do_save_conffiles() {
|
do_save_conffiles() {
|
||||||
local conf_tar="$1"
|
local conf_tar="$1"
|
||||||
|
|
||||||
[ -z "$(rootfs_type)" ] && {
|
[ "$(rootfs_type)" = "tmpfs" ] && {
|
||||||
echo "Cannot save config while running from ramdisk." >&2
|
echo "Cannot save config while running from ramdisk." >&2
|
||||||
ask_bool 0 "Abort" && exit
|
ask_bool 0 "Abort" && exit
|
||||||
rm -f "$conf_tar"
|
rm -f "$conf_tar"
|
||||||
|
@ -300,6 +305,7 @@ if [ -n "$CONF_RESTORE" ]; then
|
||||||
missing_lines /tmp/group /etc/group >> /etc/group
|
missing_lines /tmp/group /etc/group >> /etc/group
|
||||||
missing_lines /tmp/shadow /etc/shadow >> /etc/shadow
|
missing_lines /tmp/shadow /etc/shadow >> /etc/shadow
|
||||||
rm /tmp/passwd /tmp/group /tmp/shadow
|
rm /tmp/passwd /tmp/group /tmp/shadow
|
||||||
|
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue