homelab/scripts/jellyfin/script.sh

45 lines
1.4 KiB
Bash
Raw Normal View History

2022-12-31 14:19:03 +01:00
#!/bin/bash
set -euo pipefail
source "$HL_LIB"
_assert_vars HL_DOMAIN;
_ch_001-install_nvidia_drivers() {
sudo apt-get install -y nvidia-driver-515-server
echo "_ch_001-install_nvidia_drivers" >> run.checkpoints
_err "installed nvidia drivers; please reboot"
}
_ch_002-install_nvidia_containers() {
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
&& curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
sudo apt-get install -y nvidia-docker2
sudo systemctl restart docker
}
_ch_003-make_dirs() {
mkdir -p ~/jellyfin /data/jellyfin;
}
_ch_004-copy_compose() {
cp $(_fill docker-compose.yml.templ) ~/jellyfin/docker-compose.yml;
}
_ch_005-update_caddy() {
cp $(_fill Caddyfile.templ) /etc/caddy/conf.d/jellyfin.Caddyfile;
chmod a+r /etc/caddy/conf.d/jellyfin.Caddyfile;
sudo systemctl reload caddy.service;
}
_ch_006-run-service() {
cd ~/jellyfin;
docker-compose up -d;
}
_run_checkpoints