20 lines
612 B
Bash
20 lines
612 B
Bash
#!/bin/sh
|
||
|
||
PKG_SCRIPT="/usr/libexec/package-manager-call"
|
||
|
||
# 检查文件是否存在
|
||
if [ ! -f "$PKG_SCRIPT" ]; then
|
||
echo "错误:目标脚本 $PKG_SCRIPT 不存在!"
|
||
echo "请修改脚本里的 PKG_SCRIPT 变量为真实路径"
|
||
exit 1
|
||
fi
|
||
|
||
# 自动替换:add → add --allow-untrusted
|
||
sed -i 's/install) action="add" ;;$/install) action="add --allow-untrusted" ;;/' "$PKG_SCRIPT"
|
||
|
||
# 验证是否成功
|
||
if grep -q 'add --allow-untrusted' "$PKG_SCRIPT"; then
|
||
echo "✅ 成功!已自动在 apk add 后添加 --allow-untrusted 参数"
|
||
else
|
||
echo "❌ 失败!请检查原脚本格式"
|
||
fi |