homelab/scripts/base/script.sh

41 lines
813 B
Bash
Raw Normal View History

2022-12-31 14:19:03 +01:00
#!/bin/bash
set -euo pipefail;
source "$HL_LIB";
2022-12-31 14:35:19 +01:00
_assert_vars HL_TIMEZONE;
2022-12-31 14:19:03 +01:00
# update and install dependencies
_ch_001-install() {
sudo apt-get update;
sudo apt-get upgrade;
sudo apt-get install -y docker docker-compose screenfetch vim;
}
# give myself docker privileges
_ch_002-usermod() {
sudo usermod -aG docker $USER;
# a bit of a hack, mark this checkpoint as completed but exit execution
echo "_ch_002-usermod" >> run.checkpoints
_err "please relogin"
}
# create data folder with correct perms
_ch_003-datafolder() {
sudo mkdir -p /data;
sudo chgrp $USER /data;
sudo chmod g+w /data;
}
_ch_004-firewall() {
sudo apt-get install -y ufw;
sudo ufw allow 22;
}
2022-12-31 14:35:19 +01:00
_ch_005-set_timezone() {
sudo timedatectl set-timezone "$HL_TIMEZONE";
}
2022-12-31 14:19:03 +01:00
_run_checkpoints;