#!/bin/bash case `arch` in x86_64) STORE_URL="store" STORE_LIST_URL="" ;; aarch64) STORE_URL="aarch64-store" STORE_LIST_URL="-aarch64" ;; esac SS_APT_FAST="/opt/durapps/spark-store/bin/apt-fast/ss-apt-fast" if [ ! -e "/tmp/aptss-conf/apt-fast.conf" ];then ###刷新apt-fast配置 mkdir -p /tmp/aptss-conf/ echo "从服务器获取配置和镜像列表..." echo "Getting server and mirror lists..." echo curl --progress-bar -o /tmp/aptss-conf/apt-fast.conf "https://d.store.deepinos.org.cn/apt-fast.conf" chmod -R 755 /tmp/aptss-conf fi if [ ! -e "/var/lib/apt/lists/d.spark-app.store_${STORE_URL}_Packages" ] && [ ! -e "/var/lib/apt/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages" ] && [ ! -e "/var/lib/apt/lists/mirrors.sdu.edu.cn_spark-store-repository_${STORE_URL}_Packages" ];then echo "接收星火仓库软件信息中..." mkdir -p /tmp/aptss-conf/ echo "从服务器获取配置和镜像列表..." echo "Getting server and mirror lists..." 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 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" #只更新星火源 fi if [ "$1" = "install" ] || [ "$1" = "upgrade" ] || [ "$1" = "full-upgrade" ] ; then ###执行 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} "$@" --allow-downgrades elif [ "$1" = "download" ];then ###执行 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} "$@" --allow-downgrades elif [ "$1" = "policy" ] || [ "$1" = "search" ];then ###执行 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 "$@" elif [ "$1" = "ssupdate" ];then mkdir -p /tmp/aptss-conf/ echo "从服务器获取配置和镜像列表..." echo "Getting server and mirror lists..." 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 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" #只更新星火源 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" mkdir -p /tmp/aptss-conf/ echo "从服务器获取配置和镜像列表..." echo "Getting server and mirror lists..." echo curl --progress-bar -o /tmp/aptss-conf/apt-fast.conf "https://d.store.deepinos.org.cn/apt-fast.conf" chmod -R 755 /tmp/aptss-conf ### 额外一份拿来给aptss自动补全用 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 "$@" -o APT::Get::List-Cleanup="0" 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 "$@" -o APT::Get::List-Cleanup="0" -o Dir::Cache="/etc/aptss/" else 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 "$@" fi