home · contact · privacy
Add online tests.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 11 Mar 2025 15:23:32 +0000 (16:23 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 11 Mar 2025 15:23:32 +0000 (16:23 +0100)
testing/scripts/_misc.sh
testing/scripts/setup_desktop.sh
testing/scripts/setup_secrets_root.sh
testing/scripts/setup_secrets_user.sh

index 7520e9d3416ac6782b76ee9e9921896cdeb8677e..760dda75d4e7a0085f275c500d580616be8ebc69 100644 (file)
@@ -39,8 +39,15 @@ abort_if_exists() {
 }
 
 abort_if_not_user() {
-if [ `whoami` != "$1" ]; then
-    echo "Must be run as $1."
-    exit 1
-fi
+    if [ `whoami` != "$1" ]; then
+        echo "Must be run as $1."
+        exit 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
+    fi
 }
index d5b5b140c292466cb30273a163ef026e3bf88173..f954302873a63d7664f39fba7da5cb52a1cf5e9a 100755 (executable)
@@ -4,6 +4,7 @@ set -x
 . ./_misc.sh
 
 expect_min_n_args 1 "(system name)" "$@"
+abort_if_offline
 get_system_name_arg "$1"
 MIN_MODULES="all ${system_class_name} ${system_name}"
 
index 413eb0e9165640db43e3ac6a240e1d655ebb0c6d..2a8f8f24fc2e777b475166924b9e82435db0a2b3 100755 (executable)
@@ -3,6 +3,7 @@ set -e
 . ./_misc.sh
 
 abort_if_not_user root
+abort_if_offline
 
 # Mount secrets device and copy over its content.
 abort_if_exists "${PATH_SECRETS}"
index cf0947722b743ba8d55b0a62f4dd9c8a6286495c..40ee16e2abc73096359bf24e26ae03629104797c 100755 (executable)
@@ -2,9 +2,6 @@
 set -e
 . ./_misc.sh
 
-# to remind user to go online if not yet done
-# TODO: replace by actual test
-nmtui
 
 BORG_PASSPHRASE="$1"
 PATH_REPOS="${HOME}/repos"
@@ -14,6 +11,7 @@ REMOTE_PATH_REPOS=/var/repos
 NAME_BORGAPP=borgplom
 
 abort_if_not_user "${USERNAME}"
+abort_if_offline
 abort_if_exists "${PATH_USER_SSH}"
 abort_if_exists "${PATH_REPOS}"
 abort_if_exists "${PATH_BORGKEYS}"