base-files: sysupgrade: abort if config backup fails
authorAndreas Ziegler <dev@andreas-ziegler.de>
Fri, 3 Aug 2018 23:56:39 +0000 (01:56 +0200)
committerJo-Philipp Wich <jo@mein.io>
Tue, 18 Dec 2018 09:27:36 +0000 (10:27 +0100)
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>
(backported from 72489ebeb65fd1e1d77e8d9fbe105827a98dbf03)

package/base-files/Makefile
package/base-files/files/sbin/sysupgrade

index 8775ffbc80ec5833d6cad473ae21f10acaef90bd..04a863a8c50e6fc95ed572541a3443d5ad8bbaf9 100644 (file)
@@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk
 include $(INCLUDE_DIR)/feeds.mk
 
 PKG_NAME:=base-files
-PKG_RELEASE:=193
+PKG_RELEASE:=194
 PKG_FLAGS:=nonshared
 
 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
index 2f579fb87434afad8063b8bfec22d2a43cabf59c..3637943117146c20232674b12eb30afc90f13396 100755 (executable)
@@ -166,6 +166,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"
 }