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