2024-08-19 22:12:48 +02:00
|
|
|
## Justfile (https://github.com/casey/justfile)
|
|
|
|
##
|
|
|
|
## Helps automate various homelab tasks.
|
|
|
|
|
2024-09-23 23:59:45 +02:00
|
|
|
set export
|
2024-08-19 22:12:48 +02:00
|
|
|
distro := `grep -G "\bID\b" /etc/os-release | awk -F= '{print $2}'`
|
2024-09-23 23:59:45 +02:00
|
|
|
id_like := `grep -G "\bID_LIKE\b" /etc/os-release | awk -F= '{print $2}'`
|
2024-08-19 22:12:48 +02:00
|
|
|
release := `grep "VERSION_CODENAME" /etc/os-release | awk -F= '{print $2}'`
|
|
|
|
run_user := env_var("USER")
|
|
|
|
|
|
|
|
caddy:
|
2024-09-23 23:59:45 +02:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
if [ "$distro" == "debian" ]; then
|
|
|
|
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
|
|
|
|
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
|
|
|
|
elif echo "$id_like" | grep "rhel"; then
|
|
|
|
sudo dnf install -y 'dnf-command(copr)'
|
|
|
|
sudo dnf copr enable -y @caddy/caddy
|
|
|
|
sudo dnf install -y caddy
|
|
|
|
elif [ "$distro" == "freebsd" ]; then
|
|
|
|
sudo pkg install -y caddy
|
|
|
|
fi
|
2024-08-19 22:12:48 +02:00
|
|
|
|
|
|
|
thelounge:
|
2024-09-23 23:59:45 +02:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
if [ "$distro" == "debian" ]; then
|
|
|
|
curl -s https://api.github.com/repos/thelounge/thelounge-deb/releases/latest | grep "browser_download_url.*deb" | cut -d : -f 2,3 | tr -d '"' | wget -qi -
|
|
|
|
sudo apt install -y ./thelounge*.deb
|
|
|
|
rm -fv ./thelounge*.deb
|
|
|
|
else
|
|
|
|
echo "This justfile only supports The Lounge on Debian systems."
|
|
|
|
fi
|
2024-08-19 22:12:48 +02:00
|
|
|
|
|
|
|
tailscale:
|
|
|
|
curl -fsSL https://tailscale.com/install.sh | sh
|
|
|
|
sudo tailscale up
|
|
|
|
|
|
|
|
scihub:
|
|
|
|
mkdir ~/scihub-torrent-urls
|
|
|
|
lynx -dump -nonumbers -listonly=on https://libgen.rs/repository_torrent/ | grep "\.torrent" | tee ~/scihub-torrent-urls/urls.txt
|
|
|
|
cd ~/scihub-torrent-urls && split -l 60 ~/scihub-torrent-urls/urls.txt torrent-
|
|
|
|
rm -fv ~/scihub-torrent-urls/urls.txt
|
|
|
|
|
|
|
|
docker:
|
2024-09-23 23:59:45 +02:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
if [ "$distro" == "debian" ]; then
|
|
|
|
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt remove $pkg; done
|
|
|
|
sudo apt update
|
|
|
|
sudo apt install -y ca-certificates curl
|
|
|
|
sudo install -m 0755 -d /etc/apt/keyrings
|
|
|
|
sudo curl -fsSL https://download.docker.com/linux/{{distro}}/gpg -o /etc/apt/keyrings/docker.asc
|
|
|
|
sudo chmod a+r /etc/apt/keyrings/docker.asc
|
|
|
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/{{distro}} {{release}} stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
|
|
|
sudo apt update
|
|
|
|
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose docker-compose-plugin
|
|
|
|
sudo systemctl enable --now docker.service
|
|
|
|
sudo usermod -aG docker {{run_user}}
|
|
|
|
else
|
|
|
|
echo "This justfile only supports Docker on Debian systems."
|
|
|
|
fi
|
2024-08-19 22:12:48 +02:00
|
|
|
|
|
|
|
rustup:
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
|
|
|
|
|
|
neovim:
|
|
|
|
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
|
|
|
|
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
|
|
|
|
|
|
|
mkdir -p "${HOME}/.config/nvim"
|
2024-09-23 23:59:45 +02:00
|
|
|
wget https://files.hyperreal.coffee/init.vim -O "${HOME}/.config/nvim/init.vim"
|
2024-08-19 22:12:48 +02:00
|
|
|
|
|
|
|
neovim-root:
|
|
|
|
sudo sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
|
|
|
|
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
|
|
|
|
|
|
|
sudo mkdir -p /root/.config/nvim
|
2024-09-23 23:59:45 +02:00
|
|
|
sudo wget https://files.hyperreal.coffee/init.vim -O /root/.config/nvim/init.vim
|