summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid P <megver83@parabola.nu>2018-05-17 13:04:40 -0400
committerDavid P <megver83@parabola.nu>2018-05-17 13:04:40 -0400
commit4b6bc5c0f017089bfb5a8cf61b3ad3d60b4b8532 (patch)
treecbd331b7cec585caa488f5594d0067a9cce5bc58
parenta6cf9d62ca120ffdb93d83010b804223207cf438 (diff)
find-deprecated-pkgs: check if the system is connected to internet
Signed-off-by: David P <megver83@parabola.nu>
-rwxr-xr-xfind-deprecated-pkgs17
1 files changed, 11 insertions, 6 deletions
diff --git a/find-deprecated-pkgs b/find-deprecated-pkgs
index 3be7b0f..35ebd56 100755
--- a/find-deprecated-pkgs
+++ b/find-deprecated-pkgs
@@ -87,6 +87,14 @@ mkpkglist() {
esac
}
+err() {
+ printf '%sError:%s %s\n' \
+ "$(tput setaf 1)" \
+ "$(tput sgr0)" \
+ "$1"
+ false
+}
+
check(){
mkpkglist $1
case $1 in
@@ -100,11 +108,7 @@ check(){
grep ^$p $arch_pkgs &> /dev/null || printf '%s was not found\n' "$p"
done
;;
- *) printf '%sError:%s %s is not a valid argument\n' \
- "$(tput setaf 1)" \
- "$(tput sgr0)" \
- "$1"
- false
+ *) err "$1 is not a valid argument"
;;
esac
}
@@ -112,5 +116,6 @@ check(){
if [ -s $1 ]; then
usage
else
- check $1 || STATUS=$? usage
+ ping -q -w 1 -c 1 `ip r | grep ^default | awk '{print $3}'` &> /dev/null || err 'You are not connected to internet'
+ check $1 || STATUS=$? usage
fi