mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 04:55:13 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
97c049ed0a
commit
0acff03804
14253 files changed
+3893239
No files matched your search
+51
@@ -0,0 +1,51 @@
|
||||
#!/bin/sh
|
||||
# Author Xiaobao(xiaobao@linkease.com)
|
||||
|
||||
ACTION=${1}
|
||||
shift 1
|
||||
|
||||
usage() {
|
||||
echo "usage: $0 sub-command"
|
||||
echo "where sub-command is one of:"
|
||||
echo " select_none Select action"
|
||||
echo " ipv6_pd Enable IPv6 (PD mode)"
|
||||
echo " ipv6_relay Enable IPv6 (Relay mode)"
|
||||
echo " ipv6_nat Enable IPv6 (NAT mode)"
|
||||
echo " ipv6_half Half IPv6 (Only Router)"
|
||||
echo " ipv6_off Disable IPv6"
|
||||
echo " disable-planb Diable planb"
|
||||
echo " reset_rom_pkgs Reset pkgs from rom"
|
||||
echo " qb_reset_password Reset qBitorent password"
|
||||
echo " disk_power_mode Show disk power status"
|
||||
echo " speedtest Start a speedtest"
|
||||
}
|
||||
|
||||
case "${ACTION}" in
|
||||
"speedtest")
|
||||
/usr/share/systools/speedtest.run ${1}
|
||||
;;
|
||||
"ipv6_pd")
|
||||
/usr/share/systools/ipv6.run pd
|
||||
;;
|
||||
"ipv6_relay")
|
||||
/usr/share/systools/ipv6.run relay
|
||||
;;
|
||||
"ipv6_nat")
|
||||
/usr/share/systools/ipv6.run nat
|
||||
;;
|
||||
"ipv6_half")
|
||||
/usr/share/systools/ipv6.run half
|
||||
;;
|
||||
"ipv6_off")
|
||||
/usr/share/systools/ipv6.run off
|
||||
;;
|
||||
*)
|
||||
if [ -n "${ACTION}" -a -s /usr/share/systools/${ACTION}.run ]; then
|
||||
bash "/usr/share/systools/${ACTION}.run"
|
||||
else
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "x$(uci -q get quickstart.main.disable_dhns)" = x1 ]; then
|
||||
echo "Already disabled!"
|
||||
else
|
||||
echo "Disabling..."
|
||||
uci set quickstart.main.disable_dhns=1
|
||||
uci commit quickstart
|
||||
/etc/init.d/quickstart restart
|
||||
echo "Done"
|
||||
fi
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
/etc/init.d/wan_drop disable
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
#function-1:显示硬盘盘符+Lable+容量以及硬盘上电状态
|
||||
#function-2:通过echo -e转义与if...elif...else语句使其active呈现红色,standby呈现绿色,方便快速检视硬盘上电情况
|
||||
#function-3:原for循环语句中加入判断和循环计数方式,统计active和standby的数量
|
||||
#function-4:增加 if 嵌套语句判断除开 active 和 standby 之外状态的硬盘,并将其标记为 unknown
|
||||
#function-5:将unknown状态的硬盘列举出来(对for语句上瘾了……
|
||||
|
||||
dsk=`ls /dev/sd* | grep -Eo 'sd(a{2}|[a-z]+)$'`
|
||||
echo `date +%c`
|
||||
standby=0
|
||||
active=0
|
||||
unknown=0
|
||||
c=0
|
||||
|
||||
if readlink /proc/$$/fd/1 2>/dev/null | grep -qF /dev/ ; then
|
||||
highlight(){
|
||||
echo -e "$1 $2 \033[0m"
|
||||
}
|
||||
else
|
||||
highlight(){
|
||||
echo -e "$2"
|
||||
}
|
||||
fi
|
||||
|
||||
for i in $dsk;
|
||||
do
|
||||
echo -e "\n";
|
||||
echo -e "-----------------------";
|
||||
echo -n "/dev/$i : " ;
|
||||
stats=`smartctl -i -n standby /dev/$i|grep "mode"|awk '{print $4}' `;
|
||||
#echo $stats
|
||||
if [[ $stats == STANDBY ]]||[[ $stats == ACTIVE ]]||[[ $stats == IDLE_A ]]
|
||||
then
|
||||
for s in $stats;
|
||||
do
|
||||
if [ $s == STANDBY ]
|
||||
then
|
||||
highlight "\033[30;42m" " STANDBY "
|
||||
let standby=$standby+1
|
||||
else
|
||||
highlight "\033[37;41m" " ACTIVE "
|
||||
let active=$active+1
|
||||
fi
|
||||
done
|
||||
else
|
||||
highlight "\033[30;47m" " UNKNOWN "
|
||||
let unknown=$unknown+1
|
||||
for un in $i
|
||||
do
|
||||
list[c]=$un
|
||||
((c++))
|
||||
done
|
||||
fi
|
||||
echo `lsblk /dev/$i|grep "/srv/dev-disk-by-label-"|awk '{print $7}' `;
|
||||
echo `lsblk /dev/$i|grep "/srv/dev-disk-by-label-"|awk '{print $4}' `;
|
||||
done
|
||||
|
||||
echo -e "\n";
|
||||
highlight "\033[37;41m" "Active Disk in Total=$active ";
|
||||
highlight "\033[30;42m" "Standby Disk in Total=$standby ";
|
||||
highlight "\033[30;47m" "Unknown Disk in Total=$unknown ";
|
||||
#echo $c
|
||||
echo -e "Unknown Disk list: ";
|
||||
for((b=0;b<=$c;b++));
|
||||
do
|
||||
if [[ $b -lt $c ]]
|
||||
then
|
||||
echo ${list[b]}
|
||||
fi
|
||||
done
|
||||
echo -e "\n";
|
||||
exit
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
# NAT6 + masquerading firewall script
|
||||
# https://github.com/akatrevorjay/openwrt-masq6
|
||||
# trevorj <github@trevor.joynson.io>
|
||||
#
|
||||
# You can configure in /etc/config/firewall per zone:
|
||||
# * IPv4 masquerading
|
||||
# option masq 1
|
||||
# * IPv6 masquerading
|
||||
# option masq6 1
|
||||
# * IPv6 privacy extensions
|
||||
# option masq6_privacy 1
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/network.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
log() {
|
||||
logger -t nat6 -s "${@}"
|
||||
}
|
||||
|
||||
get_ula_prefix() {
|
||||
uci get network.globals.ula_prefix
|
||||
}
|
||||
|
||||
validate_ula_prefix() {
|
||||
local ula_prefix="${1}"
|
||||
if [ $(echo "${ula_prefix}" | grep -c -E -e "^([0-9a-fA-F]{4}):([0-9a-fA-F]{0,4}):") -ne 1 ] ; then
|
||||
log "Fatal error: IPv6 ULA ula_prefix=\"${ula_prefix}\" seems invalid. Please verify that a ula_prefix is set and valid."
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
ip6t() {
|
||||
ip6tables "${@}"
|
||||
}
|
||||
|
||||
ip6t_add() {
|
||||
if ! ip6t -C "${@}" &> /dev/null; then
|
||||
ip6t -I "${@}"
|
||||
fi
|
||||
}
|
||||
|
||||
nat6_init() {
|
||||
iptables-save -t nat \
|
||||
| sed -e "
|
||||
/\sMASQUERADE$/d
|
||||
/\s[DS]NAT\s/d
|
||||
/\s--match-set\s\S*/s//\06/
|
||||
/,BROADCAST\s/s// /" \
|
||||
| grep -v FULLCONENAT \
|
||||
| ip6tables-restore -T nat
|
||||
}
|
||||
|
||||
masq6_network() {
|
||||
# ${config} contains the ID of the current section
|
||||
local network_name="${1}"
|
||||
|
||||
local device
|
||||
network_get_device device "${network_name}" || return 0
|
||||
|
||||
local done_net_dev
|
||||
for done_net_dev in ${DONE_NETWORK_DEVICES}; do
|
||||
if [ "${done_net_dev}" = "${device}" ]; then
|
||||
log "Already configured device=\"${device}\", so leaving as is."
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
log "Found device=\"${device}\" for network_name=\"${network_name}\"."
|
||||
|
||||
if [ "${zone_masq6_privacy}" -eq 1 ]; then
|
||||
log "Enabling IPv6 temporary addresses for device=\"${device}\"."
|
||||
|
||||
log "Accepting router advertisements on ${device} even if forwarding is enabled (required for temporary addresses)"
|
||||
echo 2 > "/proc/sys/net/ipv6/conf/${device}/accept_ra" \
|
||||
|| log "Error: Failed to change router advertisements accept policy on ${device} (required for temporary addresses)"
|
||||
|
||||
log "Using temporary addresses for outgoing connections on interface ${device}"
|
||||
echo 2 > "/proc/sys/net/ipv6/conf/${device}/use_tempaddr" \
|
||||
|| log "Error: Failed to enable temporary addresses for outgoing connections on interface ${device}"
|
||||
fi
|
||||
|
||||
append DONE_NETWORK_DEVICES "${device}"
|
||||
}
|
||||
|
||||
handle_zone() {
|
||||
# ${config} contains the ID of the current section
|
||||
local config="${1}"
|
||||
|
||||
local zone_name
|
||||
config_get zone_name "${config}" name
|
||||
|
||||
# Enable masquerading via NAT6
|
||||
local zone_masq6
|
||||
config_get_bool zone_masq6 "${config}" masq6 0
|
||||
|
||||
log "Firewall config=\"${config}\" zone=\"${zone_name}\" zone_masq6=\"${zone_masq6}\"."
|
||||
|
||||
if [ "${zone_masq6}" -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# IPv6 privacy extensions: Use temporary addrs for outgoing connections?
|
||||
local zone_masq6_privacy
|
||||
config_get_bool zone_masq6_privacy "${config}" masq6_privacy 1
|
||||
|
||||
log "Found firewall zone_name=\"${zone_name}\" with zone_masq6=\"${zone_masq6}\" zone_masq6_privacy=\"${zone_masq6_privacy}\"."
|
||||
|
||||
log "Setting up masquerading nat6 for zone_name=\"${zone_name}\" with zone_masq6_privacy=\"${zone_masq6_privacy}\""
|
||||
|
||||
local ula_prefix="$(get_ula_prefix)"
|
||||
validate_ula_prefix "${ula_prefix}" || return 1
|
||||
|
||||
local postrouting_chain="zone_${zone_name}_postrouting"
|
||||
log "Ensuring ip6tables chain=\"${postrouting_chain}\" contains our MASQUERADE."
|
||||
ip6t_add "${postrouting_chain}" -t nat \
|
||||
-m comment --comment "!fw3" -j MASQUERADE
|
||||
|
||||
local input_chain="zone_${zone_name}_input"
|
||||
log "Ensuring ip6tables chain=\"${input_chain}\" contains our permissive DNAT rule."
|
||||
ip6t_add "${input_chain}" -t filter -m conntrack --ctstate DNAT \
|
||||
-m comment --comment "!fw3: Accept port forwards" -j ACCEPT
|
||||
|
||||
local forward_chain="zone_${zone_name}_forward"
|
||||
log "Ensuring ip6tables chain=\"${forward_chain}\" contains our permissive DNAT rule."
|
||||
ip6t_add "${forward_chain}" -t filter -m conntrack --ctstate DNAT \
|
||||
-m comment --comment "!fw3: Accept port forwards" -j ACCEPT
|
||||
|
||||
local DONE_NETWORK_DEVICES=""
|
||||
config_list_foreach "${config}" network masq6_network
|
||||
|
||||
log "Done setting up nat6 for zone=\"${zone_name}\" on devices: ${DONE_NETWORK_DEVICES}"
|
||||
}
|
||||
|
||||
main() {
|
||||
nat6_init
|
||||
config_load firewall
|
||||
config_foreach handle_zone zone
|
||||
}
|
||||
|
||||
main "${@}"
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete firewall.wxedge
|
||||
set firewall.wxedge=rule
|
||||
set firewall.wxedge.name="wxedge"
|
||||
set firewall.wxedge.target="ACCEPT"
|
||||
set firewall.wxedge.src="wan"
|
||||
set firewall.wxedge.dest_port="40000-65535"
|
||||
set firewall.wxedge.enabled="1"
|
||||
commit firewall
|
||||
EOF
|
||||
|
||||
/etc/init.d/firewall reload
|
||||
|
||||
echo "done"
|
||||
+243
@@ -0,0 +1,243 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2025 iStoreOS, jjm2473@gmail.com
|
||||
|
||||
LEVEL_PD=pd
|
||||
LEVEL_RELAY=relay
|
||||
LEVEL_NAT=nat
|
||||
LEVEL_HALF=half
|
||||
LEVEL_OFF=off
|
||||
|
||||
MODE_SERVER=server
|
||||
MODE_RELAY=relay
|
||||
MODE_CLIENT=client
|
||||
MODE_DISABLE=disable
|
||||
|
||||
FROM_PD=pd
|
||||
FROM_ULA=ula
|
||||
FROM_NONE=none
|
||||
|
||||
ODHCPD_NDP_BUG=false
|
||||
|
||||
ipv6_enable_nat() {
|
||||
uci -q set network.wan6.sourcefilter=0
|
||||
uci -q delete firewall.nat6
|
||||
uci -q set firewall.nat6="include"
|
||||
uci -q set firewall.nat6.path="/usr/share/systools/firewall.nat6"
|
||||
uci -q set firewall.nat6.reload="1"
|
||||
uci -q set firewall.nat6.fw4_compatible="0"
|
||||
uci -q set firewall.@zone[1].masq6="1"
|
||||
uci -q set firewall.@zone[1].masq6_privacy="0"
|
||||
uci commit firewall
|
||||
/etc/init.d/firewall reload
|
||||
}
|
||||
|
||||
ipv6_disable_nat() {
|
||||
NAT6=`uci -q get firewall.nat6.reload`
|
||||
if [ "$NAT6" = "1" ]; then
|
||||
uci -q delete network.wan6.sourcefilter
|
||||
uci -q delete firewall.@zone[1].masq6
|
||||
uci -q delete firewall.nat6
|
||||
uci commit firewall
|
||||
/etc/init.d/firewall reload
|
||||
fi
|
||||
}
|
||||
|
||||
ipv6_set_lan_addr() {
|
||||
local addr=$1
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
del network.lan.delegate
|
||||
del network.lan.ip6class
|
||||
EOF
|
||||
case "$addr" in
|
||||
$FROM_PD)
|
||||
uci -q set network.lan.ip6assign='60'
|
||||
if $ODHCPD_NDP_BUG; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
add_list network.lan.ip6class='wan6'
|
||||
add_list network.lan.ip6class='wan_6'
|
||||
add_list network.lan.ip6class='wan'
|
||||
EOF
|
||||
fi
|
||||
;;
|
||||
$FROM_ULA)
|
||||
uci -q set network.lan.ip6assign='60'
|
||||
if $ODHCPD_NDP_BUG; then
|
||||
uci -q add_list network.lan.ip6class='local'
|
||||
fi
|
||||
;;
|
||||
$FROM_NONE)
|
||||
uci -q del network.lan.ip6assign
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
ipv6_set_lan_mode() {
|
||||
local mode=$1
|
||||
if [ "$MODE_CLIENT" = "$mode" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set network.lan6='interface'
|
||||
del network.lan6.auto
|
||||
set network.lan6.proto='dhcpv6'
|
||||
set network.lan6.device='@lan'
|
||||
EOF
|
||||
else
|
||||
uci -q set network.lan6.auto='0'
|
||||
fi
|
||||
|
||||
case "$mode" in
|
||||
$MODE_SERVER)
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set dhcp.lan.dhcpv6='server'
|
||||
set dhcp.lan.ra='server'
|
||||
del dhcp.lan.ra_slaac
|
||||
del dhcp.lan.ra_flags
|
||||
add_list dhcp.lan.ra_flags='managed-config'
|
||||
add_list dhcp.lan.ra_flags='other-config'
|
||||
del dhcp.lan.ndp
|
||||
EOF
|
||||
;;
|
||||
$MODE_RELAY)
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set dhcp.lan.ra='relay'
|
||||
del dhcp.lan.ra_slaac
|
||||
del dhcp.lan.ra_flags
|
||||
set dhcp.lan.dhcpv6='relay'
|
||||
set dhcp.lan.ndp='relay'
|
||||
EOF
|
||||
;;
|
||||
*)
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
del dhcp.lan.ra
|
||||
del dhcp.lan.ra_slaac
|
||||
del dhcp.lan.ra_flags
|
||||
del dhcp.lan.dhcpv6
|
||||
del dhcp.lan.ndp
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
ipv6_set_wan_relay() {
|
||||
local relay_src=$1
|
||||
local iface
|
||||
for iface in wan wan6; do
|
||||
if [ $iface = "$relay_src" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set dhcp.$iface=dhcp
|
||||
set dhcp.$iface.interface='$iface'
|
||||
set dhcp.$iface.ignore='1'
|
||||
set dhcp.$iface.master='1'
|
||||
set dhcp.$iface.ra='relay'
|
||||
set dhcp.$iface.dhcpv6='relay'
|
||||
set dhcp.$iface.ndp='relay'
|
||||
EOF
|
||||
else
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
del dhcp.$iface.master
|
||||
del dhcp.$iface.ra
|
||||
del dhcp.$iface.dhcpv6
|
||||
del dhcp.$iface.ndp
|
||||
EOF
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
is_lan_gateway() {
|
||||
[ "$(uci -q get network.lan.defaultroute)" = "0" ] && return 1
|
||||
[ "$(uci -q get network.lan.proto)" = "dhcp" ] && return 0
|
||||
[ "$(uci -q get network.lan.proto)" = "static" ] || return 1
|
||||
[ -n "$(uci -q get network.lan.gateway)" ]
|
||||
}
|
||||
|
||||
is_wan_pppoe() {
|
||||
[ "$(uci -q get network.wan.proto)" = "pppoe" ]
|
||||
}
|
||||
|
||||
level=$1
|
||||
[ -n "$level" ] || level=$LEVEL_PD
|
||||
|
||||
echo "Try Level $level"
|
||||
|
||||
odhcpd_version=$(grep -o 'Version: [0-9]*' /usr/lib/opkg/info/odhcpd-ipv6only.control | cut -d' ' -f2)
|
||||
if [ -n "$odhcpd_version" -a "$odhcpd_version" -lt 2025 ]; then
|
||||
echo "odhcpd version $odhcpd_version detected, enabling NDP bug workaround"
|
||||
ODHCPD_NDP_BUG=true
|
||||
fi
|
||||
|
||||
# nat
|
||||
if [ "$level" = $LEVEL_NAT ]; then
|
||||
if opkg status kmod-ipt-nat6 | grep '^Status: ' | grep -Fwq installed ; then
|
||||
echo "kmod-ipt-nat6 found"
|
||||
else
|
||||
echo "kmod-ipt-nat6 not found, installing"
|
||||
opkg update
|
||||
opkg install kmod-ipt-nat6 || exit 1
|
||||
fi
|
||||
ipv6_enable_nat
|
||||
else
|
||||
# disable ipv6 nat
|
||||
ipv6_disable_nat
|
||||
fi
|
||||
|
||||
# dns
|
||||
if [ "$level" = $LEVEL_OFF ]; then
|
||||
uci -q set 'dhcp.@dnsmasq[0].filter_aaaa=1'
|
||||
else
|
||||
uci -q del 'dhcp.@dnsmasq[0].filter_aaaa'
|
||||
fi
|
||||
|
||||
# address service
|
||||
if [ "$level" = $LEVEL_OFF ]; then
|
||||
ipv6_set_lan_mode $MODE_DISABLE
|
||||
ipv6_set_lan_addr $FROM_NONE
|
||||
ipv6_set_wan_relay none
|
||||
uci -q set network.wan.ipv6=0
|
||||
uci -q set network.wan6.auto=0
|
||||
else
|
||||
if is_lan_gateway; then
|
||||
echo "Single-Port Router (LAN Gateway) mode"
|
||||
ipv6_set_lan_mode $MODE_CLIENT
|
||||
ipv6_set_lan_addr $FROM_NONE
|
||||
else
|
||||
if is_wan_pppoe; then
|
||||
echo "PPPoE mode"
|
||||
uci -q del network.wan.ipv6
|
||||
ipv6_set_wan_relay wan
|
||||
else
|
||||
echo "DHCP-Client mode"
|
||||
uci -q del network.wan6.auto
|
||||
ipv6_set_wan_relay wan6
|
||||
fi
|
||||
if [ "$level" = $LEVEL_PD -o "$level" = $LEVEL_NAT ]; then
|
||||
ipv6_set_lan_mode $MODE_SERVER
|
||||
elif [ "$level" = $LEVEL_RELAY ]; then
|
||||
ipv6_set_lan_mode $MODE_RELAY
|
||||
else
|
||||
ipv6_set_lan_mode $MODE_DISABLE
|
||||
fi
|
||||
if [ "$level" = $LEVEL_PD ]; then
|
||||
ipv6_set_lan_addr $FROM_PD
|
||||
elif [ "$level" = $LEVEL_NAT ]; then
|
||||
# uci set network.globals.ula_prefix="$(uci get network.globals.ula_prefix | sed 's/^./d/')"
|
||||
ipv6_set_lan_addr $FROM_ULA
|
||||
else
|
||||
ipv6_set_lan_addr $FROM_NONE
|
||||
fi
|
||||
if [ "$level" = $LEVEL_NAT ]; then
|
||||
uci set dhcp.lan.ra_default='2'
|
||||
else
|
||||
uci -q del dhcp.lan.ra_default
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
commit dhcp
|
||||
commit network
|
||||
EOF
|
||||
|
||||
/etc/init.d/odhcpd reload
|
||||
/etc/init.d/dnsmasq reload
|
||||
/etc/init.d/network reload
|
||||
|
||||
echo "Done"
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
ISTORE_REPO=https://istore.istoreos.com/repo/all/store
|
||||
FCURL="curl --fail --show-error"
|
||||
|
||||
curl -V >/dev/null 2>&1 || {
|
||||
echo "prereq: install curl"
|
||||
opkg info curl | grep -Fqm1 curl || opkg update
|
||||
opkg install curl
|
||||
}
|
||||
|
||||
IPK=`$FCURL "$ISTORE_REPO/Packages.gz" | zcat | grep -m1 '^Filename: luci-app-store.*\.ipk$' | sed -n -e 's/^Filename: \(.\+\)$/\1/p'`
|
||||
|
||||
[ -n "$IPK" ] || exit 1
|
||||
|
||||
$FCURL "$ISTORE_REPO/$IPK" | tar -xzO ./data.tar.gz | tar -xzO ./bin/is-opkg > /tmp/is-opkg
|
||||
|
||||
[ -s "/tmp/is-opkg" ] || exit 1
|
||||
|
||||
chmod 755 /tmp/is-opkg
|
||||
/tmp/is-opkg update
|
||||
# /tmp/is-opkg install taskd
|
||||
/tmp/is-opkg opkg install --force-reinstall luci-lib-taskd luci-lib-xterm
|
||||
/tmp/is-opkg opkg install --force-reinstall luci-app-store || exit $?
|
||||
[ -s "/etc/init.d/tasks" ] || /tmp/is-opkg opkg install --force-reinstall taskd
|
||||
[ -s "/usr/lib/lua/luci/cbi.lua" ] || /tmp/is-opkg opkg install luci-compat >/dev/null 2>&1
|
||||
@@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
# @jjm2473
|
||||
|
||||
hosts() {
|
||||
cat <<-EOF
|
||||
api.themoviedb.org 13.35.67.86
|
||||
image.tmdb.org 104.16.61.155
|
||||
www.themoviedb.org 54.192.151.79
|
||||
EOF
|
||||
}
|
||||
|
||||
filter() {
|
||||
local EXISTED=`uci show dhcp | grep -E '^dhcp\.@domain\[\d+\]\.name=' | sed 's/.*=//g'"; s/'//g" | sort -u`
|
||||
if [ "x$EXISTED" = "x" ]; then
|
||||
cat
|
||||
else
|
||||
grep -vFwe "$EXISTED"
|
||||
fi
|
||||
}
|
||||
add_host() {
|
||||
[ "x$1" = "x" -o "x$2" = "x" ] && return
|
||||
echo "set $1 = $2"
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
add dhcp domain
|
||||
set dhcp.@domain[-1].name=$1
|
||||
set dhcp.@domain[-1].ip=$2
|
||||
EOF
|
||||
}
|
||||
add_hosts() {
|
||||
local line
|
||||
while read; do
|
||||
line="$REPLY"
|
||||
add_host $line
|
||||
done
|
||||
if [ -n "`uci changes dhcp`" ]; then
|
||||
echo "commit changes and reload dnsmasq"
|
||||
uci commit dhcp
|
||||
/etc/init.d/dnsmasq reload
|
||||
else
|
||||
echo "there is nothing to do"
|
||||
fi
|
||||
}
|
||||
|
||||
hosts | filter | add_hosts
|
||||
|
||||
echo "done"
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
date
|
||||
|
||||
nslookup baidu.com
|
||||
|
||||
ping -c 4 baidu.com
|
||||
|
||||
curl -o /dev/null https://www.baidu.com/
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
openssl speed -evp aes-256-gcm
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
openssl speed -evp chacha20-poly1305
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
profile=`uci get qbittorrent.main.profile`
|
||||
if [ -n "$profile" ]; then
|
||||
echo "qb profile: $profile"
|
||||
echo "stop qb"
|
||||
/etc/init.d/qbittorrent stop
|
||||
sleep 2
|
||||
echo "delete password"
|
||||
sed -i '/^WebUI\\Password_/d' "$profile/qBittorrent/config/qBittorrent.conf"
|
||||
echo "start qb"
|
||||
/etc/init.d/qbittorrent start
|
||||
else
|
||||
echo "profile not defined!"
|
||||
fi
|
||||
|
||||
echo "done"
|
||||
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2025 jjm2473@gmail.com
|
||||
|
||||
(
|
||||
cd /usr/lib/opkg/info
|
||||
grep -lm1 '^Version: 0.0.0-r1$' kmod-*.control 2>/dev/null | sed 's/.control$//'
|
||||
) > /tmp/incompat_kmods.txt
|
||||
|
||||
if [ -s /tmp/incompat_kmods.txt ]; then
|
||||
echo "The following incompatible kernel modules were found:"
|
||||
cat /tmp/incompat_kmods.txt
|
||||
echo "=====END====="
|
||||
echo "Try installing from opkg"
|
||||
opkg update
|
||||
opkg install $(cat /tmp/incompat_kmods.txt)
|
||||
rm -f /tmp/incompat_kmods.txt
|
||||
echo "If you encounter network problems, please try again"
|
||||
echo "If it says some packages are unknown, it may be because they have been removed. Just ignore it."
|
||||
else
|
||||
echo "No incompatible kernel modules found"
|
||||
fi
|
||||
|
||||
echo "Done"
|
||||
@@ -0,0 +1,64 @@
|
||||
#!/bin/sh
|
||||
|
||||
nonconf_files_of_pkg() {
|
||||
local pkgname="$1"
|
||||
if [ -s /rom/usr/lib/opkg/info/${pkgname}.conffiles ]; then
|
||||
grep -hvxFf /rom/usr/lib/opkg/info/${pkgname}.conffiles \
|
||||
/rom/usr/lib/opkg/info/${pkgname}.list
|
||||
else
|
||||
cat /rom/usr/lib/opkg/info/${pkgname}.list
|
||||
fi
|
||||
}
|
||||
|
||||
reset_pkg() {
|
||||
local pkgname="$1"
|
||||
local line
|
||||
local dep
|
||||
local deps
|
||||
echo "${pkgname}" | grep -q '^kernel$
|
||||
^libc$
|
||||
^libgcc1$
|
||||
^libatomic1$
|
||||
^busybox$' && return
|
||||
if [ -f /rom/usr/lib/opkg/info/${pkgname}.control -a \
|
||||
\( -e /overlay/upper/usr/lib/opkg/info/${pkgname}.control -o \
|
||||
-e /ext_overlay/upper/usr/lib/opkg/info/${pkgname}.control \) ]; then
|
||||
echo "reset ${pkgname}"
|
||||
if [ -f /rom/usr/lib/opkg/info/${pkgname}.list ]; then
|
||||
nonconf_files_of_pkg "${pkgname}" | while read; do
|
||||
line="$REPLY"
|
||||
rm -f "/overlay/upper/${line}" "/ext_overlay/upper/${line}"
|
||||
done
|
||||
rm -f /overlay/upper/usr/lib/opkg/info/${pkgname}.list /ext_overlay/upper/usr/lib/opkg/info/${pkgname}.list
|
||||
fi
|
||||
deps=`grep '^Depends: ' /rom/usr/lib/opkg/info/${pkgname}.control | sed -e 's/^Depends: //' -e 's/ ([^)]*)//g' -e 's/,/ /g'`
|
||||
# avoid loop deps
|
||||
rm -f /overlay/upper/usr/lib/opkg/info/${pkgname}.control /ext_overlay/upper/usr/lib/opkg/info/${pkgname}.control
|
||||
for dep in $deps ; do
|
||||
reset_pkg "$dep"
|
||||
done
|
||||
rm -f /overlay/upper/usr/lib/opkg/info/${pkgname}.* /ext_overlay/upper/usr/lib/opkg/info/${pkgname}.*
|
||||
fi
|
||||
}
|
||||
|
||||
ls_all_rom_pkgs() {
|
||||
( cd /rom/usr/lib/opkg/info ; find . -maxdepth 1 -name '*.control' | sed -E 's#./(.*).control#\1#g' )
|
||||
}
|
||||
|
||||
reset_all_rom() {
|
||||
local line
|
||||
ls_all_rom_pkgs | while read; do
|
||||
line="$REPLY"
|
||||
reset_pkg "$line"
|
||||
done
|
||||
}
|
||||
|
||||
reset_all_rom
|
||||
|
||||
touch /overlay/upper/usr/lib/opkg/.upgrading
|
||||
|
||||
echo "done, please reboot, it will reboot in 10s"
|
||||
|
||||
sleep 10
|
||||
reboot
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Please select action to run!"
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
export PATH=/usr/bin:/sbin:/bin/usr/bin:/sbin:/bin
|
||||
export HOME=/root
|
||||
export GATEWAY_INTERFACE=
|
||||
export REMOTE_HOST=
|
||||
export REMOTE_ADDR=
|
||||
export SHLVL=
|
||||
export QUERY_STRING=
|
||||
export HTTP_USER_AGENT=
|
||||
export DOCUMENT_ROOT=
|
||||
export REMOTE_PORT=
|
||||
export HTTP_ACCEPT=
|
||||
export SCRIPT_FILENAME=
|
||||
export HTTP_HOST=
|
||||
export REQUEST_URI=
|
||||
export SERVER_SOFTWARE=
|
||||
export HTTP_CONNECTION=
|
||||
export HTTP_COOKIE=
|
||||
export HTTP_ACCEPT_LANGUAGE=
|
||||
export SERVER_PROTOCOL=
|
||||
export HTTP_ACCEPT_ENCODING=
|
||||
export PATH_INFO=
|
||||
export REDIRECT_STATUS=
|
||||
export REQUEST_METHOD=
|
||||
export SERVER_ADDR=
|
||||
export PWD=
|
||||
export SERVER_PORT=
|
||||
export SCRIPT_NAME=
|
||||
export SERVER_NAME=
|
||||
export TERM=screen-256color
|
||||
|
||||
/usr/bin/speedtest --format=json --accept-license --accept-gdpr --servers 2>/dev/null
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd /root
|
||||
export HOME=/root
|
||||
SERVER=${1}
|
||||
|
||||
echo "run speedtest"
|
||||
if [ "$SERVER" == "auto" ]; then
|
||||
echo "/usr/bin/speedtest"
|
||||
echo "yes"|/usr/bin/speedtest
|
||||
else
|
||||
echo "/usr/bin/speedtest -s $SERVER"
|
||||
echo "yes"|/usr/bin/speedtest -s $SERVER
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user