#!/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