ubuntu tools misc
This commit is contained in:
39
tools/ubuntu/desktop-upgrade.sh
Executable file
39
tools/ubuntu/desktop-upgrade.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
# https://dev.to/chefgs/upgrading-an-end-of-life-eol-ubuntu-os-to-lts-version-3a36
|
||||
# https://changelogs.ubuntu.com/meta-release
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source /etc/os-release
|
||||
|
||||
echo "Loading..."
|
||||
mapfile -t codenames < <(curl -s https://changelogs.ubuntu.com/meta-release | grep -oP '(?<=Dist:\s).*')
|
||||
thisCodename="$VERSION_CODENAME"
|
||||
for idx in "${!codenames[@]}"; do
|
||||
if [ "${codenames[idx]}" = "$thisCodename" ]; then
|
||||
nextCodename=${codenames[((idx+1))]}
|
||||
fi
|
||||
done
|
||||
|
||||
targetDownloadPath="$(pwd)/upgrade-$nextCodename"
|
||||
targetToolPath="$targetDownloadPath/unpacked"
|
||||
targetToolFile="$targetDownloadPath/$nextCodename.tar.gz"
|
||||
|
||||
echo "Current dist: $thisCodename"
|
||||
echo "Next dist: $nextCodename"
|
||||
echo "Target path: $targetToolFile"
|
||||
|
||||
rm -rf "$targetToolPath"
|
||||
mkdir -p "$targetToolPath"
|
||||
|
||||
echo "Downloading..."
|
||||
cd "$targetDownloadPath" || exit 1
|
||||
wget "http://archive.ubuntu.com/ubuntu/dists/${nextCodename}-updates/main/dist-upgrader-all/current/${nextCodename}.tar.gz"
|
||||
|
||||
echo "Unpacking..."
|
||||
tar -xaf "$targetToolFile" -C "$targetToolPath"
|
||||
|
||||
echo "Starting..."
|
||||
cd ./unpacked || exit 1
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
sudo ./$nextCodename
|
||||
Reference in New Issue
Block a user