From 2e36a3ecabbbd48727a881e11215bba7e596d899 Mon Sep 17 00:00:00 2001 From: Aetos Skia Date: Sun, 21 Sep 2025 18:54:38 +0530 Subject: [PATCH] namo amida butsu --- bind-machine-spirits.sh | 147 +++++++++++++++++++++++++++++++++++ bind-spirit-callers.sh | 44 +++++++++++ bind-spirit-holders.sh | 42 ++++++++++ bind-vox-spirit.sh | 49 ++++++++++++ drive-exterminatus-ritual.sh | 58 ++++++++++++++ purge-heretic-folders.sh | 35 +++++++++ sanctify-network-share.sh | 99 +++++++++++++++++++++++ 7 files changed, 474 insertions(+) create mode 100755 bind-machine-spirits.sh create mode 100755 bind-spirit-callers.sh create mode 100755 bind-spirit-holders.sh create mode 100755 bind-vox-spirit.sh create mode 100755 drive-exterminatus-ritual.sh create mode 100755 purge-heretic-folders.sh create mode 100755 sanctify-network-share.sh diff --git a/bind-machine-spirits.sh b/bind-machine-spirits.sh new file mode 100755 index 0000000..9c42cd3 --- /dev/null +++ b/bind-machine-spirits.sh @@ -0,0 +1,147 @@ +#!/bin/bash + +# Sacred Drive Mounting Ritual for the Raspberry Pi Shrine +# May the Omnissiah bless this automaton script +# For the Emperor and the Machine God! + +echo "==========================================" +echo " SACRED DRIVE MOUNTING RITUAL INITIATED " +echo " In the name of the Omnissiah we bind " +echo " the Machine Spirits to our will " +echo "==========================================" +echo + +# Check if running as root +if [ "$EUID" -ne 0 ]; then + echo "ERROR: This sacred ritual requires root privileges!" + echo "Execute with: sudo bash bind-machine-spirits.sh" + exit 1 +fi + +echo "πŸ”± Phase 1: Invoking the Machine Spirit's blessing..." +sleep 1 + +# Install NTFS support if not present +echo "πŸ“¦ Ensuring NTFS-3G drivers are blessed by the Omnissiah..." +apt update -qq +apt install -y ntfs-3g + +echo "πŸ› οΈ Phase 2: Creating sacred mount points..." + +# Create mount directories +mkdir -p /mnt/omnissiah-vault +mkdir -p /mnt/machine-spirit + +# Set proper ownership +chown $AETOS_UID:$AETOS_GID /mnt/omnissiah-vault +chown $AETOS_UID:$AETOS_GID /mnt/machine-spirit + +echo "βœ… Sacred directories created:" +echo " πŸ—‚οΈ /mnt/omnissiah-vault (for the great data hoard)" +echo " 🧠 /mnt/machine-spirit (for system consciousness)" +echo + +echo "πŸ’Ύ Phase 3: Backing up the sacred fstab codex..." + +# Backup fstab +cp /etc/fstab /etc/fstab.backup.$(date +%Y%m%d_%H%M%S) +echo "βœ… Backup created: /etc/fstab.backup.$(date +%Y%m%d_%H%M%S)" +echo + +echo "πŸ“œ Phase 4: Inscribing the binding runes into fstab..." + +# Get dynamic values blessed by the Omnissiah +AETOS_UID=$(id -u aetos) +AETOS_GID=$(id -g aetos) + +echo "πŸ” Divine revelation of user identities:" +echo " aetos UID: $AETOS_UID" +echo " aetos GID: $AETOS_GID" + +# Check if entries already exist +if grep -q "omnissiah-vault\|machine-spirit" /etc/fstab; then + echo "⚠️ WARNING: Sacred bindings already detected in fstab!" + echo " Skipping fstab modification to prevent corruption..." +else + # Add mount entries to fstab + cat >> /etc/fstab << EOF + +# Sacred Drive Bindings - Blessed by the Omnissiah +# 7.3TB Omnissiah's Vault - Mass Storage for Movies & Media (sda2) +UUID=C678E33A78E3283F /mnt/omnissiah-vault ntfs-3g defaults,nofail,uid=${AETOS_UID},gid=${AETOS_GID},umask=022,x-systemd.automount,x-systemd.device-timeout=30s 0 0 + +# 931.5GB Machine Spirit - System Data, Configs, DB & Metadata (sdb3) +UUID=203E29533E292370 /mnt/machine-spirit ntfs-3g defaults,nofail,uid=${AETOS_UID},gid=${AETOS_GID},umask=022,x-systemd.automount,x-systemd.device-timeout=30s 0 0 + +EOF + + echo "βœ… Sacred bindings inscribed successfully!" +fi + +echo "⚑ Phase 5: Awakening the Machine Spirits..." + +# Reload systemd to acknowledge the sacred changes +echo "πŸ”„ Reloading systemd daemon to acknowledge the new bindings..." +systemctl daemon-reload + +# Test mount all +if mount -a; then + echo "βœ… All Machine Spirits have awakened successfully!" +else + echo "❌ ERROR: Some Machine Spirits resist binding!" + echo " Check the sacred logs for heretical errors..." + exit 1 +fi + +echo +echo "πŸ” Phase 6: Verifying the sacred bindings..." + +# Check if drives are mounted +echo "Current mount status:" +df -h | grep -E "(omnissiah-vault|machine-spirit)" || echo " Drives not yet manifested in the material realm..." + +echo +echo "πŸ“ Phase 7: Blessing the directory structure..." + +# Create useful subdirectories +if mountpoint -q /mnt/omnissiah-vault; then + mkdir -p /mnt/omnissiah-vault/{movies,tv-shows,documentaries,archives,media} + chown -R $AETOS_UID:$AETOS_GID /mnt/omnissiah-vault + echo "βœ… Omnissiah's Vault directory structure blessed" +fi + +if mountpoint -q /mnt/machine-spirit; then + mkdir -p /mnt/machine-spirit/{configs,databases,metadata,logs,backups,system} + chown -R $AETOS_UID:$AETOS_GID /mnt/machine-spirit + echo "βœ… Machine Spirit directory structure blessed" +fi + +echo +echo "==========================================" +echo " SACRED RITUAL COMPLETED! " +echo "==========================================" +echo "πŸ”± The Machine Spirits are bound!" +echo "πŸ“ Omnissiah's Vault: /mnt/omnissiah-vault" +echo "🧠 Machine Spirit: /mnt/machine-spirit" +echo +echo "The Emperor protects your data!" +echo "May your storage serve the Imperium well!" +echo "==========================================" + +# Final verification +echo +echo "πŸ”§ Final Systems Check:" +echo "Mounted filesystems:" +mount | grep -E "(omnissiah-vault|machine-spirit)" | sed 's/^/ /' + +echo +echo "Storage capacity report:" +df -h | grep -E "(omnissiah-vault|machine-spirit)" | sed 's/^/ /' + +echo +echo "Directory permissions:" +ls -la /mnt/ | grep -E "(omnissiah-vault|machine-spirit)" | sed 's/^/ /' + +echo +echo "πŸŽ‰ Ritual complete! Reboot to test automatic mounting." +echo " To verify: sudo reboot && df -h" diff --git a/bind-spirit-callers.sh b/bind-spirit-callers.sh new file mode 100755 index 0000000..40a344d --- /dev/null +++ b/bind-spirit-callers.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# Update and upgrade system packages +echo "Updating system packages..." +sudo apt update +sudo apt full-upgrade -y + +# Install qbittorrent-nox (headless version) +echo "Installing qBittorrent-nox..." +sudo apt install -y qbittorrent-nox + +# Create a system user for qBittorrent (optional but recommended) +echo "Creating qBittorrent user..." +sudo useradd -r -m qbt + +# Add your normal user (pi) to the qbt group to access downloaded files +sudo usermod -a -G qbt $USER + +# Create systemd service file for qBittorrent +echo "Creating systemd service file..." +sudo tee /etc/systemd/system/qbittorrent-nox.service > /dev/null <:8080" +echo "Default credentials: username: admin, password: adminadmin" +echo "It's highly recommended to change the default login credentials in the Web UI." diff --git a/bind-spirit-holders.sh b/bind-spirit-holders.sh new file mode 100755 index 0000000..918ee0d --- /dev/null +++ b/bind-spirit-holders.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Update and upgrade system packages +echo "Updating system packages..." +sudo apt-get update +sudo apt-get upgrade -y + +# Remove old Docker versions if any +echo "Removing old Docker versions..." +for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do + sudo apt-get remove -y $pkg +done + +# Install prerequisites for Docker Compose +echo "Installing prerequisites for Docker Compose..." +sudo apt-get install -y libffi-dev libssl-dev python3 python3-pip + +# Install Docker using the official convenience script +echo "Installing Docker..." +curl -fsSL https://get.docker.com -o get-docker.sh +sudo sh get-docker.sh + +# Add current user to the Docker group +echo "Adding user to docker group..." +sudo usermod -aG docker $USER + +# Enable and start Docker service +echo "Enabling and starting Docker service..." +sudo systemctl enable docker +sudo systemctl start docker + +# Install Docker Compose +echo "Installing Docker Compose..." +sudo pip3 install docker-compose + +# Verify Docker and Docker Compose versions +echo "Docker version:" +docker --version +echo "Docker Compose version:" +docker-compose --version + +echo "Installation complete. Please reboot your Raspberry Pi." diff --git a/bind-vox-spirit.sh b/bind-vox-spirit.sh new file mode 100755 index 0000000..cc0a068 --- /dev/null +++ b/bind-vox-spirit.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +# Define your custom Plex config directory +CUSTOM_PLEX_CONFIG="/mnt/machine-spirit/configs/plex" + +# Update and upgrade system packages +echo "Updating system packages..." +sudo apt update +sudo apt full-upgrade -y + +# Install prerequisites +echo "Installing prerequisites..." +sudo apt install -y apt-transport-https curl + +# Add Plex official repository GPG key and repo +echo "Adding Plex repository..." +curl https://downloads.plex.tv/plex-keys/PlexSign.key | gpg --dearmor | sudo tee /usr/share/keyrings/plex-archive-keyring.gpg > /dev/null + +echo "deb [signed-by=/usr/share/keyrings/plex-archive-keyring.gpg] https://downloads.plex.tv/repo/deb public main" | sudo tee /etc/apt/sources.list.d/plexmediaserver.list + +# Update package lists with Plex repo +sudo apt update + +# Install Plex Media Server +echo "Installing Plex Media Server..." +sudo apt install -y plexmediaserver + +# Stop Plex service before moving config +sudo systemctl stop plexmediaserver + +# Move current Plex config to custom location +echo "Moving Plex config to custom directory..." +sudo rsync -av /var/lib/plexmediaserver/ "$CUSTOM_PLEX_CONFIG"/ + +# Backup and remove existing config directory and create symlink +echo "Setting up symlink from default location to custom config path..." +sudo mv /var/lib/plexmediaserver /var/lib/plexmediaserver.bak +sudo ln -s "$CUSTOM_PLEX_CONFIG" /var/lib/plexmediaserver + +# Set correct permissions +echo "Setting permissions for Plex user on custom directory..." +sudo chown -R plex:plex "$CUSTOM_PLEX_CONFIG" + +# Start Plex service +sudo systemctl start plexmediaserver +sudo systemctl enable plexmediaserver + +echo "Plex Media Server installation complete." +echo "Access the Plex Web UI at http://:32400/web" diff --git a/drive-exterminatus-ritual.sh b/drive-exterminatus-ritual.sh new file mode 100755 index 0000000..f62ab28 --- /dev/null +++ b/drive-exterminatus-ritual.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# ====================================================== +# >>> EXTERMINATUS RITUAL v3 <<< +# In the name of the Omnissiah, this script PURGES +# a selected mounted drive. +# ALL DATA ON THE DRIVE WILL BE LOST FOREVER. +# ====================================================== + +# Step 1: List mounted drives (skip root "/") +echo ">> Machine Spirit Survey: Listing mounted drives..." +echo +mount | grep "^/dev/" | grep -v "on / " | nl -w2 -s'. ' +echo +read -r -p "Select the drive number to invoke Exterminatus: " CHOICE + +# Step 2: Extract DEVICE and MOUNTPOINT +SELECTED=$(mount | grep "^/dev/" | grep -v "on / " | sed -n "${CHOICE}p") +DEVICE=$(echo "$SELECTED" | awk '{print $1}') +MOUNTPOINT=$(echo "$SELECTED" | awk '{print $3}') + +if [ -z "$DEVICE" ] || [ -z "$MOUNTPOINT" ]; then + echo "!! Invalid selection. Ritual aborted." + exit 1 +fi + +# Step 3: Confirm with user +echo "⚠️ WARNING! You have chosen:" +echo " DEVICE: $DEVICE" +echo " MOUNT : $MOUNTPOINT" +echo "All data will be purged beyond recovery." +read -r -p "Do you invoke Exterminatus on this drive? (type YES): " CONFIRM + +if [ "$CONFIRM" != "YES" ]; then + echo "Exterminatus aborted. The Machine Spirit whispers relief." + exit 1 +fi + +echo ">> Stopping Share in the name of Emperor and Omnissiah..." +sudo systemctl stop smbd nmbd + +# Step 4: Begin purge +echo ">> Unmounting $MOUNTPOINT..." +sudo umount -f "$MOUNTPOINT" || { echo "!! Failed to unmount. Aborting."; exit 1; } + +echo ">> Purging file allocation tables..." +sudo mkfs.ntfs -f -L "Cleansed_Vault" "$DEVICE" || { echo "!! mkfs.ntfs failed. Aborting."; exit 1; } + +echo ">> Recreating mount point..." +sudo mkdir -p "$MOUNTPOINT" + +echo ">> Remounting cleansed Vault..." +sudo mount -t ntfs-3g "$DEVICE" "$MOUNTPOINT" + +echo ">> The Exterminatus is complete. The Vault has been reforged." + +echo ">> Starting the share in the name of Emperor and Omnissiah..." +sudo systemctl start smbd nmbd + diff --git a/purge-heretic-folders.sh b/purge-heretic-folders.sh new file mode 100755 index 0000000..0e41843 --- /dev/null +++ b/purge-heretic-folders.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# ================================ +# Purge Ritual of the Omnissiah +# Cleans corrupted folders from the Vault +# ================================ + +MOUNT="/mnt/omnissiah-vault" + +# Folders to purge (add more if needed) +TARGETS=( +"$MOUNT/Media/Movies/Legend.2015.1080p.BRRip.x264.AAC.ETRG" +"$MOUNT/Media/Movies/Naruto.OVA.Episodes.1.4" +"$MOUNT/Media/Movies/Swatantrya Veer Savarkar (2024) Hindi 1080p 10Bit ZEE5 WEB-DL DDP.ATMOS.5.1 HEVC x265 ESub-Telly [ProtonMovies]" +"$MOUNT/Media/Movies/XXX_to_be_deleted_001/www.YTS.AM.jpg" +"$MOUNT/Media/TV Shows/G.I.Joe/Season.2" +"$MOUNT/Media/TV Shows/www.Torrenting.com.Paatal.Lok.S02E07.1080p.AV1.10bit.MeGusta/Screens/screen0001.jpg" +"$MOUNT/Media BKP/Movies/Ranma/Movies/Movie 3 - Team Ranma vs. The Legendary Phoenix/Ranma Movie 3 - Team Ranma vs. The Legendary Phoenix.avi" +"$MOUNT/Media BKP/Movies/Ranma/OVA/Ranma Special OVA/Ranma Special OVA - 002.avi" +"$MOUNT/XXX_DELETE_Downloads" +) + +echo ">> Beginning purge rituals… βš™οΈπŸ”₯" + +for item in "${TARGETS[@]}"; do + if [ -e "$item" ]; then + echo ">> Purging $item" + sudo rm -rf --force "$item" 2>/dev/null || \ + sudo unlink "$item" 2>/dev/null || \ + echo "!! Failed to purge $item (machine spirit resists)" + else + echo "-- Skipped $item (does not exist)" + fi +done + +echo ">> Purge complete. The Omnissiah is appeased." diff --git a/sanctify-network-share.sh b/sanctify-network-share.sh new file mode 100755 index 0000000..adfba40 --- /dev/null +++ b/sanctify-network-share.sh @@ -0,0 +1,99 @@ +#!/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. ✠"