From 6024df6d52717ccdedbac055aaa968704ec28ddc Mon Sep 17 00:00:00 2001 From: Sapphirus Date: Thu, 13 Apr 2023 05:00:20 +0000 Subject: [PATCH] Code cleanup - Split up into two functions - Rename main to check --- fedora_upgrade | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fedora_upgrade b/fedora_upgrade index 4f73fff..e5443af 100644 --- a/fedora_upgrade +++ b/fedora_upgrade @@ -4,13 +4,13 @@ source /etc/os-release MIRROR="https://mirror.xenyth.net/fedora/linux/releases" VERSION_NEXT=$(($VERSION_ID + 1)) -main () { +check () { 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 + check return fi @@ -21,6 +21,10 @@ main () { return fi + upgrade +} + +upgrade () { dnf upgrade --refresh -y dnf system-upgrade download --releasever=$VERSION_NEXT -y @@ -31,4 +35,4 @@ main () { dnf system-upgrade reboot -y } -main \ No newline at end of file +check \ No newline at end of file