!59 * 调整 现在与系统更新分开,不再导致更新失败 * 支持直接更新软件源文件,不再让d.吃全部更新流量 * ss-apt-fast不再强制root权限

* !61 $1为policy时,apt-fast换成apt
* 手动更新时也重新获取源文件
* 	修改:     tool/ss-apt-fast
*   * 调整 现在与系统更新分开,不再导致更新失败
This commit is contained in:
shenmo 2022-08-04 02:00:38 +00:00
parent b00f3fa501
commit dfe30f9d6d
10 changed files with 64 additions and 24 deletions

11
debian/changelog vendored
View File

@ -1,3 +1,14 @@
spark-store (3.1.3-2) stable; urgency=medium
* 调整 现在与系统更新分开,不再导致更新失败
* 支持直接更新软件源文件不再让d.吃全部更新流量
* ss-apt-fast不再强制root权限
-- shenmo <shenmo@spark-app.store> Fri, 30 Jan 2022 00:00:00 +0800
spark-store (3.1.3-1) stable; urgency=medium
* 修复 下载提前退出

View File

@ -20,8 +20,19 @@ case "$1" in
gpg --dearmor /tmp/spark-store-install/spark-store.asc
cp -f /tmp/spark-store-install/spark-store.asc.gpg /etc/apt/trusted.gpg.d/spark-store.gpg
# Remove existing source file
rm -f /etc/apt/preferences.d/sparkstore
rm -f /etc/apt/sources.list.d/sparkstore.list
# Run apt update to avoid users being fucked up by the non-exist dependency problem
apt update -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
curl --progress-bar -o /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list "https://gitee.com/deepin-community-store/repo_auto_update_script/raw/master/mirror-list-for-apt-fast/sources.list.d/sparkstore.list"
# 下载源列表
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"
# 更新
# Create symbo links to start upgrade detect
ln -s /opt/durapps/spark-store/bin/update-upgrade/autostart/spark-update-notifier.desktop /etc/xdg/autostart/spark-update-notifier.desktop
@ -42,6 +53,8 @@ case "$1" in
# Remove temp dir
rm -rf /tmp/spark-store-install
;;
triggered)

View File

@ -1,3 +0,0 @@
Package: *
Pin: origin *.deepinos.org.cn
Pin-Priority: 400

View File

@ -0,0 +1 @@
deb [by-hash=force] https://d.store.deepinos.org.cn /

View File

@ -1,19 +1,33 @@
#/bin/bash
if [ "$(id -u)" != "0" ]
then
echo "ss-apt-fast需要在root下运行"
exit
fi
DEPEND=`which apt-fast`
if [ "$DEPEND" = "" ] ; then
echo "未安装依赖apt-fast 开始安装"
apt install apt-fast -y
sudo apt install apt-fast -y
fi
rm /opt/durapps/spark-store/bin/apt-fast-conf/apt-fast.conf
mkdir -p /tmp/ss-apt-fast-conf/sources.list.d
# 创建文件夹
echo "从服务器获取配置和镜像列表..."
curl -s --progress-bar -o /opt/durapps/spark-store/bin/apt-fast-conf/apt-fast.conf "https://gitee.com/deepin-community-store/repo_auto_update_script/raw/master/mirror-list-for-apt-fast/apt-fast.conf"
echo "Getting server and mirror lists..."
echo
bwrap --dev-bind / / --bind '/opt/durapps/spark-store/bin/apt-fast-conf/apt-fast.conf' /etc/apt-fast.conf apt-fast "$@"
curl --progress-bar -o /tmp/ss-apt-fast-conf/apt-fast.conf "https://gitee.com/deepin-community-store/repo_auto_update_script/raw/master/mirror-list-for-apt-fast/apt-fast.conf"
chmod -R 755 /tmp/ss-apt-fast-conf
if [[ $1 == "policy" ]]; then
bwrap --dev-bind / / \
--bind '/tmp/ss-apt-fast-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 "$@"
else
bwrap --dev-bind / / \
--bind '/tmp/ss-apt-fast-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-fast "$@"
fi
rm -rf /tmp/ss-apt-fast-conf

View File

@ -46,8 +46,7 @@ isuos=`cat /etc/os-release | grep UnionTech`
##############判断是否是root运行如果是则正常走如果不是则代输密码
if [ "$(id -u)" != "0" ];then
#############################无root权限时
#临时提升星火源的优先级
echo "$upass" | sudo -S sed -i 's/400/500/g' /etc/apt/preferences.d/sparkstore
IS_INSTALLED=`which apt-fast`
if [ "$IS_INSTALLED" = "" ] ; then
@ -69,16 +68,14 @@ echo ---------------------------------------------------------------------------
echo "$upass" | sudo -S dpkg -i $1 || sudo ss-apt-fast install -yf
fi
echo "$upass" | sudo -S sed -i 's/500/400/g' /etc/apt/preferences.d/sparkstore
#恢复优先级
else
###########################有root权限时
#临时提升星火源的优先级
sed -i 's/400/500/g' /etc/apt/preferences.d/sparkstore
IS_INSTALLED=`which apt-fast`
if [ "$IS_INSTALLED" = "" ] ; then
@ -99,8 +96,6 @@ echo ---------------------------------------------------------------------------
dpkg -i $1 || ss-apt-fast install -yf
fi
sed -i 's/500/400/g' /etc/apt/preferences.d/sparkstore
#恢复优先级

View File

@ -3,7 +3,12 @@
echo "以上可升级,是否升级?[y/n]"
read yes_or_no
if [ "$yes_or_no" = "y" ];then
sudo ss-apt-fast upgrade -y -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
mkdir -p /tmp/ss-apt-fast-conf/sources.list.d
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 ss-apt-fast upgrade -y -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
else
exit
fi

View File

@ -73,6 +73,7 @@ case $option in
2)
echo "请注意:如果有些更新需要从系统获取更多依赖,你将需要手动操作 sudo ss-apt-fast upgrade"
echo "执行以下操作需要授权..."
sudo curl --progress-bar -o /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list "https://gitee.com/deepin-community-store/repo_auto_update_script/raw/master/mirror-list-for-apt-fast/sources.list.d/sparkstore.list"
/opt/durapps/spark-store/bin/update-upgrade/ss-upgrade-list.sh
/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade.sh
echo "---请按回车返回"

View File

@ -36,8 +36,11 @@ fi
#The code above is modified from https://blog.csdn.net/yaxuan88521/article/details/120516298
curl --progress-bar -o /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list "https://gitee.com/deepin-community-store/repo_auto_update_script/raw/master/mirror-list-for-apt-fast/sources.list.d/sparkstore.list"
# 每日更新星火源文件
updatetext=`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"`
updatetext=`sudo apt update -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"`
mkdir -p /tmp/spark-store-updatenum/

View File

@ -3,4 +3,4 @@ set -e
echo "---可更新的应用有:"
sudo apt list --upgradable -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
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 list --upgradable -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"