1
0
Fork 0

Code cleanup

- Split up into two functions
- Rename main to check
This commit is contained in:
Xavier Moffett 2023-04-13 05:00:20 +00:00
parent 32835e6b52
commit 6024df6d52

View file

@ -4,13 +4,13 @@ source /etc/os-release
MIRROR="https://mirror.xenyth.net/fedora/linux/releases" MIRROR="https://mirror.xenyth.net/fedora/linux/releases"
VERSION_NEXT=$(($VERSION_ID + 1)) VERSION_NEXT=$(($VERSION_ID + 1))
main () { check () {
curl -s -o /dev/null $MIRROR curl -s -o /dev/null $MIRROR
if [[ $? != 0 ]]; then if [[ $? != 0 ]]; then
echo "Internet connection not found, or mirror is offline. Trying again in 60 seconds.." echo "Internet connection not found, or mirror is offline. Trying again in 60 seconds.."
sleep 60 sleep 60
main check
return return
fi fi
@ -21,6 +21,10 @@ main () {
return return
fi fi
upgrade
}
upgrade () {
dnf upgrade --refresh -y dnf upgrade --refresh -y
dnf system-upgrade download --releasever=$VERSION_NEXT -y dnf system-upgrade download --releasever=$VERSION_NEXT -y
@ -31,4 +35,4 @@ main () {
dnf system-upgrade reboot -y dnf system-upgrade reboot -y
} }
main check