mirror of
https://codeberg.org/hyperreal/admin-scripts
synced 2024-11-01 16:03:06 +01:00
138 lines
5.1 KiB
Makefile
138 lines
5.1 KiB
Makefile
## Justfile (https://github.com/casey/justfile)
|
|
##
|
|
## Helps automate various homelab tasks.
|
|
|
|
distro := `grep -G "\bID\b" /etc/os-release | awk -F= '{print $2}'`
|
|
release := `grep "VERSION_CODENAME" /etc/os-release | awk -F= '{print $2}'`
|
|
run_user := env_var("USER")
|
|
|
|
default: common
|
|
|
|
common:
|
|
sudo apt update -t {{release}}-backports
|
|
sudo apt dist-upgrade -y -t {{release}}-backports
|
|
sudo apt install -y -t {{release}}-backports \
|
|
apt-file \
|
|
apt-listchanges \
|
|
apt-transport-https \
|
|
apt-utils \
|
|
atop \
|
|
autoconf \
|
|
automake \
|
|
build-essential \
|
|
byobu \
|
|
cmake \
|
|
curl \
|
|
firewalld \
|
|
git \
|
|
htop \
|
|
ifplugd \
|
|
iotop \
|
|
less \
|
|
libpam-systemd \
|
|
lynis \
|
|
man-db \
|
|
manpages \
|
|
neovim \
|
|
nfs-common \
|
|
nmon \
|
|
pipx \
|
|
python3-dev \
|
|
python3-pip \
|
|
rclone \
|
|
rsync \
|
|
unattended-upgrades \
|
|
wget \
|
|
zsh
|
|
sudo systemctl enable man-db.timer
|
|
pipx install glances
|
|
pipx install gmcapsule
|
|
|
|
copy:
|
|
find "${PWD}/bin" -maxdepth 1 -type f -exec sudo cp -fv {} /usr/local/bin \;
|
|
find "${PWD}/systemd/system" -maxdepth 1 -type f -exec sudo cp -fv {} /etc/systemd/system \;
|
|
mkdir -p "${HOME}/.config/systemd/user"
|
|
find "${PWD}/systemd/user" -maxdepth 1 -type f -exec cp -fv {} "${HOME}/.config/systemd/user" \;
|
|
|
|
cleanup:
|
|
sudo find /usr/local/bin -type f -delete
|
|
for item in "$(ls "${PWD}/systemd/system")"; do sudo rm -fv "/etc/systemd/system/$item"; done
|
|
for item in "$(ls "${PWD}/systemd/user")"; do rm -fv "${HOME}/.config/systemd/user/$item"; done
|
|
|
|
caddy-install:
|
|
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
|
|
|
|
thelounge-install:
|
|
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
|
|
|
|
tailscale-install:
|
|
curl -fsSL https://tailscale.com/install.sh | sh
|
|
sudo tailscale up
|
|
|
|
scihub-setup:
|
|
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-install:
|
|
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}}
|
|
|
|
rustup:
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
|
|
rustup-root:
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sudo sh
|
|
|
|
rust-tools:
|
|
source "${HOME}/.cargo/env"
|
|
cargo install cargo-binstall
|
|
for pkg in "arp-scan" "bandwhich" "bat" "diskonaut" "du-dust" "fblog" "fd" "hyperfine" "procs" "ripgrep" "skim"; do \
|
|
cargo-binstall -y "$pkg"; \
|
|
done
|
|
|
|
rust-tools-root:
|
|
sudo /root/.cargo/bin/cargo install cargo-binstall
|
|
for pkg in "arp-scan" "bandwhich" "bat" "diskonaut" "du-dust" "fblog" "fd-find" "hyperfine" "procs" "ripgrep" "skim"; do \
|
|
sudo /root/.cargo/bin/cargo-binstall -y "$pkg"; \
|
|
done
|
|
echo 'source "${HOME}/.cargo/env"' | sudo tee -a /root/.bashrc
|
|
echo 'source "${HOME}/.cargo/env"' | sudo tee -a /root/.zshrc
|
|
|
|
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"
|
|
wget https://cdn.hyperreal.coffee/init.vim -O "${HOME}/.config/nvim/init.vim"
|
|
|
|
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
|
|
sudo wget https://cdn.hyperreal.coffee/init.vim -O /root/.config/nvim/init.vim
|
|
|
|
zshrc:
|
|
sudo wget https://cdn.hyperreal.coffee/zshrc -O /etc/zsh/zshrc
|
|
touch "${HOME}/.zshrc"
|
|
sudo touch /root/.zshrc
|