2020-05-14 12:21:27 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-06-02 07:55:57 +00:00
|
|
|
set -e
|
|
|
|
|
|
|
|
DIR=$(dirname "${BASH_SOURCE[0]}")
|
|
|
|
ARCH=$(lscpu | head -n 1 | awk '{print $2}')
|
2020-05-14 12:21:27 +00:00
|
|
|
if [ ! -e /etc/apt/sources.bak ]; then
|
|
|
|
sudo mv /etc/apt/sources.list /etc/apt/sources.bak
|
|
|
|
|
|
|
|
CURRENT_CODENAME=$(lsb_release -c | cut -f2)
|
2020-06-02 07:55:57 +00:00
|
|
|
SOURCE_CODENAME=$(head -n 1 $DIR/sources.$ARCH.list | cut -d' ' -f3)
|
|
|
|
sudo bash -c "sed s/$SOURCE_CODENAME/$CURRENT_CODENAME/g $DIR/sources.$ARCH.list > /etc/apt/sources.list"
|
2020-05-14 12:21:27 +00:00
|
|
|
fi
|
2020-07-15 03:16:54 +00:00
|
|
|
|
|
|
|
# pip mirrors
|
|
|
|
mkdir -p $HOME/.pip
|
|
|
|
cat <<EOF > $HOME/.pip/pip.conf
|
|
|
|
[global]
|
|
|
|
#trusted-host = mirrors.aliyun.com
|
|
|
|
#index-url = https://mirrors.aliyun.com/pypi/simple
|
|
|
|
index-url = https://pypi.doubanio.com/simple
|
|
|
|
trusted-host = pypi.doubanio.com
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# docker accelerator
|
|
|
|
if [ -d /etc/docker ]; then$
|
|
|
|
dj='{}'$
|
|
|
|
[ -f /etc/docker/daemon.json ] && dj=$(cat /etc/docker/daemon.json)$
|
|
|
|
echo $dj | jq '. + {"registry-mirrors": ["https://izuhlbap.mirror.aliyuncs.com"]}' > /etc/docker/daemon.json$
|
|
|
|
systemctl restart docker$
|
|
|
|
fi$
|