emacs-survey-server/setup.sh

27 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env sh
if ! rpm -q caddy > /dev/null; then
echo -e "\e[1;34mInstalling Caddy\e[m"
# Taken from <https://caddyserver.com/docs/install#debian-ubuntu-raspbian>
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy
fi
JULIA_VERSION="1.8.2"
if ! command -v julia > /dev/null || [ ! $(julia --version) = "julia version $JULIA_VERSION" ]; then
echo -e "\e[1;34mInstalling Julia\e[m"
pushd /tmp > /dev/null
# Following <https://julialang.org/downloads/platform/>
wget "https://julialang-s3.julialang.org/bin/linux/x64/${JULIA_VERSION%.*}/julia-$JULIA_VERSION-linux-x86_64.tar.gz"
mkdir -p "/opt/julia/"
tar zxvf "julia-$JULIA_VERSION-linux-x86_64.tar.gz" --directory=/opt/julia
ln -sf "/opt/julia/julia-$JULIA_VERSION/bin/julia" /usr/bin/julia
fi
SETUPDIR=$(dirname "$(readlink --canonicalize-existing "$0")")
cp -f "$SETUPDIR/Caddyfile" "/etc/caddy/Caddyfile"