mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-10-29 14:05:13 +08:00
update 2026-05-10 09:48:30
This commit is contained in:
1 parent
95ac96413e
commit
0b362674f1
6244 files changed
+2992248
No files matched your search
@@ -0,0 +1,95 @@
|
||||
#!/bin/bash
|
||||
|
||||
skin="Kucat"
|
||||
|
||||
is_x86_64() {
|
||||
DISTRIB_ARCH=$(cat /etc/openwrt_release | grep "DISTRIB_ARCH" | cut -d "'" -f 2)
|
||||
if [ "$DISTRIB_ARCH" = "x86_64" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
remove_check_signature() {
|
||||
local opkg_conf="/etc/opkg.conf"
|
||||
sed -i '/option check_signature/d' "$opkg_conf"
|
||||
}
|
||||
|
||||
is_iStore() {
|
||||
[ -s "/www/luci-static/istore/index.js" ] && return 0 || return 1
|
||||
}
|
||||
|
||||
is_vip() {
|
||||
local ezver
|
||||
ezver=$(grep -o "EZVER=\S*" /etc/ezopenwrt_version 2>/dev/null | cut -d'-' -f3)
|
||||
[[ "${ezver^^}" =~ VIP ]]
|
||||
}
|
||||
|
||||
istore_install(){
|
||||
if is_iStore; then
|
||||
echo "已存在有iStore应用商店,无须再安装!"
|
||||
else
|
||||
echo "正在安装iStore应用商店...."
|
||||
remove_check_signature
|
||||
opkg update
|
||||
opkg remove git-lfs
|
||||
setup_software_source 1
|
||||
ISTORE_REPO=https://istore.linkease.com/repo/all/store
|
||||
FCURL="curl --fail --show-error"
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
sed -i 's/istore.linkease.com/istore.istoreos.com/g' /bin/is-opkg
|
||||
|
||||
sed -i 's/istore.linkease.com/istore.istoreos.com/g' /etc/opkg/compatfeeds.conf
|
||||
sed -i 's/istore.linkease.com/istore.istoreos.com/g' /www/luci-static/istore/index.js
|
||||
|
||||
uci -q set luci.main.mediaurlbase='/luci-static/kucat'
|
||||
uci commit
|
||||
rm -rf /tmp/is-opkg /tmp/luci*
|
||||
echo "iStore应用商店安装完成!"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
drv_install(){
|
||||
if is_vip; then
|
||||
bash /etc/kmodreg drv
|
||||
else
|
||||
echo "目前此功能仅限VIP版本提供!"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
docker_install(){
|
||||
if is_vip; then
|
||||
bash /etc/kmodreg docker
|
||||
else
|
||||
echo "目前此功能仅限VIP版本提供!"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
"istore")
|
||||
istore_install
|
||||
;;
|
||||
"drv")
|
||||
drv_install
|
||||
;;
|
||||
"docker")
|
||||
docker_install
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,109 @@
|
||||
#!/bin/sh
|
||||
# uhttpd 进程监控守护进程 2025-2026 by sirpdboy
|
||||
|
||||
PROG="uhttpd-watchdog"
|
||||
UHTTPD_BIN="/usr/sbin/uhttpd"
|
||||
UHTTPD_SERVICE="uhttpd"
|
||||
CHECK_INTERVAL=30 # 检查间隔(秒)
|
||||
MAX_FAILURES=3 # 最大连续失败次数
|
||||
LOG_IDENT="$PROG"
|
||||
|
||||
log() {
|
||||
logger -t "$LOG_IDENT" "$1"
|
||||
}
|
||||
|
||||
check_binary() {
|
||||
if [ ! -x "$UHTTPD_BIN" ]; then
|
||||
log "错误:$UHTTPD_BIN 不存在或不可执行,监控停止"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
check_process() {
|
||||
if pgrep -f "/usr/sbin/uhttpd" >/dev/null 2>&1 || \
|
||||
pgrep -x uhttpd >/dev/null 2>&1; then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
restart_service() {
|
||||
log "尝试重启 $UHTTPD_SERVICE 服务..."
|
||||
if /etc/init.d/$UHTTPD_SERVICE restart >/dev/null 2>&1; then
|
||||
sleep 3 # 等待服务启动
|
||||
if check_process; then
|
||||
log "$UHTTPD_SERVICE 重启成功"
|
||||
return 0
|
||||
else
|
||||
log "$UHTTPD_SERVICE 重启后进程仍不存在"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
log "执行 service $UHTTPD_SERVICE restart 失败"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
monitor_loop() {
|
||||
local failures=0
|
||||
|
||||
log "启动 $UHTTPD_SERVICE 监控守护进程"
|
||||
|
||||
while true; do
|
||||
# 检查二进制文件
|
||||
if ! check_binary; then
|
||||
sleep 60
|
||||
continue
|
||||
fi
|
||||
|
||||
# 检查进程状态
|
||||
if ! check_process; then
|
||||
failures=$((failures + 1))
|
||||
log "检测到 $UHTTPD_SERVICE 进程停止 (失败次数: $failures/$MAX_FAILURES)"
|
||||
|
||||
if [ $failures -ge $MAX_FAILURES ]; then
|
||||
log "达到最大失败次数,尝试重启服务..."
|
||||
if restart_service; then
|
||||
failures=0
|
||||
else
|
||||
sleep 60
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# 进程正常,重置失败计数器
|
||||
if [ $failures -gt 0 ]; then
|
||||
log "$UHTTPD_SERVICE 恢复正常运行"
|
||||
failures=0
|
||||
fi
|
||||
fi
|
||||
|
||||
sleep $CHECK_INTERVAL
|
||||
done
|
||||
}
|
||||
|
||||
start() {
|
||||
if pgrep -f "$PROG" | grep -v $$ >/dev/null 2>&1; then
|
||||
log "警告:$PROG 已经在运行"
|
||||
exit 1
|
||||
fi
|
||||
monitor_loop
|
||||
}
|
||||
|
||||
stop() {
|
||||
pkill -f "$PROG" 2>/dev/null
|
||||
log "监控服务已停止"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
*)
|
||||
echo "用法: $0 {start|stop}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Reference in new issue
Block a user