Skip to content

Instantly share code, notes, and snippets.

@codehz
Last active July 22, 2019 02:32
Show Gist options
  • Save codehz/1fe7a3ebd1a780d8cd6f08377561ea57 to your computer and use it in GitHub Desktop.
Save codehz/1fe7a3ebd1a780d8cd6f08377561ea57 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -euo pipefail
url_cobblestone="https://hertz.services/docker/codehz/cobblestone/0"
url_bds="https://hertz.services/docker/codehz/bds/0"
url_nsgod="https://hertz.services/github/codehz/nsgod/latest/nsgod"
mkdir -p .cobblestone/{core,game}
tempdir=$(mktemp -d)
echo "[+] created temp directory: ${tempdir}"
dialog="dialog"
if ! [ -x "$(command -v dialog)" ]; then
dialog=whiptail
fi
cmd=($dialog --separate-output --checklist "Select options:" 11 60 5)
options=(1 "install nsgod" on # any option can be set to default to "on"
2 "install cobblestone" on
3 "install bds" on)
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
clear
for choice in $choices; do
case $choice in
1)
echo "[=] downloading nsgod"
wget -O ".cobblestone/nsgod" ${url_nsgod}
chmod +x .cobblestone/nsgod
;;
2)
echo "[=] downloading cobblestone"
wget -O "${tempdir}/cobblestone.tar.gz" ${url_cobblestone}
echo "[=] extracting cobblestone"
tar xvf "${tempdir}/cobblestone.tar.gz" -C .cobblestone/core
;;
3)
echo "[=] downloading bds"
wget -O "${tempdir}/bds.tar.gz" ${url_bds}
echo "[=] extracting bds"
tar xvf "${tempdir}/bds.tar.gz" -C .cobblestone/game
;;
esac
done
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment