summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-admin-full/luasrc/controller
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-mod-admin-full/luasrc/controller')
-rw-r--r--modules/luci-mod-admin-full/luasrc/controller/admin/system.lua14
1 files changed, 11 insertions, 3 deletions
diff --git a/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua b/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua
index 0c19893cf8..153615b58a 100644
--- a/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua
+++ b/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua
@@ -341,9 +341,17 @@ function action_restore()
local upload = http.formvalue("archive")
if upload and #upload > 0 then
- luci.template.render("admin_system/applyreboot")
- os.execute("tar -C / -xzf %q >/dev/null 2>&1" % archive_tmp)
- luci.sys.reboot()
+ if os.execute("gunzip -t %q >/dev/null 2>&1" % archive_tmp) == 0 then
+ luci.template.render("admin_system/applyreboot")
+ os.execute("tar -C / -xzf %q >/dev/null 2>&1" % archive_tmp)
+ luci.sys.reboot()
+ else
+ luci.template.render("admin_system/flashops", {
+ reset_avail = supports_reset(),
+ upgrade_avail = supports_sysupgrade(),
+ backup_invalid = true
+ })
+ end
return
end