diff options
author | Luiz Angelo Daros de Luca <luizluca@gmail.com> | 2017-11-21 01:45:05 -0200 |
---|---|---|
committer | John Crispin <john@phrozen.org> | 2017-12-14 09:29:30 +0100 |
commit | 3e98674bcf91c5273fd4ac830581622ee7e62651 (patch) | |
tree | c0f6b936848e91392414df3921eb6866cb30a9e7 /package/base-files | |
parent | cb02a376b360d01d70a8161e22f5491042295bcd (diff) | |
download | upstream-3e98674bcf91c5273fd4ac830581622ee7e62651.tar.gz upstream-3e98674bcf91c5273fd4ac830581622ee7e62651.tar.bz2 upstream-3e98674bcf91c5273fd4ac830581622ee7e62651.zip |
base-files: fix sysupgrade -b/-l when -c is used
Since /overlay/upper appeared, -b ignored -c silently (cause it was
still checking for /overlay/etc). Now, if /overlay/upper is absent,
sysupgrade -c will fail and exit verbosely.
Fix -l to consider -c (it never did).
Clean up to always use /overlay/upper/xxx instead of still checking
for /overlay/xxx.
Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Diffstat (limited to 'package/base-files')
-rwxr-xr-x | package/base-files/files/sbin/sysupgrade | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade index 359f21f51c..3fd612c375 100755 --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -108,14 +108,8 @@ add_uci_conffiles() { add_overlayfiles() { local file="$1" - if [ -d /overlay/upper ]; then - local overlaydir="/overlay/upper" - else - local overlaydir="/overlay" - fi - find $overlaydir/etc/ -type f -o -type l | sed \ + find /overlay/upper/etc/ -type f -o -type l | sed \ -e 's,^/overlay\/upper/,/,' \ - -e 's,^/overlay/,/,' \ -e '\,/META_[a-zA-Z0-9]*$,d' \ -e '\,/functions.sh$,d' \ -e '\,/[^/]*-opkg$,d' \ @@ -126,9 +120,16 @@ add_overlayfiles() { # hooks sysupgrade_image_check="fwtool_check_image platform_check_image" sysupgrade_pre_upgrade="fwtool_pre_upgrade" -[ $SAVE_OVERLAY = 0 -o ! -d /overlay/etc ] && \ - sysupgrade_init_conffiles="add_uci_conffiles" || \ + +if [ $SAVE_OVERLAY = 1 ]; then + [ ! -d /overlay/upper/etc ] && { + echo "Cannot find '/overlay/upper/etc', required for '-c'" + exit 1 + } sysupgrade_init_conffiles="add_overlayfiles" +else + sysupgrade_init_conffiles="add_uci_conffiles" +fi include /lib/upgrade @@ -152,7 +153,7 @@ do_save_conffiles() { } if [ $CONF_BACKUP_LIST -eq 1 ]; then - add_uci_conffiles "$CONFFILES" + run_hooks "$CONFFILES" $sysupgrade_init_conffiles cat "$CONFFILES" rm -f "$CONFFILES" exit 0 |