-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrestore-default-repo-ubuntu.sh
executable file
·41 lines (34 loc) · 1.47 KB
/
restore-default-repo-ubuntu.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#This script can help to restore ubuntu repository to its default configuration
#!/bin/bash
#Please run this script as ROOT
GREEN='\033[0;32m'
NC='\033[0m'
# set -x
function backup_repo {
cd /etc/apt
sudo mv sources.list sources.list.bk
}
function create_repo {
cd /etc/apt
cat <<EOF > sources.list
deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
deb http://archive.canonical.com/ubuntu focal partner
deb-src http://archive.canonical.com/ubuntu focal partner
EOF
sudo apt update
sudo gpg --keyserver pgpkeys.mit.edu --recv-key 3B4FE6ACC0B21F32
sudo gpg -a --export 3B4FE6ACC0B21F32 | sudo apt-key add -
sudo gpg --keyserver pgpkeys.mit.edu --recv-key 871920D1991BC93C
sudo gpg -a --export 871920D1991BC93C | sudo apt-key add -
sudo apt-get update
}
backup_repo
create_repo
echo -e "${GREEN}Repository has been restored!${NC}"