🌴 Sync 2026-03-05 23:51:42

This commit is contained in:
github-actions[bot] committed 2026-03-05 23:51:42 +08:00
1 parent 97c049ed0a
commit 0acff03804
14253 files changed
+3893239

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2025 ImmortalWrt.org
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for Scheduled Reboot
define Package/luci-app-autoreboot/conffiles
/etc/config/autoreboot
endef
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature
@@ -0,0 +1,109 @@
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright (C) 2025 ImmortalWrt.org
*/
'use strict';
'require form';
'require view';
return view.extend({
render() {
let m, s, o;
m = new form.Map('autoreboot', _('Scheduled Reboot'),
_('Configure the scheduled restart of this device.'));
s = m.section(form.TableSection, 'schedule');
s.addremove = true;
s.anonymous = true;
s.sortable = true;
s.rowcolors = true;
s.addbtntitle = _('Add schedule');
o = s.option(form.Flag, 'enabled', _('Enable'));
o.rmempty = false;
o.width = '10%';
o = s.option(form.Value, 'week', _('Week'));
o.value('*', _('Every day'));
o.value('1', _('Monday'));
o.value('2', _('Tuesday'));
o.value('3', _('Wednesday'));
o.value('4', _('Thursday'));
o.value('5', _('Friday'));
o.value('6', _('Saturday'));
o.value('0', _('Sunday'));
o.default = '*';
o.rmempty = false;
o.width = '18%';
o.renderWidget = function(/* ... */) {
let dl = form.Value.prototype.renderWidget.apply(this, arguments);
dl?.style?.setProperty('min-width', '100%');
return dl;
}
o.validate = function(section_id, value) {
if (!value?.match(/^(\*|[0-6](-[0-6])?)(\/[1-9][0-9]*)?(,(\*|[0-6](-[0-6])?)(\/[1-9][0-9]*)?)*$/))
return _('Expecting: %s').format(_('valid week value'));
return true;
}
o = s.option(form.Value, 'hour', _('Hour'));
o.rmempty = false;
o.width = '18%';
o.validate = function(section_id, value) {
if (!value?.match(/^(\*|(1?[0-9]|2[0-3])(-(1?[0-9]|2[0-3]))?)(\/[1-9][0-9]*)?(,(\*|(1?[0-9]|2[0-3])(-(1?[0-9]|2[0-3]))?)(\/[1-9][0-9]*)?)*$/))
return _('Expecting: %s').format(_('valid hour value'));
return true;
}
o = s.option(form.Value, 'minute', _('Minute'));
o.rmempty = false;
o.width = '18%';
o.validate = function(section_id, value) {
if (!value?.match(/^(\*|[1-5]?[0-9](-[1-5]?[0-9])?)(\/[1-9][0-9]*)?(,(\*|[1-5]?[0-9](-[1-5]?[0-9])?)(\/[1-9][0-9]*)?)*$/))
return _('Expecting: %s').format(_('valid minute value'));
return true;
}
o = s.option(form.Value, 'month', _('Month'));
o.value('*', _('Every month'));
o.value('1', _('January'));
o.value('2', _('February'));
o.value('3', _('March'));
o.value('4', _('April'));
o.value('5', _('May'));
o.value('6', _('June'));
o.value('7', _('July'));
o.value('8', _('August'));
o.value('9', _('September'));
o.value('10', _('October'));
o.value('11', _('November'));
o.value('12', _('December'));
o.default = '*';
o.rmempty = false;
o.width = '18%';
o.renderWidget = function(/* ... */) {
let dl = form.Value.prototype.renderWidget.apply(this, arguments);
dl?.style?.setProperty('min-width', '100%');
return dl;
}
o.validate = function(section_id, value) {
if (!value?.match(/^(\*|([1-9]|1[0-2]?)(-([1-9]|1[0-2]?))?)(\/[1-9][0-9]*)?(,(\*|([1-9]|1[0-2]?)(-([1-9]|1[0-2]?))?)(\/[1-9][0-9]*)?)*$/))
return _('Expecting: %s').format(_('valid month value'));
return true;
}
o = s.option(form.Value, 'day', _('Day of month'));
o.validate = function(section_id, value) {
if (!value?.match(/^(\*|([1-9]|[1-2][0-9]?|3[0-1])(-([1-9]|[1-2][0-9]?|3[0-1]))?)(\/[1-9][0-9]*)?(,(\*|([1-9]|[1-2][0-9]?|3[0-1])(-([1-9]|[1-2][0-9]?|3[0-1]))?)(\/[1-9][0-9]*)?)*$/))
return _('Expecting: %s').format(_('valid day value'));
return true;
}
o.default = '*';
o.rmempty = false;
o.width = '18%';
return m.render();
}
});
@@ -0,0 +1,155 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:22
msgid "Add schedule"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:73
msgid "April"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:77
msgid "August"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:15
msgid "Configure the scheduled restart of this device."
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:92
msgid "Day of month"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:81
msgid "December"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:24
msgid "Enable"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:30
msgid "Every day"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:69
msgid "Every month"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:40
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:51
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:61
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:84
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:95
msgid "Expecting: %s"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:71
msgid "February"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:35
msgid "Friday"
msgstr ""
#: applications/luci-app-autoreboot/root/usr/share/rpcd/acl.d/luci-app-autoreboot.json:3
msgid "Grant UCI access for luci-app-autoreboot"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:48
msgid "Hour"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:70
msgid "January"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:76
msgid "July"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:75
msgid "June"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:72
msgid "March"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:74
msgid "May"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:58
msgid "Minute"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:31
msgid "Monday"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:68
msgid "Month"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:80
msgid "November"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:79
msgid "October"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:36
msgid "Saturday"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:14
#: applications/luci-app-autoreboot/root/usr/share/luci/menu.d/luci-app-autoreboot.json:3
msgid "Scheduled Reboot"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:78
msgid "September"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:37
msgid "Sunday"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:34
msgid "Thursday"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:32
msgid "Tuesday"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:33
msgid "Wednesday"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:29
msgid "Week"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:95
msgid "valid day value"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:51
msgid "valid hour value"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:61
msgid "valid minute value"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:84
msgid "valid month value"
msgstr ""
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:40
msgid "valid week value"
msgstr ""
+1
View File
@@ -0,0 +1 @@
zh_Hans
@@ -0,0 +1,162 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: zh-Hans\n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:22
msgid "Add schedule"
msgstr "添加计划"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:73
msgid "April"
msgstr "四月"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:77
msgid "August"
msgstr "八月"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:15
msgid "Configure the scheduled restart of this device."
msgstr "配置此设备的定时重启。"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:92
msgid "Day of month"
msgstr "日(day of month)"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:81
msgid "December"
msgstr "十二月"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:24
msgid "Enable"
msgstr "启用"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:30
msgid "Every day"
msgstr "每天"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:69
msgid "Every month"
msgstr "每月"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:40
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:51
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:61
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:84
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:95
msgid "Expecting: %s"
msgstr "请输入:%s"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:71
msgid "February"
msgstr "二月"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:35
msgid "Friday"
msgstr "星期五"
#: applications/luci-app-autoreboot/root/usr/share/rpcd/acl.d/luci-app-autoreboot.json:3
msgid "Grant UCI access for luci-app-autoreboot"
msgstr "授予 luci-app-autoreboot 访问 UCI 配置的权限"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:48
msgid "Hour"
msgstr "小时"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:70
msgid "January"
msgstr "一月"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:76
msgid "July"
msgstr "七月"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:75
msgid "June"
msgstr "六月"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:72
msgid "March"
msgstr "三月"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:74
msgid "May"
msgstr "五月"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:58
msgid "Minute"
msgstr "分钟"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:31
msgid "Monday"
msgstr "星期一"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:68
msgid "Month"
msgstr "月份"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:80
msgid "November"
msgstr "十一月"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:79
msgid "October"
msgstr "十月"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:36
msgid "Saturday"
msgstr "星期六"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:14
#: applications/luci-app-autoreboot/root/usr/share/luci/menu.d/luci-app-autoreboot.json:3
msgid "Scheduled Reboot"
msgstr "定时重启"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:78
msgid "September"
msgstr "九月"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:37
msgid "Sunday"
msgstr "星期日"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:34
msgid "Thursday"
msgstr "星期四"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:32
msgid "Tuesday"
msgstr "星期二"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:33
msgid "Wednesday"
msgstr "星期三"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:29
msgid "Week"
msgstr "星期"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:95
msgid "valid day value"
msgstr "有效的天数"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:51
msgid "valid hour value"
msgstr "有效的小时"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:61
msgid "valid minute value"
msgstr "有效的分钟"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:84
msgid "valid month value"
msgstr "有效的月份"
#: applications/luci-app-autoreboot/htdocs/luci-static/resources/view/autoreboot.js:40
msgid "valid week value"
msgstr "有效的星期"
@@ -0,0 +1,9 @@
config schedule
option enabled '0'
option week '0'
option hour '2'
option minute '0'
option month '*'
option day '*'
+48
View File
@@ -0,0 +1,48 @@
#!/bin/sh /etc/rc.common
START=50
USE_PROCD=1
CONF="autoreboot"
CRON_FILE="/tmp/autoreboot.cron"
setup_cron() {
local cfg="$1"
local enabled
config_get_bool enabled "$cfg" "enabled" "0"
[ "$enabled" -eq "1" ] || return 1
local minute hour day month week
config_get minute "$cfg" "minute"
config_get hour "$cfg" "hour"
config_get day "$cfg" "day"
config_get month "$cfg" "month"
config_get week "$cfg" "week"
echo "$minute $hour $day $month $week sleep 5 && touch /etc/banner && reboot #${CONF}_$cfg" >> "$CRON_FILE"
}
start_service() {
crontab -l | sed "/#${CONF}_/d" > "$CRON_FILE"
config_load "$CONF"
config_foreach setup_cron schedule
crontab "$CRON_FILE"
rm -f "$CRON_FILE"
}
stop_service() {
sed -i "/#${CONF}_/d" "/etc/crontabs/root"
/etc/init.d/cron restart
}
service_triggers() {
procd_add_reload_trigger "$CONF"
}
reload_service() {
restart
}
@@ -0,0 +1,13 @@
#!/bin/sh
[ ! -f "/usr/share/ucitrack/luci-app-autoreboot.json" ] && {
cat > /usr/share/ucitrack/luci-app-autoreboot.json << EEOF
{
"config": "autoreboot",
"init": "autoreboot"
}
EEOF
}
rm -f /tmp/luci-indexcache
exit 0
@@ -0,0 +1,12 @@
#!/bin/sh
if uci -q get "autoreboot.@login[0]" > "/dev/null"; then
uci rename "autoreboot.@login[0].enable"="enabled"
uci set "autoreboot.@login[0].day"="*"
uci set "autoreboot.@login[0].month"="*"
[ "$(uci get "autoreboot.@login[0]".week)" = "7" ] && uci set "autoreboot.@login[0].week"="*"
uci commit "autoreboot"
sed -i "s,config login,config schedule,g" "/etc/config/autoreboot"
fi
exit 0
@@ -0,0 +1,14 @@
{
"admin/system/autoreboot": {
"title": "Scheduled Reboot",
"order": 88,
"action": {
"type": "view",
"path": "autoreboot"
},
"depends": {
"acl": [ "luci-app-autoreboot" ],
"uci": { "autoreboot": true }
}
}
}
@@ -0,0 +1,11 @@
{
"luci-app-autoreboot": {
"description": "Grant UCI access for luci-app-autoreboot",
"read": {
"uci": [ "autoreboot" ]
},
"write": {
"uci": [ "autoreboot" ]
}
}
}