base-files: abort sysupgrade if file specified with --restore-config is not found
[openwrt/svn-archive/archive.git] / package / base-files / files / sbin / sysupgrade
index 49c34b80732b84a32df96cfd71a6b4791cd2fe83..f6b628e96ef6123ac4c6045a28270396059bf6bd 100755 (executable)
@@ -140,7 +140,12 @@ if [ -n "$CONF_BACKUP" ]; then
        exit $?
 fi
 
-if [ -f "$CONF_RESTORE" ] || [ "$CONF_RESTORE" = "-" ]; then
+if [ -n "$CONF_RESTORE" ]; then
+       if [ "$CONF_RESTORE" != "-" ] && [ ! -f "$CONF_RESTORE" ]; then
+               echo "Backup archive '$CONF_RESTORE' not found."
+               exit 1
+       fi
+
        [ "$VERBOSE" -gt 1 ] && TAR_V="v" || TAR_V=""
        tar -C / -x${TAR_V}zf "$CONF_RESTORE"
        exit $?