mirror of
https://git.myvelabs.com/lab/archlinux.git
synced 2025-12-17 21:26:25 +00:00
First commit
This commit is contained in:
commit
36ad41a2fc
18 changed files with 10005 additions and 0 deletions
67
installer.sh
Executable file
67
installer.sh
Executable file
|
|
@ -0,0 +1,67 @@
|
|||
#!/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
|
||||
Loading…
Add table
Add a link
Reference in a new issue