瀏覽代碼

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 <[email protected]>
Andreas Ziegler 7 年之前
父節點
當前提交
72489ebeb6
共有 2 個文件被更改,包括 6 次插入1 次删除
  1. 1 1
      package/base-files/Makefile
  2. 5 0
      package/base-files/files/sbin/sysupgrade

+ 1 - 1
package/base-files/Makefile

@@ -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/

+ 5 - 0
package/base-files/files/sbin/sysupgrade

@@ -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"
 }