diff --git a/scripts/check_updates.sh b/scripts/check_updates.sh new file mode 100755 index 0000000..7351908 --- /dev/null +++ b/scripts/check_updates.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +ping -c 1 1.1.1.1 > /dev/null +have_internet="$?" + +if [ "$have_internet" -eq 0 ]; then + echo "Checking for available updates..." + checkupdates +else + echo "There appears to be no internet connection." +fi + +echo "Finish!" + +echo "This window may close!" + +sleep 5 diff --git a/scripts/checkupdates.sh b/scripts/checkupdates.sh deleted file mode 100755 index d60d648..0000000 --- a/scripts/checkupdates.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -checkupdates - -echo "Finish!" - -echo "This window may close!" - -sleep 5 diff --git a/src/main.rs b/src/main.rs index 302f7d2..fb5a133 100644 --- a/src/main.rs +++ b/src/main.rs @@ -105,7 +105,7 @@ fn main() { } Ok(Message::CheckUpdates) => { // println!("Checking Updates"); - let cmd = "/usr/bin/konsole --noclose --separate -e /bin/sh -c /usr/share/melawy-linux-updater-tray/scripts/checkupdates.sh"; + let cmd = "/usr/bin/konsole --noclose --separate -e /bin/sh -c /usr/share/melawy-linux-updater-tray/scripts/check_updates.sh"; let _ = run_cmd(cmd, None); glib::ControlFlow::Continue }