Update use_repo

This commit is contained in:
喵二
2024-07-01 16:31:32 +08:00
committed by GitHub
parent 5a483279f4
commit 9de63f3932

View File

@@ -376,12 +376,14 @@ main() {
main main
} }
# Repo
# Repo # Repo
use_repo() { use_repo() {
# fk is # 删除现有的 istore_compat 文件
if [ -f "/etc/opkg/compatfeeds.conf" ]; then if [ -f "/var/opkg-lists/istore_compat" ]; then
rm /etc/opkg/compatfeeds.conf rm /var/opkg-lists/istore_compat
fi fi
echo "==============================================================================" echo "=============================================================================="
echo "Warning:" echo "Warning:"
echo "软件源纯属免费分享,赞助我们复制链接在浏览器打开,这对我们继续保持在线服务有很大影响。" echo "软件源纯属免费分享,赞助我们复制链接在浏览器打开,这对我们继续保持在线服务有很大影响。"
@@ -395,36 +397,34 @@ use_repo(){
sleep 1 sleep 1
done done
system_arch=$(uname -m) arch=$(uname -m)
release="/etc/catwrt_release"
model=$(grep "Model:" /etc/catwrt_release | cut -d ' ' -f2)
download_success=false
if [[ $model =~ "mt798x" ]]; then
# mt798x
curl --retry 2 --max-time 5 -o /etc/opkg/distfeeds.conf $MT798X_REPO && download_success=true
elif [ "$arch" = "x86_64" ]; then
# amd64
curl --retry 2 --max-time 5 -o /etc/opkg/distfeeds.conf $AMD64_REPO && download_success=true
if [ -f "$release" ]; then
source "$release"
else else
echo "Error: $release" echo "不支持的机型: $model"
return
fi
echo ""
if [[ "$system_arch" == "x86_64" && "$arch" == "amd64" ]]; then
echo "正在获取 x86_64 软件源..."
curl -o /etc/opkg/distfeeds.conf $AMD64_REPO
elif [[ "$system_arch" == "aarch64" && "$arch" == "mt798x" ]]; then
echo "正在获取 mt798x 软件源..."
curl -o /etc/opkg/distfeeds.conf $MT798X_REPO
else
echo "Unsupported System Arch: $system_arch or $arch ."
return return
fi fi
if [ "$download_success" = true ]; then
if [ -f "/var/lock/opkg.lock" ]; then if [ -f "/var/lock/opkg.lock" ]; then
rm /var/lock/opkg.lock rm /var/lock/opkg.lock
fi fi
echo "更新软件包列表..."
opkg update opkg update
else
echo "下载失败,无法更新软件源。"
fi
} }
# catnd # catnd