From dfe30f9d6dfa4cca24544297ddb5488ed2facf5a Mon Sep 17 00:00:00 2001 From: shenmo Date: Thu, 4 Aug 2022 02:00:38 +0000 Subject: [PATCH] =?UTF-8?q?!59=20=20=20*=20=E8=B0=83=E6=95=B4=20=E7=8E=B0?= =?UTF-8?q?=E5=9C=A8=E4=B8=8E=E7=B3=BB=E7=BB=9F=E6=9B=B4=E6=96=B0=E5=88=86?= =?UTF-8?q?=E5=BC=80=EF=BC=8C=E4=B8=8D=E5=86=8D=E5=AF=BC=E8=87=B4=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=A4=B1=E8=B4=A5=20*=20=E6=94=AF=E6=8C=81=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E6=9B=B4=E6=96=B0=E8=BD=AF=E4=BB=B6=E6=BA=90=E6=96=87?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E4=B8=8D=E5=86=8D=E8=AE=A9d.=E5=90=83?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E6=9B=B4=E6=96=B0=E6=B5=81=E9=87=8F=20*=20ss?= =?UTF-8?q?-apt-fast=E4=B8=8D=E5=86=8D=E5=BC=BA=E5=88=B6root=E6=9D=83?= =?UTF-8?q?=E9=99=90=20*=20!61=20$1=E4=B8=BApolicy=E6=97=B6=EF=BC=8Capt-fa?= =?UTF-8?q?st=E6=8D=A2=E6=88=90apt=20*=20=E6=89=8B=E5=8A=A8=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=97=B6=E4=B9=9F=E9=87=8D=E6=96=B0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=BA=90=E6=96=87=E4=BB=B6=20*=20=09=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=9A=20=20=20=20=20tool/ss-apt-fast=20*=20=20=20*=20?= =?UTF-8?q?=E8=B0=83=E6=95=B4=20=E7=8E=B0=E5=9C=A8=E4=B8=8E=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E6=9B=B4=E6=96=B0=E5=88=86=E5=BC=80=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E5=AF=BC=E8=87=B4=E6=9B=B4=E6=96=B0=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/changelog | 11 +++++++ debian/spark-store.postinst | 15 ++++++++- pkg/etc/apt/preferences.d/sparkstore | 3 -- .../sources.list.d/sparkstore.list | 1 + tool/ss-apt-fast | 32 +++++++++++++------ tool/ssinstall | 11 ++----- tool/update-upgrade/ss-do-upgrade.sh | 7 +++- tool/update-upgrade/ss-update-controler.sh | 1 + .../update-upgrade/ss-update-notify-placer.sh | 5 ++- tool/update-upgrade/ss-upgrade-list.sh | 2 +- 10 files changed, 64 insertions(+), 24 deletions(-) delete mode 100644 pkg/etc/apt/preferences.d/sparkstore create mode 100644 tool/apt-fast-conf/sources.list.d/sparkstore.list diff --git a/debian/changelog b/debian/changelog index 9ec283a..f363937 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ + + +spark-store (3.1.3-2) stable; urgency=medium + + * 调整 现在与系统更新分开,不再导致更新失败 + * 支持直接更新软件源文件,不再让d.吃全部更新流量 + * ss-apt-fast不再强制root权限 + + + -- shenmo Fri, 30 Jan 2022 00:00:00 +0800 + spark-store (3.1.3-1) stable; urgency=medium * 修复 下载提前退出 diff --git a/debian/spark-store.postinst b/debian/spark-store.postinst index 6e61ec2..59c7427 100755 --- a/debian/spark-store.postinst +++ b/debian/spark-store.postinst @@ -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) diff --git a/pkg/etc/apt/preferences.d/sparkstore b/pkg/etc/apt/preferences.d/sparkstore deleted file mode 100644 index 8c9cac3..0000000 --- a/pkg/etc/apt/preferences.d/sparkstore +++ /dev/null @@ -1,3 +0,0 @@ -Package: * -Pin: origin *.deepinos.org.cn -Pin-Priority: 400 diff --git a/tool/apt-fast-conf/sources.list.d/sparkstore.list b/tool/apt-fast-conf/sources.list.d/sparkstore.list new file mode 100644 index 0000000..0563772 --- /dev/null +++ b/tool/apt-fast-conf/sources.list.d/sparkstore.list @@ -0,0 +1 @@ +deb [by-hash=force] https://d.store.deepinos.org.cn / diff --git a/tool/ss-apt-fast b/tool/ss-apt-fast index 0a57b3d..311b5b6 100755 --- a/tool/ss-apt-fast +++ b/tool/ss-apt-fast @@ -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 "$@" \ No newline at end of file +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 diff --git a/tool/ssinstall b/tool/ssinstall index 7d7e278..38e3369 100755 --- a/tool/ssinstall +++ b/tool/ssinstall @@ -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 -#恢复优先级 diff --git a/tool/update-upgrade/ss-do-upgrade.sh b/tool/update-upgrade/ss-do-upgrade.sh index 28df4b1..7b9db92 100755 --- a/tool/update-upgrade/ss-do-upgrade.sh +++ b/tool/update-upgrade/ss-do-upgrade.sh @@ -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 \ No newline at end of file diff --git a/tool/update-upgrade/ss-update-controler.sh b/tool/update-upgrade/ss-update-controler.sh index a8febde..91836fd 100755 --- a/tool/update-upgrade/ss-update-controler.sh +++ b/tool/update-upgrade/ss-update-controler.sh @@ -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 "---请按回车返回" diff --git a/tool/update-upgrade/ss-update-notify-placer.sh b/tool/update-upgrade/ss-update-notify-placer.sh index 0f783e1..244b738 100755 --- a/tool/update-upgrade/ss-update-notify-placer.sh +++ b/tool/update-upgrade/ss-update-notify-placer.sh @@ -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/ diff --git a/tool/update-upgrade/ss-upgrade-list.sh b/tool/update-upgrade/ss-upgrade-list.sh index 5110547..863e691 100755 --- a/tool/update-upgrade/ss-upgrade-list.sh +++ b/tool/update-upgrade/ss-upgrade-list.sh @@ -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"