home · contact · privacy
Minor refactoring.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 25 Mar 2025 16:10:36 +0000 (17:10 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 25 Mar 2025 16:10:36 +0000 (17:10 +0100)
testing/scripts/_config_scripts_lib.sh

index 2594682a1097d8eda65e9194db29451ce8de719e..62f9fcc8da35a891dae076bc38813e7f7f6fa7c3 100644 (file)
@@ -18,23 +18,25 @@ expect_min_n_args() {
     fi
 }
 
+_abort() {
+    echo "Aborting: $1"
+    exit 1
+}
+
 abort_if_exists() {
     if [ -e "$1" ]; then
-        echo "Aborting because $1 already exists."
-        exit 1
+        _abort "$1 already exists."
     fi
 }
 
 abort_if_not_user() {
     if [ "$(whoami)" != "$1" ]; then
-        echo "Must be run as ${1}."
-        exit 1
+        _abort "Must be run as ${1}."
     fi
 }
 
 abort_if_offline() {
     if ! ping -c1 -W2 1.1.1.1 > /dev/null 2>&1; then
-        echo "Must be run online."
-        exit 1
+        _abort 'Must be run online.'
     fi
 }