修复:无法访问系统源

This commit is contained in:
shenmo 2023-03-06 22:29:51 +08:00
parent b67fd11fd5
commit 02419bfdcb
3 changed files with 26 additions and 9 deletions
tool

@ -1,8 +1,7 @@
Debug::RunScripts true;
Dir::Cache "/var/lib/aptss/";
Dir::Etc::SourceParts "/etc/apt/sources.list.d/";
Dir::Etc::SourceList "/opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list";
Dir::Etc::SourceParts "/opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/";
Dir::State::lists "/var/lib/aptss/lists/";
APT::Get::Fix-Broken true;

@ -14,6 +14,23 @@ esac
SS_APT_FAST="/opt/durapps/spark-store/bin/apt-fast/ss-apt-fast"
if [ "$(id -u)" != "0" ];then
#############################无root权限时
echo "Please run me as root.请使用root权限启动"
exit 1
fi
ln -sf /etc/apt/sources.list.d/* /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d
###让这里和系统同步,先链接,然后清除无效链接
for a in `find /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d -type l`
do
stat -L $a >/dev/null 2>/dev/null
if [ $? -gt 0 ];then
rm $a
fi
done
if [ ! -e "/tmp/aptss-conf/apt-fast.conf" ];then
###刷新apt-fast配置
mkdir -p /tmp/aptss-conf/
@ -36,8 +53,8 @@ echo
curl --silent -o /tmp/aptss-conf/apt-fast.conf "https://d.store.deepinos.org.cn/apt-fast.conf"
chmod -R 755 /tmp/aptss-conf
sudo curl --silent -o /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list "https://d.store.deepinos.org.cn/sparkstore${STORE_LIST_URL}.list"
sudo apt update -c /opt/durapps/spark-store/bin/apt-fast-conf/aptss-apt.conf
curl --silent -o /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list "https://d.store.deepinos.org.cn/sparkstore${STORE_LIST_URL}.list"
apt update -c /opt/durapps/spark-store/bin/apt-fast-conf/aptss-apt.conf
#只更新星火源
@ -80,14 +97,15 @@ echo
curl --silent -o /tmp/aptss-conf/apt-fast.conf "https://d.store.deepinos.org.cn/apt-fast.conf"
chmod -R 755 /tmp/aptss-conf
sudo curl --silent -o /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list "https://d.store.deepinos.org.cn/sparkstore${STORE_LIST_URL}.list"
sudo cp -r /var/lib/apt/lists/* /var/lib/aptss/lists/
sudo apt update -c /opt/durapps/spark-store/bin/apt-fast-conf/aptss-apt.conf -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
curl --silent -o /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list "https://d.store.deepinos.org.cn/sparkstore${STORE_LIST_URL}.list"
cp -r /var/lib/apt/lists/* /var/lib/aptss/lists/
apt update -c /opt/durapps/spark-store/bin/apt-fast-conf/aptss-apt.conf -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" -o Dir::Etc::sourcelist="/opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list"
#只更新星火源
elif [ "$1" = "update" ];then
sudo curl --progress-bar -o /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list "https://d.store.deepinos.org.cn/sparkstore${STORE_LIST_URL}.list"
curl --progress-bar -o /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list "https://d.store.deepinos.org.cn/sparkstore${STORE_LIST_URL}.list"
mkdir -p /tmp/aptss-conf/

@ -12,7 +12,7 @@ case $1 in
;;
upgradable-list)
output=$(env LANGUAGE=en_US bwrap --dev-bind / / --bind '/opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list' /etc/apt/sources.list.d/sparkstore.list apt list --upgradable -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="/dev/null" -o APT::Get::List-Cleanup="0" | awk NR\>1)
output=$(env LANGUAGE=en_US apt -c /opt/durapps/spark-store/bin/apt-fast-conf/aptss-apt.conf list --upgradable -o Dir::Etc::sourcelist="/opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="/dev/null" -o APT::Get::List-Cleanup="0" | awk NR\>1)
IFS_OLD="$IFS"
IFS=$'\n'