From 2fd21d049a23a765f7873a8ae5ab470ac904e8c9 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Sun, 9 Nov 2008 20:09:31 +0000 Subject: [PATCH] Include backup date and hostname in backup archive name --- modules/admin-full/luasrc/controller/admin/system.lua | 3 ++- modules/admin-mini/luasrc/controller/mini/system.lua | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/admin-full/luasrc/controller/admin/system.lua b/modules/admin-full/luasrc/controller/admin/system.lua index 1afdfc55ef..b6de148843 100644 --- a/modules/admin-full/luasrc/controller/admin/system.lua +++ b/modules/admin-full/luasrc/controller/admin/system.lua @@ -144,7 +144,8 @@ function action_backup() elseif backup then luci.util.perror(backup_cmd:format(_keep_pattern())) local backup_fpi = io.popen(backup_cmd:format(_keep_pattern()), "r") - luci.http.header('Content-Disposition', 'attachment; filename="backup.tar.gz"') + 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(luci.ltn12.source.file(backup_fpi), luci.http.write) elseif reset then diff --git a/modules/admin-mini/luasrc/controller/mini/system.lua b/modules/admin-mini/luasrc/controller/mini/system.lua index 936d2634ac..1a26280725 100644 --- a/modules/admin-mini/luasrc/controller/mini/system.lua +++ b/modules/admin-mini/luasrc/controller/mini/system.lua @@ -57,7 +57,8 @@ function action_backup() elseif backup then luci.util.perror(backup_cmd:format(_keep_pattern())) local backup_fpi = io.popen(backup_cmd:format(_keep_pattern()), "r") - luci.http.header('Content-Disposition', 'attachment; filename="backup.tar.gz"') + 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(luci.ltn12.source.file(backup_fpi), luci.http.write) elseif reset then -- 2.30.2