aptss will now refresh the system source before doing install, download, policy....etc

This commit is contained in:
2022-09-19 17:58:00 +08:00
parent 9e4df5c5c2
commit 8741973cca
4 changed files with 32 additions and 11 deletions

View File

@@ -1,11 +1,5 @@
#/bin/bash
if [ "$1" = "install" ] || [ "$1" = "upgrade" ] || [ "$1" = "full-upgrade" ] || [ "$1" = "download" ] ; then
if [ ! -e "/tmp/aptss-conf/apt-fast.conf" ];then
###刷新apt-fast配置
mkdir -p /tmp/aptss-conf/
@@ -17,12 +11,23 @@ chmod -R 755 /tmp/aptss-conf
fi
if [ "$1" = "install" ] || [ "$1" = "upgrade" ] || [ "$1" = "full-upgrade" ] || [ "$1" = "download" ] ; then
DEPEND=`which apt-fast`
if [ "$DEPEND" = "" ] ; then
echo "未安装依赖apt-fast 开始安装"
sudo aptss ssupdate && sudo 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 install apt-fast -y
aptss ssupdate && 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 install apt-fast -y
fi
sudo 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 update -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
###执行
bwrap --dev-bind / / \
--bind '/tmp/aptss-conf/apt-fast.conf' /etc/apt-fast.conf \
@@ -30,6 +35,15 @@ bwrap --dev-bind / / \
apt-fast "$@" --allow-downgrades
elif [ "$1" = "policy" ] || [ "$1" = "search" ];then
sudo 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 update -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
###执行
bwrap --dev-bind / / \
--bind '/tmp/aptss-conf/apt-fast.conf' /etc/apt-fast.conf \
--bind '/opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list' /etc/apt/sources.list.d/sparkstore.list \
apt "$@" --allow-downgrades
elif [ "$1" = "ssupdate" ];then
mkdir -p /tmp/aptss-conf/

View File

@@ -65,7 +65,7 @@ fi
if [ "$DEPEND" != "" ] && [ "$isuos" = "" ]; then
echo "检测到apt-fast使用aptss进行多线程下载加速"
echo ----------------------------------------------------------------------------------
echo "$upass" | sudo -S dpkg -i $1 || sudo aptss ssupdate && sudo aptss install -yf
echo "$upass" | sudo -S dpkg -i $1 || sudo aptss install -yf
fi
@@ -90,7 +90,7 @@ fi
if [ "$DEPEND" != "" ] && [ "$isuos" = "" ]; then
echo "检测到apt-fast使用aptss进行多线程下载加速"
echo ----------------------------------------------------------------------------------
dpkg -i $1 || aptss ssupdate && aptss install -yf
dpkg -i $1 || aptss install -yf
fi