mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-03 01:13:56 +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,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