dotfiles/optim/mirrors.sh

26 lines
606 B
Bash
Raw Normal View History

2020-11-02 04:08:18 +00:00
#!/bin/sh
2020-09-18 04:16:15 +00:00
2020-11-02 04:08:18 +00:00
DIR=$(readlink -f "$(dirname "$0")")
. "$DIR/../env.sh"
2020-09-18 04:16:15 +00:00
2020-11-02 04:08:18 +00:00
! in_china && echo 'Skip mirrors configuration' && exit
2020-09-18 04:16:15 +00:00
# setup package mirror for CHINA
case "$PM" in
apt)
# backup original sources.list
[ ! -f /etc/apt/sources.list.bak ] && \
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
# replace with aliyun mirror
awk '$0 ~ /^deb/ {$2="https://mirrors.aliyun.com/ubuntu/"; print}' /etc/apt/sources.list.bak | sudo tee /etc/apt/sources.list
sudo apt update
;;
pacman)
echo TODO
2020-11-02 04:08:18 +00:00
exit 1
2020-09-18 04:16:15 +00:00
;;
esac