mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-31 10:25:13 +08:00
💋 Sync 2026-10-04 04:16:09
This commit is contained in:
1 parent
f6b2df73ec
commit
f62992fd80
745 files changed
+212416
-1173
No files matched your search
@@ -0,0 +1,52 @@
|
||||
package quickactions
|
||||
|
||||
config settings 'global'
|
||||
option poll_interval '5'
|
||||
option design_style '3d'
|
||||
|
||||
config mapping
|
||||
option keyword 'reboot'
|
||||
option service 'system'
|
||||
option dangerous '1'
|
||||
option icon '⚠️'
|
||||
|
||||
config essential 'reboot'
|
||||
option label 'Reboot Router'
|
||||
option icon '🔄'
|
||||
option command '/sbin/reboot'
|
||||
option confirm '1'
|
||||
|
||||
config essential 'shutdown'
|
||||
option label 'Shutdown'
|
||||
option icon '⏻'
|
||||
option command '/sbin/poweroff'
|
||||
option confirm '1'
|
||||
|
||||
config essential 'wifi_toggle'
|
||||
option label 'WiFi Off/On'
|
||||
option icon '📶'
|
||||
option command '/usr/bin/quickactions-wifi-toggle'
|
||||
option confirm '1'
|
||||
|
||||
config essential 'cache_clear'
|
||||
option label 'Clear LuCI Cache'
|
||||
option icon '🧹'
|
||||
option command 'rm -rf /tmp/luci-indexcache /tmp/luci-modulecache*; /etc/init.d/rpcd restart; /etc/init.d/uhttpd restart'
|
||||
option confirm '0'
|
||||
|
||||
config shortcut 'openvpn'
|
||||
option label 'OpenVPN'
|
||||
option icon '🔒'
|
||||
option path 'admin/services/openvpn'
|
||||
|
||||
config shortcut 'firewall'
|
||||
option label 'Firewall'
|
||||
option icon '🛡️'
|
||||
option path 'admin/network/firewall'
|
||||
|
||||
config essential 'backup'
|
||||
option order '14'
|
||||
option label 'Download Config Backup'
|
||||
option icon '💾'
|
||||
option command '/sbin/sysupgrade -b /tmp/backup-$(date +%Y%m%d-%H%M%S).tar.gz && ls -la /tmp/backup-*.tar.gz | tail -1'
|
||||
option confirm '0'
|
||||
@@ -0,0 +1,3 @@
|
||||
config global 'global'
|
||||
option customscript ' '
|
||||
option customscript2 ' '
|
||||
@@ -0,0 +1 @@
|
||||
config wizard 'default'
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
# Flush conntrack when a watched WAN interface goes up or down.
|
||||
# Watched list = primary + backups from /etc/config/quickactions failover.
|
||||
|
||||
[ "$ACTION" = "ifup" ] || [ "$ACTION" = "ifdown" ] || exit 0
|
||||
|
||||
. /lib/functions.sh
|
||||
config_load quickactions
|
||||
|
||||
config_get WATCH failover primary ""
|
||||
config_get BACKUPS failover backups ""
|
||||
|
||||
IFACE="$INTERFACE"
|
||||
for i in $WATCH $BACKUPS; do
|
||||
if [ "$i" = "$IFACE" ]; then
|
||||
if [ -e /proc/net/nf_conntrack ]; then
|
||||
echo f > /proc/net/nf_conntrack
|
||||
elif [ -e /proc/net/ip_conntrack ]; then
|
||||
echo f > /proc/net/ip_conntrack
|
||||
fi
|
||||
logger -t quickactions-hotplug "IFACE $IFACE $ACTION; conntrack flushed"
|
||||
break
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
START=95
|
||||
STOP=05
|
||||
USE_PROCD=0
|
||||
|
||||
HP=/etc/hotplug.d/iface/99-quickactions-conntrack-flush
|
||||
CRON_LINE="* * * * * /usr/bin/wan-watchdog.sh"
|
||||
|
||||
start() {
|
||||
en=$(uci -q get quickactions.failover.enabled)
|
||||
[ -z "$en" ] && en=1
|
||||
if [ "$en" = "1" ]; then
|
||||
[ -f "$HP" ] && chmod 755 "$HP"
|
||||
(crontab -l 2>/dev/null | grep -v "wan-watchdog.sh"; echo "$CRON_LINE") | crontab -
|
||||
else
|
||||
[ -f "$HP" ] && chmod 644 "$HP"
|
||||
crontab -l 2>/dev/null | grep -v "wan-watchdog.sh" | crontab -
|
||||
fi
|
||||
/etc/init.d/cron restart
|
||||
}
|
||||
|
||||
stop() {
|
||||
crontab -l 2>/dev/null | grep -v "wan-watchdog.sh" | crontab -
|
||||
/etc/init.d/cron restart
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=90
|
||||
STOP=10
|
||||
|
||||
# Unique path prefix so this coexists with the original hotplug-generator
|
||||
IFACE_PATH="/etc/hotplug.d/iface/91-qa-hp"
|
||||
|
||||
add_iface_rule() {
|
||||
local enabled action command description interface target
|
||||
config_get enabled "$1" enabled
|
||||
[ "$enabled" = "0" ] && return
|
||||
config_get action "$1" action
|
||||
config_get description "$1" description
|
||||
config_get interface "$1" interface
|
||||
|
||||
[ -z "$action" ] && return
|
||||
[ -z "$interface" ] && return
|
||||
|
||||
target="$IFACE_PATH-$1"
|
||||
{
|
||||
echo "#!/bin/sh"
|
||||
echo "# Generated by luci-app-quickactions - do not edit directly"
|
||||
echo "# Source: /etc/config/hotplug section [$1]"
|
||||
description=$(echo $description | tr '\n' ' ')
|
||||
echo "# Description: $description"
|
||||
echo ""
|
||||
echo "if [ \"\$ACTION\" = \"$action\" ]; then"
|
||||
echo " if [ \"\$INTERFACE\" = \"$interface\" ]; then"
|
||||
} > "$target"
|
||||
|
||||
command_list=$(uci -q get "hotplug.$1.command")
|
||||
[ "${command_list:0:1}" = "'" ] && command_list="${command_list:1}"
|
||||
[ "${command_list: -1}" = "'" ] && command_list="${command_list%?}"
|
||||
i=0
|
||||
while true ; do
|
||||
i=$((i+1))
|
||||
command=$(echo "$command_list" | awk -v i=$i -F "' '" '{print $i}')
|
||||
[ -z "$command" ] && break
|
||||
echo " $command" >> "$target"
|
||||
done
|
||||
|
||||
{
|
||||
echo " fi"
|
||||
echo "fi"
|
||||
echo "exit 0"
|
||||
} >> "$target"
|
||||
chmod 755 "$target"
|
||||
}
|
||||
|
||||
start() {
|
||||
mkdir -p /etc/hotplug.d/iface
|
||||
rm -f "${IFACE_PATH}-"* 2>/dev/null
|
||||
config_load hotplug
|
||||
config_foreach add_iface_rule iface
|
||||
logger -t quickactions-hotplug "Handlers regenerated from /etc/config/hotplug"
|
||||
}
|
||||
|
||||
stop() {
|
||||
rm -f "${IFACE_PATH}-"* 2>/dev/null
|
||||
logger -t quickactions-hotplug "Handlers removed"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
STOP=10
|
||||
USE_PROCD=1
|
||||
|
||||
SHORTCUT_APPLIER=/usr/libexec/quickactions-netwizard/apply-shortcuts.sh
|
||||
|
||||
clean_shortcuts() {
|
||||
local sec
|
||||
for sec in $(uci -q show nginx 2>/dev/null | sed -n "s/^nginx\.\(_sc_[^=.]*\)=server$/\1/p"); do
|
||||
uci -q delete nginx."$sec"
|
||||
done
|
||||
for sec in $(uci -q show dhcp 2>/dev/null | sed -n "s/^dhcp\.\(_sc_[^=.]*\)=domain$/\1/p"); do
|
||||
uci -q delete dhcp."$sec"
|
||||
done
|
||||
}
|
||||
|
||||
process_shortcut() {
|
||||
local shortcut to_url lanaddr cfg="$1"
|
||||
lanaddr="$(uci -q get network.lan.ipaddr | tr ' ' '\n' | head -n1)"
|
||||
lanaddr="${lanaddr%%/*}"
|
||||
[ -z "$lanaddr" ] && lanaddr="10.0.0.1"
|
||||
|
||||
config_get shortcut "$cfg" shortcut
|
||||
config_get to_url "$cfg" to_url
|
||||
[ -z "$shortcut" ] || [ -z "$to_url" ] && return 0
|
||||
|
||||
if [ -f /etc/nginx/uci.conf ]; then
|
||||
SHORTCUTS_TOUCHED=1
|
||||
uci -q set nginx._sc_$shortcut=server
|
||||
uci -q set nginx._sc_$shortcut.server_name="$shortcut"
|
||||
uci -q add_list nginx._sc_$shortcut.listen="80"
|
||||
uci -q set nginx._sc_$shortcut.return="302 $to_url"
|
||||
uci -q set dhcp._sc_$shortcut=domain
|
||||
uci -q set dhcp._sc_$shortcut.name="$shortcut"
|
||||
uci -q set dhcp._sc_$shortcut.ip="$lanaddr"
|
||||
fi
|
||||
}
|
||||
|
||||
sethttps() {
|
||||
local cfg="${1:-default}" https
|
||||
config_get https "$cfg" https 0
|
||||
# Safety: only touch redirect_https if wizard.default.https is explicitly set
|
||||
local explicit
|
||||
explicit=$(uci -q get wizard.default.https)
|
||||
if [ -z "$explicit" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -x /etc/init.d/nginx ] && [ -f /etc/nginx/uci.conf ]; then
|
||||
if [ "x${https}" = "x1" ]; then
|
||||
[ -z "$(uci -q get nginx._redirect2ssl)" ] && {
|
||||
uci -q set nginx._redirect2ssl=server
|
||||
uci -q set nginx._redirect2ssl.server_name='_redirect2ssl'
|
||||
uci -q set nginx._redirect2ssl.return='302 https://$host$request_uri'
|
||||
uci -q set nginx._redirect2ssl.access_log='off;'
|
||||
}
|
||||
uci -q del nginx.default_server.listen
|
||||
uci -q add_list nginx.default_server.listen='80'
|
||||
uci -q add_list nginx.default_server.listen='[::]:80'
|
||||
uci -q del nginx._redirect2ssl.listen
|
||||
uci -q add_list nginx._redirect2ssl.listen='80 default_server'
|
||||
uci -q add_list nginx._redirect2ssl.listen='[::]:80 default_server'
|
||||
else
|
||||
uci -q delete nginx._redirect2ssl
|
||||
uci -q del nginx.default_server.listen
|
||||
uci -q add_list nginx.default_server.listen='80 default_server'
|
||||
uci -q add_list nginx.default_server.listen='[::]:80 default_server'
|
||||
fi
|
||||
uci -q commit nginx
|
||||
/etc/init.d/nginx reload >/dev/null 2>&1
|
||||
elif [ -x /etc/init.d/lighttpd ] && [ -f /etc/lighttpd/conf.d/82-https.conf ]; then
|
||||
if [ "x${https}" = "x1" ]; then
|
||||
sed -i "s/^[ \t]*#*[ \t]*url\.redirect[ \t]*=.*/\turl.redirect =/" /etc/lighttpd/conf.d/82-https.conf 2>/dev/null
|
||||
else
|
||||
sed -i "s/^[ \t]*url\.redirect[ \t]*=.*/\t# url.redirect =/" /etc/lighttpd/conf.d/82-https.conf 2>/dev/null
|
||||
fi
|
||||
/etc/init.d/lighttpd reload >/dev/null 2>&1
|
||||
elif [ -x /etc/init.d/uhttpd ]; then
|
||||
if [ "x${https}" = "x1" ]; then
|
||||
uci -q set uhttpd.main.redirect_https='1'
|
||||
else
|
||||
uci -q set uhttpd.main.redirect_https='0'
|
||||
fi
|
||||
uci -q commit uhttpd
|
||||
/etc/init.d/uhttpd reload >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
reload_services() {
|
||||
# Only commit if we actually wrote to dhcp/nginx (shortcuts changed)
|
||||
if [ "$SHORTCUTS_TOUCHED" = "1" ]; then
|
||||
uci -q commit dhcp
|
||||
[ -x /etc/init.d/dnsmasq ] && /etc/init.d/dnsmasq reload >/dev/null 2>&1
|
||||
if [ -f /etc/nginx/uci.conf ] && [ -x /etc/init.d/nginx ]; then
|
||||
uci -q commit nginx
|
||||
/etc/init.d/nginx reload >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
SHORTCUTS_TOUCHED=0
|
||||
|
||||
start_service() {
|
||||
config_load wizard
|
||||
|
||||
# Cookie persist → luci.sgi (only if wizard.default.persistent_cookies is explicitly set)
|
||||
local explicit_pc
|
||||
explicit_pc=$(uci -q get wizard.default.persistent_cookies)
|
||||
if [ -n "$explicit_pc" ]; then
|
||||
[ -z "$(uci -q get luci.sgi)" ] && uci -q set luci.sgi=sgi
|
||||
uci -q set luci.sgi.persistent_cookies="$explicit_pc"
|
||||
uci -q commit luci
|
||||
fi
|
||||
|
||||
# Shortcuts (nginx + dnsmasq)
|
||||
clean_shortcuts
|
||||
config_foreach process_shortcut shortcuts
|
||||
|
||||
# HTTPS redirect
|
||||
sethttps default
|
||||
|
||||
reload_services
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
clean_shortcuts
|
||||
reload_services
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "wizard"
|
||||
}
|
||||
|
||||
boot() {
|
||||
start "$@"
|
||||
# Background coremark if enabled and not yet run
|
||||
local cm
|
||||
cm=$(uci -q get wizard.@wizard[0].coremark)
|
||||
[ "$cm" = "1" ] || cm=$(uci -q get wizard.default.coremark)
|
||||
if [ "$cm" = "1" ] && [ ! -f /etc/bench.log ]; then
|
||||
(sleep 5; /sbin/coremark >/dev/null 2>&1) &
|
||||
fi
|
||||
}
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Merged from luci-app-taskplan — full independence edition
|
||||
# Author: sirpdboy (original) / quickactions merge
|
||||
|
||||
START=99
|
||||
STOP=10
|
||||
TMP=/etc/quickactions-taskplan
|
||||
LOG=$TMP/taskplan.log
|
||||
TT=$TMP/taskplanrun
|
||||
CR=/etc/crontabs/root
|
||||
HANDLER=/usr/bin/quickactions-taskplanhandler
|
||||
|
||||
[ ! -d $TMP ] && mkdir -p $TMP 2>/dev/null
|
||||
[ ! -s $LOG ] && echo '' > $LOG
|
||||
|
||||
run_taskplan()
|
||||
{
|
||||
[ -n "$(uci -q get taskplan.@global[0].customscript)" ] && \
|
||||
uci -q get taskplan.@global[0].customscript > $TMP/taskplancustomscript && \
|
||||
sed -i 's/\r$//' $TMP/taskplancustomscript
|
||||
|
||||
[ -n "$(uci -q get taskplan.@global[0].customscript2)" ] && \
|
||||
uci -q get taskplan.@global[0].customscript2 > $TMP/taskplancustomscript2 && \
|
||||
sed -i 's/\r$//' $TMP/taskplancustomscript2
|
||||
|
||||
ssum=$(uci -q show taskplan | grep -c "stime\[[0-9]\]" || echo 0)
|
||||
lsum=$(uci -q show taskplan | grep -c "ltime\[[0-9]\]" || echo 0)
|
||||
|
||||
sed -i '/quickactions-taskplanhandler/d' $CR >/dev/null 2>&1
|
||||
|
||||
for i in $(seq 0 $((ssum-1)) 2>/dev/null); do
|
||||
enable=$(uci -q get taskplan.@stime[$i].enable)
|
||||
if [ "x$enable" = "x1" ]; then
|
||||
month=$(uci -q get taskplan.@stime[$i].month || echo "*")
|
||||
stype=$(uci -q get taskplan.@stime[$i].stype)
|
||||
week=$(uci -q get taskplan.@stime[$i].week || echo "*")
|
||||
minute=$(uci -q get taskplan.@stime[$i].minute || echo "0")
|
||||
hour=$(uci -q get taskplan.@stime[$i].hour || echo "*")
|
||||
|
||||
[ "$hour" = "0" ] && hour="0"
|
||||
[ "$minute" = "0" ] && minute="0"
|
||||
|
||||
case "$stype" in
|
||||
1) cmd="$minute $hour * $month $week $HANDLER reboot Scheduled_task" ;;
|
||||
2) cmd="$minute $hour * $month $week $HANDLER poweroff Scheduled_task" ;;
|
||||
3) cmd="$minute $hour * $month $week $HANDLER network Scheduled_task" ;;
|
||||
4) cmd="$minute $hour * $month $week $HANDLER restartsamba Scheduled_task" ;;
|
||||
5) cmd="$minute $hour * $month $week $HANDLER restartwan Scheduled_task" ;;
|
||||
6) cmd="$minute $hour * $month $week $HANDLER closewan Scheduled_task" ;;
|
||||
7) cmd="$minute $hour * $month $week $HANDLER clearmem Scheduled_task" ;;
|
||||
8) cmd="$minute $hour * $month $week $HANDLER sysfree Scheduled_task" ;;
|
||||
9) cmd="$minute $hour * $month $week $HANDLER disreconn Scheduled_task" ;;
|
||||
10) cmd="$minute $hour * $month $week $HANDLER disrereboot Scheduled_task" ;;
|
||||
11) cmd="$minute $hour * $month $week $HANDLER restartmwan3 Scheduled_task" ;;
|
||||
12) cmd="$minute $hour * $month $week $HANDLER customscript Scheduled_task" ;;
|
||||
13) cmd="$minute $hour * $month $week $HANDLER upwifi Scheduled_task" ;;
|
||||
14) cmd="$minute $hour * $month $week $HANDLER downwifi Scheduled_task" ;;
|
||||
15) cmd="$minute $hour * $month $week $HANDLER customscript2 Scheduled_task" ;;
|
||||
16) cmd="$minute $hour * $month $week $HANDLER restartlan Scheduled_task" ;;
|
||||
esac
|
||||
echo "$cmd" >> $CR
|
||||
fi
|
||||
done
|
||||
|
||||
echo "#!/bin/sh" > $TT
|
||||
chmod +x $TT
|
||||
|
||||
for i in $(seq 0 $((lsum-1)) 2>/dev/null); do
|
||||
enable=$(uci -q get taskplan.@ltime[$i].enable)
|
||||
if [ "x$enable" = "x1" ]; then
|
||||
stype=$(uci -q get taskplan.@ltime[$i].stype)
|
||||
delay=$(uci -q get taskplan.@ltime[$i].delay || echo 10)
|
||||
|
||||
case "$stype" in
|
||||
1) echo "(sleep $delay && $HANDLER reboot Startup_task) &" >>$TT ;;
|
||||
2) echo "(sleep $delay && $HANDLER poweroff Startup_task) &" >>$TT ;;
|
||||
3) echo "(sleep $delay && $HANDLER network Startup_task) &" >>$TT ;;
|
||||
4) echo "(sleep $delay && $HANDLER restartsamba Startup_task) &" >>$TT ;;
|
||||
5) echo "(sleep $delay && $HANDLER restartwan Startup_task) &" >>$TT ;;
|
||||
6) echo "(sleep $delay && $HANDLER closewan Startup_task) &" >>$TT ;;
|
||||
7) echo "(sleep $delay && $HANDLER clearmem Startup_task) &" >>$TT ;;
|
||||
8) echo "(sleep $delay && $HANDLER sysfree Startup_task) &" >>$TT ;;
|
||||
9) echo "(sleep $delay && $HANDLER disreconn Startup_task) &" >>$TT ;;
|
||||
10) echo "(sleep $delay && $HANDLER disrereboot Startup_task) &" >>$TT ;;
|
||||
11) echo "(sleep $delay && $HANDLER restartmwan3 Startup_task) &" >>$TT ;;
|
||||
12) echo "(sleep $delay && $HANDLER customscript Startup_task) &" >>$TT ;;
|
||||
13) echo "(sleep $delay && $HANDLER upwifi Startup_task) &" >>$TT ;;
|
||||
14) echo "(sleep $delay && $HANDLER downwifi Startup_task) &" >>$TT ;;
|
||||
15) echo "(sleep $delay && $HANDLER customscript2 Startup_task) &" >>$TT ;;
|
||||
16) echo "(sleep $delay && $HANDLER restartlan Startup_task) &" >>$TT ;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
|
||||
echo 'exit 0' >> $TT
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
del_cru
|
||||
run_taskplan
|
||||
/etc/init.d/cron reload
|
||||
echo "$(date): quickactions-taskplan started" >> $LOG
|
||||
}
|
||||
|
||||
boot()
|
||||
{
|
||||
del_cru
|
||||
run_taskplan
|
||||
/etc/init.d/cron reload
|
||||
if [ -f $TT ] && [ -s $TT ]; then
|
||||
echo "$(date +'%Y-%m-%d %H:%M:%S'): Executing taskplanrun at boot" >> $LOG
|
||||
if command -v bash >/dev/null 2>&1; then bash $TT >> $LOG 2>&1 & else sh $TT >> $LOG 2>&1 & fi
|
||||
fi
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
del_cru
|
||||
/etc/init.d/cron reload
|
||||
}
|
||||
|
||||
restart()
|
||||
{
|
||||
stop
|
||||
sleep 2
|
||||
start
|
||||
}
|
||||
|
||||
del_cru()
|
||||
{
|
||||
sed -i '/quickactions-taskplanhandler/d' $CR >/dev/null 2>&1 || true
|
||||
echo "#!/bin/sh" > $TT
|
||||
chmod +x $TT
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
# Seed failover config on first install + append our scripts to sysupgrade.conf.
|
||||
|
||||
# ---- 1. Failover config ----
|
||||
have=0
|
||||
[ -f /etc/config/quickactions ] && have=$(uci -q get quickactions.failover.primary)
|
||||
if [ -z "$have" ]; then
|
||||
uci -q set quickactions.failover=failover
|
||||
uci -q set quickactions.failover.enabled=1
|
||||
uci -q set quickactions.failover.primary=wan
|
||||
uci -q set quickactions.failover.backups="wanb wanbpppoe usbwan wandhcp"
|
||||
uci -q set quickactions.failover.check_ips="1.1.1.1 8.8.8.8"
|
||||
uci -q set quickactions.failover.check_interval=60
|
||||
uci -q set quickactions.failover.ping_timeout=5
|
||||
uci -q set quickactions.failover.fail_threshold=2
|
||||
uci -q set quickactions.failover.recover_threshold=1
|
||||
uci -q set quickactions.failover.tailscale_restart=0
|
||||
uci -q set quickactions.failover.firewall_reset=1
|
||||
uci -q set quickactions.failover.log_healthy=0
|
||||
uci -q commit quickactions
|
||||
fi
|
||||
|
||||
# ---- 2. Persist scripts through sysupgrade ----
|
||||
for f in /usr/bin/wan-watchdog.sh \
|
||||
/usr/bin/quickactions-failover \
|
||||
/etc/hotplug.d/iface/99-quickactions-conntrack-flush
|
||||
do
|
||||
grep -qxF "$f" /etc/sysupgrade.conf 2>/dev/null || echo "$f" >> /etc/sysupgrade.conf
|
||||
done
|
||||
|
||||
# ---- 3. Activate the failover subsystem ----
|
||||
/etc/init.d/quickactions-failover start >/dev/null 2>&1
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
# Seed /etc/config/guestwifi on first install only.
|
||||
# Never overwrites an existing config → survives upgrades cleanly.
|
||||
[ -f /etc/config/guestwifi ] && exit 0
|
||||
|
||||
cat > /etc/config/guestwifi << 'CONF'
|
||||
# Guest WiFi configuration managed by luci-app-quickactions
|
||||
CONF
|
||||
exit 0
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
# Seed /etc/config/hotplug if the user has no rules yet.
|
||||
# The Hotplug tab in luci-app-quickactions writes to this config.
|
||||
[ -f /etc/config/hotplug ] && exit 0
|
||||
cat > /etc/config/hotplug << 'CONF'
|
||||
# Hotplug rules managed by luci-app-quickactions
|
||||
#
|
||||
# iface sections - run commands on network interface events.
|
||||
# Example:
|
||||
# config iface 'wan_up'
|
||||
# option action 'ifup'
|
||||
# option enabled '1'
|
||||
# option interface 'wan'
|
||||
# list command '/etc/init.d/firewall restart'
|
||||
CONF
|
||||
exit 0
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
# Create seed configs only if missing. Do NOT touch network, firewall, dhcp, wireless.
|
||||
[ -f /etc/config/wizard ] || echo "config wizard 'default'" > /etc/config/wizard
|
||||
[ -f /etc/config/netwizard ] || printf "config netwizard 'default'\n\toption lan_netmask '255.255.255.0'\n" > /etc/config/netwizard
|
||||
|
||||
# Ensure scripts are executable
|
||||
chmod +x /usr/libexec/quickactions-netwizard/*.sh 2>/dev/null
|
||||
|
||||
# Enable the init so shortcuts/https/coremark hooks work
|
||||
/etc/init.d/quickactions-netwizard enable 2>/dev/null
|
||||
/etc/init.d/quickactions-netwizard start 2>/dev/null
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
mkdir -p /etc/quickactions/scripts
|
||||
chmod 755 /etc/quickactions/scripts
|
||||
exit 0
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
[ -f /etc/config/taskplan ] || cat > /etc/config/taskplan << 'EOF'
|
||||
config global 'global'
|
||||
option customscript ' '
|
||||
option customscript2 ' '
|
||||
EOF
|
||||
|
||||
mkdir -p /etc/quickactions-taskplan
|
||||
touch /etc/quickactions-taskplan/taskplan.log
|
||||
chmod 600 /etc/quickactions-taskplan/taskplan.log
|
||||
chmod +x /usr/bin/quickactions-taskplanhandler
|
||||
chmod +x /etc/init.d/quickactions-taskplan
|
||||
chmod +x /usr/libexec/rpcd/luci.quickactions-taskplan
|
||||
exit 0
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
# Seed /etc/config/taskplan with one sample stime + ltime entry
|
||||
# so the Task Plan tab is not empty on first install.
|
||||
|
||||
[ -f /etc/config/taskplan ] || touch /etc/config/taskplan
|
||||
|
||||
# Only seed if there are no stime/ltime sections yet
|
||||
if ! uci -q show taskplan | grep -q "taskplan.@stime\|taskplan.@ltime"; then
|
||||
# Ensure global exists
|
||||
uci -q get taskplan.@global[0] >/dev/null 2>&1 || \
|
||||
uci set taskplan.@global[0]=global
|
||||
|
||||
# Sample scheduled task: daily reboot at 04:00
|
||||
sec=$(uci add taskplan stime)
|
||||
uci set taskplan.$sec.remarks='Daily Reboot'
|
||||
uci set taskplan.$sec.enable='0'
|
||||
uci set taskplan.$sec.stype='1'
|
||||
uci set taskplan.$sec.month='*'
|
||||
uci set taskplan.$sec.week='*'
|
||||
uci set taskplan.$sec.hour='4'
|
||||
uci set taskplan.$sec.minute='0'
|
||||
|
||||
# Sample startup task: clear memory 30s after boot
|
||||
sec=$(uci add taskplan ltime)
|
||||
uci set taskplan.$sec.remarks='Startup: Clear Memory'
|
||||
uci set taskplan.$sec.enable='0'
|
||||
uci set taskplan.$sec.stype='7'
|
||||
uci set taskplan.$sec.delay='30'
|
||||
|
||||
uci commit taskplan
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
# Seed the VLAN working directories on first install.
|
||||
mkdir -p /etc/quickactions/vlan/templates
|
||||
mkdir -p /etc/quickactions/vlan/generated
|
||||
chmod 755 /etc/quickactions/vlan /etc/quickactions/vlan/templates /etc/quickactions/vlan/generated
|
||||
|
||||
# Default config section
|
||||
have=$(uci -q get quickactions.vlan.tier)
|
||||
if [ -z "$have" ]; then
|
||||
uci -q set quickactions.vlan=vlan
|
||||
uci -q set quickactions.vlan.tier=auto
|
||||
uci -q set quickactions.vlan.snapshot_keep=20
|
||||
uci -q commit quickactions
|
||||
fi
|
||||
exit 0
|
||||
Reference in new issue
Block a user