1+ #! /bin/bash
2+
3+ sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
4+
5+ UBUNTU_VERSION=` grep -Eo ' [12][08]' /etc/issue.net`
6+ echo $UBUNTU_VERSION
7+
8+ if [[ $UBUNTU_VERSION == 18 ]]
9+ then
10+ tee -a ./sources.list > /dev/null << EOF
11+ deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
12+ deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
13+
14+ deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
15+ deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
16+
17+ deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
18+ deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
19+
20+ # deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
21+ # deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
22+
23+ deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
24+ deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
25+ EOF
26+
27+ elif [[ $UBUNTU_VERSION == 20 ]]
28+ then
29+
30+ tee -a ./sources.list > /dev/null << EOF
31+ deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
32+ deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
33+
34+ deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
35+ deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
36+
37+ deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
38+ deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
39+
40+ # deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
41+ # deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
42+
43+ deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
44+ deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
45+ else
46+ echo "Version mismatch"
47+ exit 1
48+ fi
49+ EOF
50+
51+ sudo mv ./sources.list /etc/apt/sources.list
0 commit comments