Skip to content

Instantly share code, notes, and snippets.

@SaicharanKandukuri
Created October 14, 2023 16:28
Show Gist options
  • Save SaicharanKandukuri/9f95b69146d72b0638c6d9676276707d to your computer and use it in GitHub Desktop.
Save SaicharanKandukuri/9f95b69146d72b0638c6d9676276707d to your computer and use it in GitHub Desktop.
A script to force upgrade ubuntu distributions
#!/bin/bash
MIRROR="http://archive.ubuntu.com/ubuntu"
SUITE="jammy"
# check for sudo
[[ $EUID != 0 ]] && echo "Please run as sudo.."
# backup existing sources
mv -v /etc/apt/sources.list /etc/apt/sources.list.back
cat <<-EOF > /etc/apt/sources.list
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb $MIRROR $SUITE main restricted
# deb-src $MIRROR $SUITE main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb $MIRROR $SUITE-updates main restricted
# deb-src $MIRROR $SUITE-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb $MIRROR $SUITE universe
# deb-src $MIRROR $SUITE universe
deb $MIRROR $SUITE-updates universe
# deb-src $MIRROR $SUITE-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb $MIRROR $SUITE multiverse
# deb-src $MIRROR $SUITE multiverse
deb $MIRROR $SUITE-updates multiverse
# deb-src $MIRROR $SUITE-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb $MIRROR $SUITE-backports main restricted universe multiverse
# deb-src $MIRROR $SUITE-backports main restricted universe multiverse
EOF
apt clean
apt update
apt full-upgrade -y
echo "Update Job done.."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment