From 4c8bfbb91ec213cfe556d8c3f648827f50a44327 Mon Sep 17 00:00:00 2001
From: Jordon Bedwell <jordon@envygeeks.io>
Date: Thu, 30 Apr 2020 03:52:32 -0500
Subject: [PATCH] Cleanup connected.

---
 .../jekyll/copy/all/usr/jekyll/bin/connected  | 29 ++++++++-----------
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/repos/jekyll/copy/all/usr/jekyll/bin/connected b/repos/jekyll/copy/all/usr/jekyll/bin/connected
index 78090fb..470f519 100755
--- a/repos/jekyll/copy/all/usr/jekyll/bin/connected
+++ b/repos/jekyll/copy/all/usr/jekyll/bin/connected
@@ -2,28 +2,23 @@
 [ "$DEBUG" = "true" ] && set -x
 set -e
 
-con=$JEKYLL_VAR_DIR/con
-dis=$JEKYLL_VAR_DIR/dis
+connected=$JEKYLL_VAR_DIR/connected
+disconnected=$JEKYLL_VAR_DIR/disconnected
+[ -f "$disconnected" ] && [ -f "$connected" ] &&  rm -f "$disconnected" "$connected"
+{ [ "$CONNECTED" = "false" ] || [ -f "$disconnected" ]; } && exit 1
+{ [ "$CONNECTED" =  "true" ] || [ -f "$connected" ]; } && exit 0
 
-# --
-# If we have both, then someting has gone terribly wrong,
-#  this isn't very likely but it could very well happen and
-#  we need to guard against it...
-# --
-[ -f $dis ] && [ -f $con ] &&  rm -f $dis $con
-([ "$CONNECTED" =  "true" ] || [ -f $con ]) && exit 0
-([ "$CONNECTED" = "false" ] || [ -f $dis ]) && exit 1
-
-# --
+#
 # If we aren't connected, or forced as connected, or not
 # connected then we should check with WGet (because of Proxies)
 # whether we are connected to the internet.
-# --
-d=https://www.google.com
-if wget -q --spider $d -O /dev/null 2>/dev/null; then
-  su-exec jekyll touch $con
+#
+
+url=https://www.google.com
+if wget -q --spider "$url" -O /dev/null 2>/dev/null; then
+  su-exec jekyll touch "$connected"
   exit 0
 else
-  su-exec jekyll touch $dis
+  su-exec jekyll touch $disconnected
   exit 1
 fi
-- 
GitLab