update 2023-10-14 23:35:30

This commit is contained in:
github-actions[bot] 2023-10-14 23:35:30 +08:00
parent ca032548d4
commit ddba8cb853
5 changed files with 14 additions and 22 deletions

View File

@ -16,7 +16,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-amlogic
PKG_VERSION:=3.1.204
PKG_VERSION:=3.1.206
PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0 License

View File

@ -41,8 +41,7 @@ my.render = function(self, section, scope)
end
my.write = function(self, section, scope)
local handle = io.popen("[[ -s /etc/amlogic_backup_list.conf ]] || sed -n \"/BACKUP_LIST='/,/.*'$/p\" /usr/sbin/openwrt-backup | tr -d \"BACKUP_LIST=|'\" >/etc/amlogic_backup_list.conf 2>/dev/null")
local result = handle:read("*a")
local handle = io.popen("[[ -s /etc/amlogic_backup_list.conf ]] || sed -n \"/BACKUP_LIST='/,/.*'$/p\" /usr/sbin/openwrt-backup | sed -e \"s/BACKUP_LIST=\\(.*\\)/\\1/; s/'//g; s/\\\\\\\\//g; s/ //g\" > /etc/amlogic_backup_list.conf 2>/dev/null")
handle:close()
luci.http.redirect(luci.dispatcher.build_url("admin", "system", "amlogic", "backuplist"))
end

View File

@ -15,28 +15,19 @@ function remove_spaces(value)
return value
end
-- Add ' \' to the end of each line except the last line
function check_backslash(str)
-- Remove backslash at the end of each line
function remove_backslash_at_end(value)
local lines = {}
for line in str:gmatch("[^\r\n]+") do
for line in value:gmatch("[^\r\n]+") do
line = line:gsub("%s*\\%s*$", "")
table.insert(lines, line)
end
local lastLineIndex = #lines
for i, line in ipairs(lines) do
if i < lastLineIndex then
if not line:match("%s+\\%s*$") then
lines[i] = line .. " \\"
end
end
end
return table.concat(lines, "\n")
end
local f = SimpleForm("customize",
translate("Backup Configuration - Custom List"),
translate("Please maintain the format of the backup list. Except for the last line, each line should end with ' \\' character."))
translate("Write one configuration item per line, and directories should end with a /."))
local o = f:field(Value, "_custom")
@ -46,13 +37,13 @@ o.rows = 30
function o.cfgvalue(self, section)
local readconf = fs.readfile(backup_list_conf)
local value = remove_spaces(readconf)
local value = check_backslash(value)
local value = remove_backslash_at_end(value)
return value
end
function o.write(self, section, value)
local value = remove_spaces(value)
local value = check_backslash(value)
local value = remove_backslash_at_end(value)
fs.writefile(backup_list_conf, value)
luci.http.redirect(luci.dispatcher.build_url("admin", "system", "amlogic", "backup"))
end

View File

@ -269,8 +269,8 @@ msgstr "打开列表"
msgid "Backup Configuration - Custom List"
msgstr "备份配置 - 自定义列表"
msgid "Please maintain the format of the backup list. Except for the last line, each line should end with ' \\' character."
msgstr "请保持备份列表的格式,除最后一行外,每行以 ' \\' 结尾。"
msgid "Write one configuration item per line, and directories should end with a /."
msgstr "每行写一个配置项,目录需要以/结尾。"
msgid "Restore Backup:"
msgstr "恢复备份:"

View File

@ -14,7 +14,9 @@ BACKUP_FILE="${BACKUP_DIR}/${BACKUP_NAME}"
# Customize backup list
backup_list_conf="/etc/amlogic_backup_list.conf"
if [[ -s "${backup_list_conf}" ]]; then
BACKUP_LIST="$(cat ${backup_list_conf} 2>/dev/null)"
while IFS= read -r line; do
BACKUP_LIST+="${line} "
done < "${backup_list_conf}"
else
BACKUP_LIST='./etc/AdGuardHome.yaml \
./etc/amlogic_backup_list.conf \