完成shell改造

This commit is contained in:
shenmo 2024-04-09 12:16:19 +08:00
parent 4d9e3addde
commit c9e77022b1
3 changed files with 10 additions and 178 deletions
tool
apt-fast-conf
aptss
ss-feedback

@ -1,169 +0,0 @@
###################################################################
# CONFIGURATION OPTIONS
###################################################################
# Every item has a default value besides MIRRORS (which is unset).
# Use aptitude, apt-get, or apt?
# Note that apt-get is used as a fallback for outputting the
# package URI list for e.g. aptitude, which can't do this
# Optionally add the FULLPATH to apt-get or apt-rpm or aptitude
# e.g. /usr/bin/aptitude
#
# Default: apt-get
#
_APTMGR=apt-get
if [ -x "$(command -v apt)" ]; then
_APTMGR=apt
fi
if grep -Eqi "linuxmint" /etc/os-release;then
_APTMGR=apt-get
fi
if [ -x "$(command -v oyo)" ]; then
_APTMGR=/usr/bin/apt
fi
####
#
# UOS sources auth config
#
#
if grep -Eqi "UnionTech" /etc/issue || grep -Eq "UnionTech" /etc/*-release;then
AUTH_UOS_USER="uos-https://license.chinauos.com-apt"
AUTH_UOS_PASSWD="`cat /etc/apt/auth.conf.d/uos.conf | grep home-packages.chinauos.com`"
AUTH_UOS_PASSWD=`echo ${AUTH_UOS_PASSWD#*password }`
fi
##### UOS自动读取账号密码以实现使用aptss来加速下载
# Enable DOWNLOADBEFORE to suppress apt-fast confirmation dialog and download
# packages directly.
#
# Default: dialog enabled
#
DOWNLOADBEFORE=true
# Choose mirror list to speed up downloads from same archive. To select some
# mirrors take a look at your distribution's archive mirror lists.
# Debian: http://www.debian.org/mirror/list
# Ubuntu: https://launchpad.net/ubuntu/+archivemirrors
#
# It is required to add mirrors in the sources.list to this array as well, so
# apt-fast can destinguish between different distributions.
#
# Examples:
#
# Different distributions (as in operating systems):
#
# sources.list:
# deb http://deb.debian.org/debian/ unstable main non-free contrib
# deb http://de.archive.ubuntu.com/ubuntu/ bionic main universe
#
# apt-fast.conf:
# MIRRORS=( 'http://deb.debian.org/debian','http://ftp.debian.org/debian,http://ftp2.de.debian.org/debian,http://ftp.de.debian.org/debian,ftp://ftp.uni-kl.de/debian'
# 'http://archive.ubuntu.com/ubuntu,http://de.archive.ubuntu.com/ubuntu,http://ftp.halifax.rwth-aachen.de/ubuntu,http://ftp.uni-kl.de/pub/linux/ubuntu,http://mirror.informatik.uni-mannheim.de/pub/linux/distributions/ubuntu/' )
#
#
# Single distribution:
#
# sources.list:
# deb http://fr.archive.ubuntu.com/ubuntu/ bionic main
# deb http://fr.archive.ubuntu.com/ubuntu/ artful main
#
# apt-fast.conf:
# MIRRORS=( 'http://fr.archive.ubuntu.com/ubuntu,http://bouyguestelecom.ubuntu.lafibre.info/ubuntu,http://mirror.ovh.net/ubuntu,http://ubuntu-archive.mirrors.proxad.net/ubuntu' )
#
# Default: disabled
#
MIRRORS=( 'https://d.store.deepinos.org.cn/,https://zunyun01.store.deepinos.org.cn/,https://mirrors.sdu.edu.cn/spark-store-repository/,http://cdn.dl.uniartisan.com:9000/deepinos/,https://d1.store.deepinos.org.cn/,https://d2.store.deepinos.org.cn/,https://d3.store.deepinos.org.cn/,https://d4.store.deepinos.org.cn/,https://d5.store.deepinos.org.cn/' )
# Maximum number of connections
# You can use this value in _DOWNLOADER command. Escape with ${}: ${_MAXNUM}
#
# Default: 5
#
_MAXNUM=16
# Maximum number of connections per server
# Default: 10
#
_MAXCONPERSRV=1
# Split size i.e. size of each piece
# Possible Values: 1M-1024M
#
_MINSPLITSZ=1M
# Piece selection algorithm to use
# Available values are: default, inorder, geom
# default: selects piece so that it reduces the number of establishing connection, reasonable for most cases
# inorder: selects pieces in sequential order starting from first piece
# geom: selects piece which has minimum index like inorder, but it exponentially increasingly keeps space from previously selected pieces
#
_PIECEALGO=default
# Downloadmanager listfile
# You can use this value in _DOWNLOADER command. Escape with ${}: ${DLLIST}
#
# Default: /tmp/apt-fast.list
#
DLLIST='/tmp/apt-fast.list'
# Download command to use. Temporary download list is designed for aria2. But
# you can choose another download command or download manager. It has to
# support following input file syntax (\t is tab character):
#
# # Comment
# MIRROR1\tMIRROR2\tMIRROR3...
# out=FILENAME1
# MIRROR1\tMIRROR2\tMIRROR3...
# out=FILENAME2
# ...
#
# Examples:
# aria2c with a proxy (set username, proxy, ip and password!)
# _DOWNLOADER='aria2c --no-conf -c -j ${_MAXNUM} -x ${_MAXCONPERSRV} -s ${_SPLITCON} --min-split-size=${_MINSPLITSZ} --stream-piece-selector=${_PIECEALGO} --http-proxy=http://username:password@proxy_ip:proxy_port -i ${DLLIST}'
#
# Default: _DOWNLOADER='aria2c --no-conf -c -j ${_MAXNUM} -x ${_MAXCONPERSRV} -s ${_SPLITCON} --min-split-size=${_MINSPLITSZ} --stream-piece-selector=${_PIECEALGO} -i ${DLLIST} --connect-timeout=600 --timeout=600 -m0'
#
_DOWNLOADER='aria2c --no-conf -c -j ${_MAXNUM} -x ${_MAXCONPERSRV} --min-split-size=${_MINSPLITSZ} --stream-piece-selector=${_PIECEALGO} -i ${DLLIST} --connect-timeout=600 --timeout=600 -m0 --http-user ${AUTH_UOS_USER} --http-passwd ${AUTH_UOS_PASSWD}'
# Download temp folder for Downloadmanager
# example /tmp/apt-fast. Standard is /var/cache/apt-fast
#
# Default: /var/cache/apt/apt-fast
#
DLDIR='/var/cache/apt/apt-fast'
# APT archives cache directory
#
# Default /var/cache/apt/archives
# (APT configuration items Dir::Cache and Dir::Cache::archives)
#
APTCACHE='/var/cache/apt/archives'
# apt-fast colors
# Colors are disabled when not using a terminal.
#
# Default colors are:
# cGreen='\e[0;32m'
# cRed='\e[0;31m'
# cBlue='\e[0;34m'
# endColor='\e[0m'

@ -1,6 +1,6 @@
#!/bin/bash
SPARK_CORE_SERVER_URL="https://d.store.deepinos.org.cn"
SPARK_DOWNLOAD_SERVER_URL="https://d.store.deepinos.org.cn"
source /opt/durapps/spark-store/bin/bashimport/transhell.amber
load_transhell
@ -46,7 +46,7 @@ if [ ! -e "/tmp/aptss-conf/apt-fast.conf" ];then
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 "${SPARK_CORE_SERVER_URL}/apt-fast.conf"
curl --progress-bar -o /tmp/aptss-conf/apt-fast.conf "${SPARK_DOWNLOAD_SERVER_URL}/apt-fast.conf"
chmod -R 755 /tmp/aptss-conf
fi
@ -57,10 +57,10 @@ if [ ! -e "/var/lib/aptss/lists/d.spark-app.store_${STORE_URL}_Packages" ] && [
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 "${SPARK_CORE_SERVER_URL}/apt-fast.conf"
curl --silent -o /tmp/aptss-conf/apt-fast.conf "${SPARK_DOWNLOAD_SERVER_URL}/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 "${SPARK_CORE_SERVER_URL}/sparkstore${STORE_LIST_URL}.list"
curl --silent -o /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list "${SPARK_DOWNLOAD_SERVER_URL}/sparkstore${STORE_LIST_URL}.list"
/usr/bin/apt update -c /opt/durapps/spark-store/bin/apt-fast-conf/aptss-apt.conf
#只更新星火源
@ -105,10 +105,10 @@ 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 "${SPARK_CORE_SERVER_URL}/apt-fast.conf"
curl --silent -o /tmp/aptss-conf/apt-fast.conf "${SPARK_DOWNLOAD_SERVER_URL}/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 "${SPARK_CORE_SERVER_URL}/sparkstore${STORE_LIST_URL}.list"
curl --silent -o /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list "${SPARK_DOWNLOAD_SERVER_URL}/sparkstore${STORE_LIST_URL}.list"
/usr/bin/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"
@ -118,9 +118,9 @@ curl --silent -o /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/spar
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 "${SPARK_CORE_SERVER_URL}/sparkstore${STORE_LIST_URL}.list"
curl --progress-bar -o /opt/durapps/spark-store/bin/apt-fast-conf/sources.list.d/sparkstore.list "${SPARK_DOWNLOAD_SERVER_URL}/sparkstore${STORE_LIST_URL}.list"
mkdir -p /tmp/aptss-conf/
curl --progress-bar -o /tmp/aptss-conf/apt-fast.conf "${SPARK_CORE_SERVER_URL}/apt-fast.conf"
curl --progress-bar -o /tmp/aptss-conf/apt-fast.conf "${SPARK_DOWNLOAD_SERVER_URL}/apt-fast.conf"
chmod -R 755 /tmp/aptss-conf
### 额外一份拿来给aptss自动补全用
/usr/bin/apt "$@" -c /opt/durapps/spark-store/bin/apt-fast-conf/aptss-apt.conf

@ -1,4 +1,5 @@
#!/bin/bash
SPARK_CORE_SERVER_URL="https://d.store.deepinos.org.cn"
#用法sender.sh 下载链接 HD70642
@ -44,7 +45,7 @@ fi
echo $STORE_URL/$APP_LOCATION
curl -X POST -H "Content-Type: application/json" -d '{"path": "'"${STORE_URL}/${APP_LOCATION}"'"}' http://zunyun01.store.deepinos.org.cn:38324/handle_post
curl -X POST -H "Content-Type: application/json" -d '{"path": "'"${STORE_URL}/${APP_LOCATION}"'"}' ${SPARK_CORE_SERVER_URL}/handle_post