about summary refs log tree commit diff stats
path: root/bootstrap/install.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xbootstrap/install.sh (renamed from bootstrap/install)11
1 files changed, 5 insertions, 6 deletions
diff --git a/bootstrap/install b/bootstrap/install.sh
index 81829019..37a5e758 100755
--- a/bootstrap/install
+++ b/bootstrap/install.sh
@@ -99,9 +99,9 @@ case $result in
         msg "Great, select a host-config:"
         hosts=$(mktmp);
         host="";
-        awk -F "." '/nixosConfiguration/{print $2}' "$(tmp 'curl https://git.sils.li/ene/nixos-config/raw/branch/prime/flake.nix')" | awk '{print $1}' > $hosts;
+        awk -F "." '/nixosConfiguration/{print $2}' "$(tmp 'curl https://git.sils.li/ene/nixos-config/raw/branch/prime/flake.nix 2> /dev/null')" | awk '{print $1}' > $hosts;
 
-        while ! grep "$host" "$hosts" > /dev/null && [ "$host" == "" ]; do
+        while ! grep "$host" "$hosts" > /dev/null || [ "$(printf "%s" "$host" | wc -c)" -eq 0 ]; do
             i=1;
             while read -r ho ; do
                 printf "%4s) %s \n" "$i" "$ho";
@@ -110,10 +110,9 @@ case $result in
             printf "%4s) Exit\n" "q"
             readp  "Enter a option: " host
 
-            [ $host = "q" ] && exit 1
-            if grep "$host" "$hosts" > /dev/null && [ "$host" != "" ]; then
-                host=$(awk -v i="$host" '{if (NR==i) {print $0}}' "$hosts");
-            else
+            [ "$host" = "q" ] && exit 1
+            host=$(awk -v i="$host" '{if (NR==i) {print $0}}' "$hosts");
+            if ! grep "$host" "$hosts" > /dev/null || [ "$(printf "%s" "$host" | wc -c)" -eq 0 ]; then
                 warning "No host selected. Select a host to continue.\n"
             fi
         done