From 99dbb4ab20e521f1a3a357bc7bfcc87e796379da Mon Sep 17 00:00:00 2001 From: maride Date: Sun, 30 Jul 2017 22:19:24 +0200 Subject: [PATCH] Add checks loop --- checks/internet.check | 12 ++++++++++++ install.sh | 10 +++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100755 checks/internet.check diff --git a/checks/internet.check b/checks/internet.check new file mode 100755 index 0000000..dfe6c03 --- /dev/null +++ b/checks/internet.check @@ -0,0 +1,12 @@ +#!/bin/sh + +ping -c 1 archlinux.org 2>/tmp/arch-maride-flavour_checks_error.log 1>/tmp/arch-maride-flavour_checks_out.log +return=$? + +if [ "$return" -eq 0 ]; then + exit 0 +else + echo "~> Either internet is unavailable or archlinux.org is down..." + echo "~> (ping returned $return. Maybe check the logs in /tmp." + exit 1 +fi diff --git a/install.sh b/install.sh index b95f2d7..5ab25b6 100755 --- a/install.sh +++ b/install.sh @@ -16,4 +16,12 @@ if [ "$answer" != "y" ]; then exit 1 fi - +for check in checks/*.check +do + echo "=> Running check '$check'..." + . $check + if [ "$?" -eq 0 ]; then + echo "=> Check failed. Fix it, maybe." + exit + fi +done