1- #! /usr/bin/env bash
2- :
1+ #! /bin/bash
2+ # # FORCE UPGRADE TO Jammy
3+ # mirror method
4+
5+ DISTRO=" jammy"
6+ _MIRROR_PORTS=" http://ports.ubuntu.com/ubuntu-ports/"
7+ _MIRROR=" http://archive.ubuntu.com/ubuntu/"
8+
9+ ask () {
10+ msg=" $1 "
11+ echo -ne " $msg [Y/N]: "
12+ read -r response
13+
14+ case $response in
15+ " Y" |" y" |" " |" yes" |" YES" ) return 0 ;;
16+ " N" |" n" |" no" |" NO" ) return 1 ;;
17+ * ) return 1 ;;
18+ esac
19+ }
20+
21+ function upgrade() {
22+ # set MIRROR
23+ case $( run_cmd dpkg --print-architecture) in
24+ amd64|i386) MIRROR=$_MIRROR ;;
25+ * ) MIRROR=$_MIRROR_PORTS ;;
26+ esac
27+
28+
29+ # Inject new sources.list file
30+ # By default proot-distro changes directory to distro root!
31+
32+ [[ ! -f etc/apt/sources.list ]] && touch etc/apt/sources.list
33+ [[ ! -w etc/apt/sources.list ]] && chmod +r+x etc/apt/sources.list
34+
35+ cat << - EOF > etc/apt/sources.list
36+ # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
37+ # newer versions of the distribution.
38+ deb $MIRROR $SUITE main restricted
39+ # deb-src $MIRROR $SUITE main restricted
40+ ## Major bug fix updates produced after the final release of the
41+ ## distribution.
42+ deb $MIRROR $SUITE -updates main restricted
43+ # deb-src $MIRROR $SUITE -updates main restricted
44+ ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
45+ ## team. Also, please note that software in universe WILL NOT receive any
46+ ## review or updates from the Ubuntu security team.
47+ deb $MIRROR $SUITE universe
48+ # deb-src $MIRROR $SUITE universe
49+ deb $MIRROR $SUITE -updates universe
50+ # deb-src $MIRROR $SUITE -updates universe
51+ ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
52+ ## team, and may not be under a free licence. Please satisfy yourself as to
53+ ## your rights to use the software. Also, please note that software in
54+ ## multiverse WILL NOT receive any review or updates from the Ubuntu
55+ ## security team.
56+ deb $MIRROR $SUITE multiverse
57+ # deb-src $MIRROR $SUITE multiverse
58+ deb $MIRROR $SUITE -updates multiverse
59+ # deb-src $MIRROR $SUITE -updates multiverse
60+ ## N.B. software from this repository may not have been tested as
61+ ## extensively as that contained in the main release, although it includes
62+ ## newer versions of some applications which may provide useful features.
63+ ## Also, please note that software in backports WILL NOT receive any review
64+ ## or updates from the Ubuntu security team.
65+ deb $MIRROR $SUITE -backports main restricted universe multiverse
66+ # deb-src $MIRROR $SUITE -backports main restricted universe multiverse
67+ EOF
68+
69+ # Trigger apt [ update & upgrade ]
70+
71+ run_cmd apt update || apt-get update
72+ run_cmd apt upgrade -y || apt upgrade -y
73+ }
74+
75+ # get confirmation
76+ echo " FORCE UPGRADE SCRIPT.."
77+ sleep 2
78+ echo " DISTRO=$DISTRO "
79+ echo
80+ echo " READ CAREFULLY"
81+ echo
82+ sleep 1
83+ echo " as of july 14 both ubuntu 21.04 & ubuntu 21.10 reached to their end-of-life and no longer supported by ubuntu"
84+ echo " this script force upgrade your linux distro to $DISTRO "
85+ echo
86+ echo " This script may take around ~2hrs depending on device speed to fully upgrade distro"
87+
88+ if ask " Do you want to continue ?" ; then
89+ echo " get some snacks 🍪"
90+ sleep
91+ echo " watch a movie 🍿"
92+ sleep
93+ echo " This is gonna take some time!"
94+ sleep 2
95+ upgrade
96+ echo " 👌 Upgrade function did its job!"
97+ echo " A script by udroid_team"
98+ else
99+ echo " Upgrade skipped"
100+ fi
0 commit comments