#!/usr/bin/env bash download_url=git.myvelabs.com/lab/archlinux/raw/branch/master # Detect network connectivity if ! nc -z -w 1 archlinux.org 443 >/dev/null 2>&1 || ! nc -z -w 1 google.com 443 >/dev/null 2>&1 then echo -e '\n\t\e[31mNo internet connection detected\e[0m\n' exit 1 fi # Function to list available script options function listScripts { echo -e '\n\e[1;36mSelect a script to run\e[0m 1) Arch Linux 2) Arch Linux VM 3) Arch Linux Passthrough 4) Arch Linux Server 5) Recovery' while true do read -n 1 -p '> ' script_selection case ${script_selection} in 1) script=arch break;; 2) script=virtual-machine break;; 3) script=passthrough break;; 4) script=homelab break;; 5) script=recover break;; *) echo -e '\n\n\e[1;31mInvalid selection, type an option from 1 to 5\e[0m' ;; esac done echo } # Detect script choice case ${1} in arch) script=arch ;; vm|virtual-machine) script=virtual-machine ;; passthrough) script=passthrough ;; server|homelab) script=homelab ;; recover) script=recover ;; *) listScripts ;; esac # Run script if successful, abort installer otherwise if curl --fail -s -L https://${download_url}/${script}.sh -o ./arch then /usr/bin/bash ./arch "${@:2}" exit 0 else echo -e '\e[31mInvalid script or server may be offline, make another selection or try again later\e[0m\n' exit 1 fi