mirror of
				https://gitee.com/spark-store-project/spark-store
				synced 2025-11-04 16:22:19 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			131 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			131 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/bash
 | 
						|
 | 
						|
source /opt/durapps/spark-store/bin/bashimport/transhell.amber
 | 
						|
load_transhell
 | 
						|
 | 
						|
case `arch` in
 | 
						|
   x86_64)
 | 
						|
	STORE_URL="store"
 | 
						|
	STORE_LIST_URL=""
 | 
						|
	;;
 | 
						|
   aarch64)
 | 
						|
	STORE_URL="aarch64-store"
 | 
						|
	STORE_LIST_URL="-aarch64"
 | 
						|
	;;
 | 
						|
   loongarch64)
 | 
						|
   	STORE_URL="loong64-store"
 | 
						|
   	STORE_LIST_URL="-loong64"
 | 
						|
   	
 | 
						|
esac
 | 
						|
SS_APT_FAST="/opt/durapps/spark-store/bin/apt-fast/ss-apt-fast"
 | 
						|
 | 
						|
 | 
						|
is_empty_dir(){ 
 | 
						|
    return `ls -A $1|wc -w`
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
 | 
						|
if [ "$(id -u)" != "0" ];then
 | 
						|
#############################无root权限时
 | 
						|
echo -e "\e[1;32m${TRANSHELL_CONTENT_RUNNING_IN_NOT_ROOT_USER}\e[0m"
 | 
						|
 | 
						|
else
 | 
						|
 | 
						|
 | 
						|
ln -sf /etc/apt/sources.list.d/* /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d
 | 
						|
###让这里和系统同步,先链接,然后清除无效链接
 | 
						|
find /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d -xtype l -delete
 | 
						|
 | 
						|
fi
 | 
						|
 | 
						|
if [ ! -e "/tmp/aptss-conf/apt-fast.conf" ];then
 | 
						|
###刷新apt-fast配置
 | 
						|
mkdir -p /tmp/aptss-conf/
 | 
						|
echo -e "\e[1;32m${TRANSHELL_CONTENT_GETTING_SERVER_CONFIG_AND_MIRROR_LIST}\e[0m"
 | 
						|
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/aptss/lists/d.spark-app.store_${STORE_URL}_Packages" ] && [ ! -e "/var/lib/aptss/lists/d.store.deepinos.org.cn_${STORE_URL}_Packages" ] && [ ! -e "/var/lib/aptss/lists/mirrors.sdu.edu.cn_spark-store-repository_${STORE_URL}_Packages" ];then
 | 
						|
 | 
						|
mkdir -p /tmp/aptss-conf/
 | 
						|
echo -e "\e[1;32m${TRANSHELL_CONTENT_GETTING_SERVER_CONFIG_AND_MIRROR_LIST}\e[0m"
 | 
						|
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    
 | 
						|
 | 
						|
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
 | 
						|
 | 
						|
#只更新星火源
 | 
						|
 | 
						|
 | 
						|
fi
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
if  [ "$1" = "install" ] || [ "$1" = "upgrade" ] || [ "$1" = "full-upgrade" ] ; then
 | 
						|
 | 
						|
 | 
						|
 | 
						|
###执行
 | 
						|
 | 
						|
                ${SS_APT_FAST} "$@" --allow-downgrades -c /opt/durapps/spark-store/bin/apt-fast-conf/aptss-apt.conf
 | 
						|
ret="$?"
 | 
						|
if [ "$ret" -ne 0 ];then
 | 
						|
echo -e "\e[1;33m$TRANSHELL_CONTENT_PLEASE_USE_APTSS_INSTEAD_OF_APT\e[0m"
 | 
						|
exit $ret
 | 
						|
fi
 | 
						|
 | 
						|
 | 
						|
elif [ "$1" = "download" ];then
 | 
						|
 | 
						|
###执行
 | 
						|
 | 
						|
                ${SS_APT_FAST} "$@" --allow-downgrades -c /opt/durapps/spark-store/bin/apt-fast-conf/aptss-apt.conf
 | 
						|
 | 
						|
 | 
						|
elif [ "$1" = "policy" ] || [ "$1" = "search" ];then
 | 
						|
 | 
						|
 | 
						|
 | 
						|
###执行
 | 
						|
                apt "$@"  -c /opt/durapps/spark-store/bin/apt-fast-conf/aptss-apt.conf
 | 
						|
 | 
						|
elif [ "$1" = "ssupdate" ];then
 | 
						|
 | 
						|
mkdir -p /tmp/aptss-conf/
 | 
						|
echo -e "\e[1;32m${TRANSHELL_CONTENT_GETTING_SERVER_CONFIG_AND_MIRROR_LIST}\e[0m"
 | 
						|
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    
 | 
						|
 | 
						|
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 -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
 | 
						|
echo -e "\e[1;32m${TRANSHELL_CONTENT_GETTING_SERVER_CONFIG_AND_MIRROR_LIST}\e[0m"
 | 
						|
echo
 | 
						|
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/
 | 
						|
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自动补全用
 | 
						|
                apt "$@" -c /opt/durapps/spark-store/bin/apt-fast-conf/aptss-apt.conf
 | 
						|
 | 
						|
else
 | 
						|
                apt "$@" -c /opt/durapps/spark-store/bin/apt-fast-conf/aptss-apt.conf
 | 
						|
fi
 | 
						|
 | 
						|
 |