view mount-crypt @ 0:e85e3470a41e

Initial commit of useful scripts
author IBBoard <dev@ibboard.co.uk>
date Sat, 02 Aug 2014 19:31:02 +0100
parents
children 14e726efe9b0
line wrap: on
line source

#! /bin/bash

if [ $# -ne 1 ]; then
	echo "Usage: $0 <filename>" >&2
	exit 1
fi

if [ ! -f "$1" ]; then
	echo "File doesn't exist" >&2
	exit 2
fi

LOOP_DEV=$(sudo losetup --find --show "$1")
MAPPER=${LOOP_DEV##*/}
sudo cryptsetup luksOpen $LOOP_DEV $MAPPER
sudo mkdir -p /media/$MAPPER
sudo mount /dev/mapper/$MAPPER /media/$MAPPER