#!/bin/bash echo ">>> Initialising" MOUNTPOINT=etemp VOLNAME=etemp METADIR=.etemp if [[ `id -u` != 0 ]]; then echo "WARNING: Not root. Running with sudo" cd ~ sudo "$0" exit 0 fi echo ">>> Unmounting" sudo umount $MOUNTPOINT || echo "WARNING: Cannot unmount $MOUNTPOINT" echo ">>> Closing volume" sudo cryptsetup luksClose $VOLNAME echo ">>> Removing image" rm $METADIR/image echo "Done."