From 8e5394cd1cd81dc04b4aecebb70f41492265d149 Mon Sep 17 00:00:00 2001 From: Nico Jensch Date: Tue, 15 Dec 2020 18:32:19 +0100 Subject: [PATCH] Add internet connectivity check --- usr/bin/setup-assistant | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/usr/bin/setup-assistant b/usr/bin/setup-assistant index 9f217bc..9d747a7 100755 --- a/usr/bin/setup-assistant +++ b/usr/bin/setup-assistant @@ -1,4 +1,13 @@ #!/bin/bash +function goto +{ + label=$1 + cmd=$(sed -n "/^:[[:blank:]][[:blank:]]*${label}/{:a;n;p;ba};" $0 | + grep -v ':$') + eval "$cmd" + exit +} + function upgrade2ultimate { rm -rf /tmp/setup-assistant @@ -701,6 +710,26 @@ systemctl --user start psd >/dev/null 2>&1 & libinput-gestures-setup autostart >/dev/null 2>&1 & libinput-gestures-setup start >/dev/null 2>&1 & +: isup +wget -q --spider http://garudalinux.org + +if [ $? -eq 0 ]; then + echo "Online" +else + if ! yad \ + --image='update' \ + --title="Setup Assistant" \ + --window-icon='update' \ + --geometry=700x100 \ + --button=No:0 \ + --button=Yes:1 \ + --text-align=center \ + --center \ + --text "No internet connection available, try again?"; then + goto isup + else exit + fi +fi if ! yad \ --image='update' \ @@ -712,7 +741,7 @@ if ! yad \ --text-align=center \ --center \ --text "Do you want to get a recent mirrorlist?"; then - reflector-simple >/dev/null 2>&1 + reflector-simple >/dev/null 2>&1 fi if ! yad \