Skip to content

Instantly share code, notes, and snippets.

@nullren
Created May 10, 2014 04:15
Show Gist options
  • Save nullren/9e20c5db29be3d00fc6c to your computer and use it in GitHub Desktop.
Save nullren/9e20c5db29be3d00fc6c to your computer and use it in GitHub Desktop.
both of these scripts are called using your image file as the argument
#!/bin/bash
if [ ! -f $1 ]; then
echo no file to close
exit 1
fi
LUFIL=$1
LODEV=$(losetup -j $LUFIL | cut -d: -f1)
MNAM="derp"
umount /media/$MNAM
cryptsetup luksClose $MNAM
losetup -d $LODEV
rmdir /media/$MNAM
echo done
#!/bin/bash
if [ ! -f $1 ]; then
echo no file given
exit 1
fi
modprobe dm_crypt
modprobe loop
LUFIL=$1
LODEV=$(losetup -f)
MNAM="derp"
losetup $LODEV $LUFIL
cryptsetup luksOpen $LODEV $MNAM
mkdir -p /media/$MNAM
mount /dev/mapper/$MNAM /media/$MNAM
echo done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment