-
Notifications
You must be signed in to change notification settings - Fork 10
/
back_to_stock.sh
29 lines (24 loc) · 1.25 KB
/
back_to_stock.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
#!/bin/bash
# Detect os codename
codename=$(awk '/UBUNTU_CODENAME=/' /etc/os-release | sed 's/UBUNTU_CODENAME=//' | sed 's/[.]0/./')
# Disable all the external repos
sudo bash -c 'for i in /etc/apt/sources.list.d/*.list; do mv ${i} ${i}.disabled; done'
# Replace sources.list
text="deb http://archive.ubuntu.com/ubuntu/ $codename main universe restricted multiverse
deb-src http://archive.ubuntu.com/ubuntu/ $codename main universe restricted multiverse
deb http://security.ubuntu.com/ubuntu $codename-security main universe restricted multiverse
deb-src http://security.ubuntu.com/ubuntu $codename-security main universe restricted multiverse
deb http://archive.ubuntu.com/ubuntu/ $codename-updates main universe restricted multiverse
deb-src http://archive.ubuntu.com/ubuntu/ $codename-updates main universe restricted multiverse"
sudo echo "$text" | sudo tee /etc/apt/sources.list
# Start upgrade
sudo apt update
sudo apt install -f -y
sudo apt upgrade -y
sudo apt dist-upgrade -y
sudo apt autoremove --purge -y
echo ""
echo "All inside /etc/apt/sources.list.d is now disabled. Enable ONLY what you need!"
echo ""
echo "Example < sudo mv /etc/apt/sources.list.d/mozillateam-ubuntu-ppa-jammy.list.disabled /etc/apt/sources.list.d/mozillateam-ubuntu-ppa-jammy.list >"
echo ""