This commit is contained in:
Jeffrey Serio 2024-11-16 07:16:16 -06:00
parent f84590f9c7
commit 853798b07b

111
install.sh Normal file → Executable file
View File

@ -2,6 +2,9 @@
set -euo pipefail set -euo pipefail
GREEN='\033[1;32m'
NC='\033[0m'
packages=( packages=(
age age
atop atop
@ -14,6 +17,7 @@ packages=(
cmake cmake
curl curl
diff-so-fancy diff-so-fancy
direnv
duf duf
emacs emacs
ethtool ethtool
@ -43,6 +47,7 @@ packages=(
node-exporter node-exporter
nodejs nodejs
nu nu
parallel
pipx pipx
poetry poetry
python3-devel python3-devel
@ -84,7 +89,6 @@ pipx_packages=(
"bpython" "bpython"
"isort" "isort"
"pyright" "pyright"
"ansible --include-deps"
) )
services_enable=( services_enable=(
@ -100,6 +104,7 @@ services_enable=(
services_disable=( services_disable=(
avahi-daemon.service avahi-daemon.service
avahi-daemon.socket
bluetooth.service bluetooth.service
cups.service cups.service
cups-browsed.service cups-browsed.service
@ -108,46 +113,44 @@ services_disable=(
wpa_supplicant.service wpa_supplicant.service
) )
function install_packages() { function action_label() {
echo "" echo ""
echo "--> BEGIN INSTALLING PACKAGES..." echo -e "${GREEN}--> ${1}...${NC}"
}
function install_packages() {
action_label "INSTALLING PACKAGES"
sudo dnf install -y "${packages[@]}" sudo dnf install -y "${packages[@]}"
} }
function install_devel_groups() { function install_devel_groups() {
echo "" action_label "INSTALLING DEVELOPMENT GROUPS"
echo "--> INSTALLING DEVELOPMENT PACKAGE GROUPS..."
sudo dnf install -y '@c-development' '@development-tools' '@container-management' sudo dnf install -y '@c-development' '@development-tools' '@container-management'
} }
function enable_copr_repos() { function enable_copr_repos() {
echo "" action_label "ENABLING COPR REPOS"
echo "--> BEGIN ENABLING COPR REPOS..."
for repo in "${copr_repos[@]}"; do sudo dnf copr enable -y "$repo"; done for repo in "${copr_repos[@]}"; do sudo dnf copr enable -y "$repo"; done
} }
# Depends: enable_copr_repos # Depends: enable_copr_repos
function install_copr_packages() { function install_copr_packages() {
echo "" action_label "INSTALLING COPR PACKAGES"
echo "--> BEGIN INSTALLING COPR PACKAGES..."
sudo dnf install -y starship fontconfig-font-replacements yazi zellij sudo dnf install -y starship fontconfig-font-replacements yazi zellij
} }
function install_rpmfusion_repos() { function install_rpmfusion_repos() {
echo "" action_label "INSTALLING RPMFUSION REPOS"
echo "--> INSTALLING RPMFUSION REPOS..."
sudo dnf install -y "https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm" "https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm" sudo dnf install -y "https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm" "https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm"
} }
# Depends: install_rpmfusion_repos # Depends: install_rpmfusion_repos
function install_rpmfusion_packages() { function install_rpmfusion_packages() {
echo "" action_label "INSTALLING RPMFUSION PACKAGES"
echo "--> INSTALLING RPMFUSION PACKAGES..."
sudo dnf install -y --allowerasing ffmpeg-libs sudo dnf install -y --allowerasing ffmpeg-libs
} }
function install_charm_packages() { function install_charm_packages() {
echo "" action_label "INSTALLING CHARM PACKAGES"
echo "--> INSTALLING CHARM PACKAGES..."
echo '[charm] echo '[charm]
name=Charm name=Charm
baseurl=https://repo.charm.sh/yum/ baseurl=https://repo.charm.sh/yum/
@ -155,51 +158,40 @@ enabled=1
gpgcheck=1 gpgcheck=1
gpgkey=https://repo.charm.sh/yum/gpg.key' | sudo tee /etc/yum.repos.d/charm.repo gpgkey=https://repo.charm.sh/yum/gpg.key' | sudo tee /etc/yum.repos.d/charm.repo
sudo rpm --import https://repo.charm.sh/yum/gpg.key sudo rpm --import https://repo.charm.sh/yum/gpg.key
sudo dnf install -y gum sudo dnf install -y gum charm
} }
function install_tailscale() { function install_tailscale() {
echo "" action_label "INSTALLING TAILSCALE"
echo "--> INSTALLING TAILSCALE..."
curl -fsSL https://tailscale.com/install.sh | sh curl -fsSL https://tailscale.com/install.sh | sh
} }
# Depends: install_tailscale
function enable_tailscale() {
echo ""
echo "--> ENABLING TAILSCALE..."
sudo tailscale up
}
function enable_flathub() { function enable_flathub() {
echo "" action_label "ENABLING FLATHUB"
echo "--> ENABLING FLATHUB..."
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
} }
# Depends: enable_flathub # Depends: enable_flathub
function install_flatpaks() { function install_flatpaks() {
echo "" action_label "INSTALLING FLATPAKS"
echo "--> INSTALLING FLATPAKS..." for pkg in "${flatpak_packages[@]}"; do flatpak install flathub -y "$pkg"; done
for pkg in "${flatpak_packages[@]}"; do flatpak install -y "$pkg"; done
} }
# Depends: install_packages # Depends: install_packages
function install_pipx_packages() { function install_pipx_packages() {
echo "" action_label "INSTALLING PIPX PACKAGES"
echo "--> INSTALLING PIPX PACKAGES..."
for pkg in "${pipx_packages[@]}"; do pipx install "$pkg"; done for pkg in "${pipx_packages[@]}"; do pipx install "$pkg"; done
pipx install ansible --include-deps
} }
function setup_networkd_conf() { function setup_networkd_conf() {
echo "" action_label "SETTING UP SYSTEMD-NETWORKD CONFIG"
echo "--> SETTING UP SYSTEMD-NETWORKD CONFIG..."
echo '[Match] echo '[Match]
Name=eno1 Name=eno1
[Network] [Network]
DHCP=yes DHCP=yes
DNS=100.100.100.100 #DNS=100.100.100.100
DNSSEC=allow-downgrade DNSSEC=allow-downgrade
[DHCPv4] [DHCPv4]
@ -208,8 +200,7 @@ UseDNS=no' | sudo tee /etc/systemd/network/eno1.network
# After: setup_networkd_conf # After: setup_networkd_conf
function setup_resolv_conf() { function setup_resolv_conf() {
echo "" action_label "SETTING UP RESOLV CONF"
echo "--> SETTING UP RESOLV CONF..."
sudo rm -v /etc/resolv.conf sudo rm -v /etc/resolv.conf
sudo ln -sf /var/run/systemd/resolve/resolv.conf /etc/resolv.conf sudo ln -sf /var/run/systemd/resolve/resolv.conf /etc/resolv.conf
sudo systemctl restart systemd-resolved sudo systemctl restart systemd-resolved
@ -217,8 +208,7 @@ function setup_resolv_conf() {
# Depends: enable_tailscale # Depends: enable_tailscale
function setup_rsyslog_conf() { function setup_rsyslog_conf() {
echo "" action_label "SETTING UP RSYSLOG"
echo "--> SETTING UP RSYSLOG CONFIG..."
echo '# Forward to main monitoring node (nas.lyrebird-marlin.ts.net) echo '# Forward to main monitoring node (nas.lyrebird-marlin.ts.net)
*.* action(type="omfwd" target="100.112.241.12" port="514" protocol="tcp" *.* action(type="omfwd" target="100.112.241.12" port="514" protocol="tcp"
action.resumeRetryCount="100" action.resumeRetryCount="100"
@ -227,8 +217,7 @@ function setup_rsyslog_conf() {
# After: setup_networkd_conf # After: setup_networkd_conf
function disable_services() { function disable_services() {
echo "" action_label "DISABLING SYSTEMD SERVICES"
echo "--> DISABLING SYSTEMD SERVICES..."
for service in "${services_disable[@]}"; do sudo systemctl disable --now "$service"; done for service in "${services_disable[@]}"; do sudo systemctl disable --now "$service"; done
} }
@ -236,14 +225,12 @@ function disable_services() {
# - setup_networkd_conf # - setup_networkd_conf
# - install_packages # - install_packages
function enable_services() { function enable_services() {
echo "" action_label "ENABLING SYSTEMD SERVICES"
echo "--> ENABLING SYSTEMD SERVICES..."
for service in "${services_enable[@]}"; do sudo systemctl enable --now "$service"; done for service in "${services_enable[@]}"; do sudo systemctl enable --now "$service"; done
} }
function disable_ipv6() { function disable_ipv6() {
echo "" action_label "DISABLING IPV6"
echo "--> DISABLING IPV6..."
if ! sudo grep "ipv6.disable=1" /boot/grub2/grub.cfg; then if ! sudo grep "ipv6.disable=1" /boot/grub2/grub.cfg; then
sudo grubby --args=ipv6.disable=1 --update-kernel=ALL sudo grubby --args=ipv6.disable=1 --update-kernel=ALL
sudo grub2-mkconfig -o /boot/grub2/grub.cfg sudo grub2-mkconfig -o /boot/grub2/grub.cfg
@ -253,12 +240,11 @@ function disable_ipv6() {
} }
function setup_fstab() { function setup_fstab() {
echo "" action_label "SETTING UP /etc/fstab"
echo "--> SETTING UP FSTAB..." sudo mkdir -p /mnt/borgbackup /mnt/quick-backup
sudo mkdir /mnt/borgbackup /mnt/quick-backup
if ! grep "ecf44876-2e4e-46ad-9f12-fc516c8ace2d" /etc/fstab; then if ! grep "ecf44876-2e4e-46ad-9f12-fc516c8ace2d" /etc/fstab; then
echo "UUID=ecf44876-2e4e-46ad-9f12-fc516c8ace2d /mnt/borgbackup btrfs defaults,subvol=@borgbackup,compress=zstd:1,x-systemd.device-timeout=20 0 0" | sudo tee -a /etc/fstab echo "UUID=ecf44876-2e4e-46ad-9f12-fc516c8ace2d /mnt/borgbackup btrfs defaults,subvol=@borgbackup,compress=zstd:1,x-systemd.device-timeout=20 0 0" | sudo tee -a /etc/fstab
echo "UUID=ecf44876-2e4e-46ad-9f12-fc516c8ace2d /mnt/quick-backup btrfs defaults,suvol=@quick-backup,compress=zstd:1,x-systemd.device-timeout=20 0 0" | sudo tee -a /etc/fstab echo "UUID=ecf44876-2e4e-46ad-9f12-fc516c8ace2d /mnt/quick-backup btrfs defaults,subvol=@quick-backup,compress=zstd:1,x-systemd.device-timeout=20 0 0" | sudo tee -a /etc/fstab
else else
echo "/etc/fstab already configured." echo "/etc/fstab already configured."
fi fi
@ -272,9 +258,8 @@ function setup_fstab() {
# - install_packages # - install_packages
# - setup_fstab # - setup_fstab
function setup_borgmatic_config() { function setup_borgmatic_config() {
echo "" action_label "SETTING UP BORGMATIC CONFIG"
echo "--> SETTING UP BORGMATIC CONFIG..." sudo mkdir -p /etc/borgmatic
sudo mkdir /etc/borgmatic
sudo cp -v /mnt/quick-backup/borgmatic-config.yaml /etc/borgmatic/config.yaml sudo cp -v /mnt/quick-backup/borgmatic-config.yaml /etc/borgmatic/config.yaml
} }
@ -282,29 +267,25 @@ function setup_borgmatic_config() {
# - install_packages # - install_packages
# - setup_fstab # - setup_fstab
function copy_quick_backup() { function copy_quick_backup() {
echo "" action_label "COPYING QUICK BACKUP"
echo "--> COPYING QUICK BACKUP..."
rsync -aAXPz /mnt/quick-backup/jas/ /home/jas rsync -aAXPz /mnt/quick-backup/jas/ /home/jas
} }
# Depends: copy_quick_backup # Depends: copy_quick_backup
function build_bat_cache() { function build_bat_cache() {
echo "" action_label "BUILDING BAT CACHE"
echo "--> BUILDING BAT CACHE..."
bat cache --build bat cache --build
} }
# Depends: install_packages # Depends: install_packages
function update_tealdeer_cache() { function update_tealdeer_cache() {
echo "" action_label "UPDATING TEALDEER CACHE"
echo "--> UPDATING TEALDEER CACHE..."
tldr --update tldr --update
} }
# Depends: enable_tailscale # Depends: install_tailscale
function setup_firewalld() { function setup_firewalld() {
echo "" action_label "SETTING UP FIREWALLD"
echo "--> SETTING UP FIREWALLD..."
if ! sudo firewall-cmd --get-zones | grep "tailnet"; then if ! sudo firewall-cmd --get-zones | grep "tailnet"; then
sudo firewall-cmd --permanent --new-zone=tailnet sudo firewall-cmd --permanent --new-zone=tailnet
sudo firewall-cmd --permanent --zone=tailnet --add-interface=tailscale0 sudo firewall-cmd --permanent --zone=tailnet --add-interface=tailscale0
@ -319,15 +300,14 @@ function setup_firewalld() {
} }
function install_rclone() { function install_rclone() {
echo "" action_label "INSTALLING LATEST RCLONE"
echo "--> INSTALLING LATEST RCLONE..."
sudo -v
curl https://rclone.org/install.sh | sudo bash curl https://rclone.org/install.sh | sudo bash
command -v rclone command -v rclone
} }
# Depends: install_rclone copy_quick_backup # Depends: install_rclone copy_quick_backup
function enable_sync_to_remotes() { function enable_sync_to_remotes() {
action_label "ENABLING sync_to_remotes.timer"
systemctl --user enable --now sync_to_remotes.timer systemctl --user enable --now sync_to_remotes.timer
} }
@ -339,7 +319,6 @@ install_rpmfusion_repos
install_rpmfusion_packages install_rpmfusion_packages
install_charm_packages install_charm_packages
install_tailscale install_tailscale
enable_tailscale
enable_flathub enable_flathub
install_flatpaks install_flatpaks
install_pipx_packages install_pipx_packages
@ -357,3 +336,5 @@ update_tealdeer_cache
setup_firewalld setup_firewalld
install_rclone install_rclone
enable_sync_to_remotes enable_sync_to_remotes
action_label "DONE SETTING UP ALL THE THINGS ^_^"