Code cleanup
- Split up into two functions - Rename main to check
This commit is contained in:
parent
32835e6b52
commit
6024df6d52
1 changed files with 7 additions and 3 deletions
|
@ -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
|
||||
check
|
Loading…
Reference in a new issue