diff --git a/apk-untrusted-toggle.sh b/apk-untrusted-toggle.sh index 592ad32..dd6439a 100644 --- a/apk-untrusted-toggle.sh +++ b/apk-untrusted-toggle.sh @@ -9,12 +9,8 @@ if [ ! -f "$PKG_SCRIPT" ]; then exit 1 fi -# 自动替换:add → add --allow-untrusted -sed -i 's/install) action="add" ;;$/install) action="add --allow-untrusted" ;;/' "$PKG_SCRIPT" +# 自动替换 +sed -i 's/^[[:space:]]*action="add"$/ action="add --allow-untrusted"/' "$PKG_SCRIPT" -# 验证是否成功 -if grep -q 'add --allow-untrusted' "$PKG_SCRIPT"; then - echo "✅ 成功!已自动在 apk add 后添加 --allow-untrusted 参数" -else - echo "❌ 失败!请检查原脚本格式" -fi \ No newline at end of file +echo "✅ 修改完成!" +grep -n "add --allow-untrusted" "$PKG_SCRIPT" \ No newline at end of file