2
0
forked from Ivasoft/openwrt

base-files: sysupgrade: abort if config backup fails

Sysupgrade shouldn't proceed, if the backup of the configuration
fails because tar (or gzip) exit with a non-zero code.

Signed-off-by: Andreas Ziegler <dev@andreas-ziegler.de>
This commit is contained in:
Andreas Ziegler
2018-08-04 01:56:39 +02:00
committed by John Crispin
parent a692e4e3de
commit 72489ebeb6
2 changed files with 6 additions and 1 deletions

View File

@@ -165,6 +165,11 @@ do_save_conffiles() {
v "Saving config files..."
[ "$VERBOSE" -gt 1 ] && TAR_V="v" || TAR_V=""
tar c${TAR_V}zf "$conf_tar" -T "$CONFFILES" 2>/dev/null
if [ "$?" -ne 0 ]; then
echo "Failed to create the configuration backup."
rm -f "$conf_tar"
exit 1
fi
rm -f "$CONFFILES"
}