#!/bin/bash set -e # ===================================================================== # ✠ In the Name of the Omnissiah ✠ # Rite of Network Sanctification # This script forges SMB daemons to guard the sacred data vaults. # Let no heresy dwell within these parameters. # ===================================================================== # === CONFIGURATION SIGILS === USER="aetos" # Bearer of the Emperor's Sigil SHARES=( "/mnt/omnissiah-vault:Omnissiah-Vault" # 7.3TB Holy Vault of Media Relics "/mnt/machine-spirit:Machine-Spirit" # 931GB Machine Spirit for DBs ) # === INSTALLATION OF HOLY DAEMONS === echo "[*] Installing Samba daemons — awaken smbd & nmbd..." if command -v apt >/dev/null 2>&1; then sudo apt update sudo apt install -y samba elif command -v dnf >/dev/null 2>&1; then sudo dnf install -y samba else echo "Unsupported package manager. Manual rites required." exit 1 fi # === CONSECRATION OF STORAGE SHRINES === echo "[*] Consecrating vault directories for Emperor’s work..." for entry in "${SHARES[@]}"; do DIR="${entry%%:*}" sudo mkdir -p "$DIR" sudo chown -R "$USER:$USER" "$DIR" done # === SMB.CONF SCRIPTURES === echo "[*] Backing up smb.conf — preserve the old texts of Mars..." sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak.$(date +%F-%H%M%S) # Purge traces of past heresies (incorrect configs) sudo sed -i '/# Omnissiah Vault/,/^\[/d' /etc/samba/smb.conf || true sudo sed -i '/# Machine Spirit/,/^\[/d' /etc/samba/smb.conf || true # Inscribe new holy shares into smb.conf for entry in "${SHARES[@]}"; do DIR="${entry%%:*}" NAME="${entry##*:}" sudo tee -a /etc/samba/smb.conf >/dev/null </dev/null 2>&1; then sudo ufw allow samba elif command -v firewall-cmd >/dev/null 2>&1; then sudo firewall-cmd --permanent --add-service=samba sudo firewall-cmd --reload else echo "[!] No firewall rites detected — proceed with caution, Acolyte." fi # === FINAL BLESSING === echo "[*] Network sanctification complete!" echo "Invoke thus from clients:" echo " smb:///Omnissiah-Vault" echo " smb:///Machine-Spirit" echo echo "✠ May the Emperor and the Omnissiah guard these shares. ✠"