1
0
Fork 0
fedora_upgrade/fedora_upgrade
2023-04-13 04:47:05 +00:00

34 lines
785 B
Bash

#!/bin/bash
source /etc/os-release
MIRROR="https://mirror.xenyth.net/fedora/linux/releases"
main () {
curl -s -o /dev/null $MIRROR
if [[ $? != 0 ]]; then
echo "Internet connection not found, or mirror is offline. Trying again in 60 seconds.."
sleep 60
main
return
fi
local version_next=$(($VERSION_ID + 1))
local mirror_response=$(curl -s -o /dev/null -w "%{http_code}" $MIRROR/$version_next/)
if [[ $mirror_response == 404 ]]; then
echo "Fedora $VERSION_ID is the latest version."
return
fi
dnf upgrade --refresh -y
dnf system-upgrade download --releasever=$version_next -y
wall "WARNING: An upgrade from Fedora $VERSION_ID to Fedora $version_next is commencing! Your computer will reboot in 60 seconds."
sleep 60
dnf system-upgrade reboot -y
}
main