X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fadmin-full%2Fluasrc%2Fcontroller%2Fadmin%2Fsystem.lua;fp=modules%2Fadmin-full%2Fluasrc%2Fcontroller%2Fadmin%2Fsystem.lua;h=a5666ccbb22e0346fb8b64e31ea3dad12a61dbc5;hp=68f3d258ddff728225a6b0f1dd64215735b20404;hb=abb201ab57ee0938f92685b6466da3b548529de6;hpb=5e4d4ff5ef91e639f83d995902eb8ee23b9d6666 diff --git a/modules/admin-full/luasrc/controller/admin/system.lua b/modules/admin-full/luasrc/controller/admin/system.lua index 68f3d258d..a5666ccbb 100644 --- a/modules/admin-full/luasrc/controller/admin/system.lua +++ b/modules/admin-full/luasrc/controller/admin/system.lua @@ -2,7 +2,7 @@ LuCI - Lua Configuration Interface Copyright 2008 Steven Barth -Copyright 2008-2009 Jo-Philipp Wich +Copyright 2008-2011 Jo-Philipp Wich Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -186,7 +186,7 @@ function action_flashops() local reset_avail = os.execute([[grep '"rootfs_data"' /proc/mtd >/dev/null 2>&1]]) == 0 local restore_cmd = "tar -xzC/ >/dev/null 2>&1" - local backup_cmd = "tar -czT %s 2>/dev/null" + local backup_cmd = "sysupgrade --create-backup - 2>/dev/null" local image_tmp = "/tmp/firmware.img" local function image_supported() @@ -249,20 +249,11 @@ function action_flashops() -- -- Assemble file list, generate backup -- - local filelist = "/tmp/luci-backup-list.%d" % os.time() - sys.call( - "( find $(sed -ne '/^[[:space:]]*$/d; /^#/d; p' /etc/sysupgrade.conf " .. - "/lib/upgrade/keep.d/* 2>/dev/null) -type f 2>/dev/null; " .. - "opkg list-changed-conffiles ) | sort -u > %s" % filelist - ) - if fs.access(filelist) then - local reader = ltn12_popen(backup_cmd:format(filelist)) - luci.http.header('Content-Disposition', 'attachment; filename="backup-%s-%s.tar.gz"' % { - luci.sys.hostname(), os.date("%Y-%m-%d")}) - luci.http.prepare_content("application/x-targz") - luci.ltn12.pump.all(reader, luci.http.write) - fs.unlink(filelist) - end + local reader = ltn12_popen(backup_cmd) + luci.http.header('Content-Disposition', 'attachment; filename="backup-%s-%s.tar.gz"' % { + luci.sys.hostname(), os.date("%Y-%m-%d")}) + luci.http.prepare_content("application/x-targz") + luci.ltn12.pump.all(reader, luci.http.write) elseif luci.http.formvalue("restore") then -- -- Unpack received .tar.gz