blob: 2382d15eb70f603251deae7b6b5ca7320018671d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/bin/sh
error() {
echo "error: $@"
exit 1
}
set -e
DUMP="$1"
MOUNTPOINT=/media/luks-dump
[ -d "$MOUNTPOINT" ] && error "$MOUNTPOINT already exists, you must delete it first"
[ $EUID -ne 0 ] && error "must be run as root"
[ -f "$DUMP" ] || error "'$DUMP' is not a file or is not readable"
DEVICE=$(losetup -f)
losetup $DEVICE "$DUMP"
cryptsetup luksOpen $DEVICE luks-dump
mkdir $MOUNTPOINT
mount /dev/mapper/luks-dump $MOUNTPOINT
echo "press enter when done..."
read
umount $MOUNTPOINT
rmdir $MOUNTPOINT
cryptsetup luksClose luks-dump
losetup -d $DEVICE
|