Files
cool/apk-untrusted-toggle.sh
2026-06-07 21:38:46 +08:00

22 lines
743 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
FILE="/usr/libexec/package-manager-call"
MARKER="# === AUTO ALLOW UNTRUSTED ==="
if grep -q "$MARKER" "$FILE" 2>/dev/null; then
# 关闭:删除标记及相关代码
sed -i "/$MARKER/,+3d" "$FILE"
echo "✅ 已关闭LuCI 恢复需要签名检查。"
else
# 开启精准插入到正确位置esac 之后)
sed -i '/remove)[\t ]*action="del"[\t ]*;;/a\
\
# '"$MARKER"'\
if [ "$action" = "add" ]; then\
cmd="$cmd --allow-untrusted"\
fi' "$FILE"
echo "✅ 已开启!现在 LuCI 可直接装第三方 apk。"
fi
echo "当前状态:"
grep -A 10 "$MARKER" "$FILE" 2>/dev/null || echo "未开启"