blob: cd0779c149482ac6faca9311c3865c7833fcae1a (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#!/bin/zsh
. $(dirname $0:A)/func.zsh
check_root
if [ "$#" -ne 1 ]; then
echo "missing args: crypt-disk <mount|umount>"
exit
fi
CMD=$1
dock_dev="/dev/disk/by-id/ata-HGST_HTS721010A9E630_JR10046P3Z3SMN-part1"
dock1_dev="/dev/disk/by-id/ata-HGST_HTS721010A9E630_JR10046P3ZMMJN-part1"
remote_backup_dev="/dev/disk/by-id/scsi-SATA_WDC_WD1002FAEX-_WD-WCAW32441082-part1"
DEVICE=""
NAME=""
if [[ -e $dock_dev ]]; then
DEVICE=$dock_dev
NAME="dock"
elif [[ -e $dock1_dev ]]; then
DEVICE=$dock1_dev
NAME="dock1"
elif [[ -e $remote_backup_dev ]]; then
DEVICE=$remote_backup_dev
NAME="remote_backup"
else
echo "No known encrypted disk found."
exit
fi
echo "disk: $NAME"
if [[ "$CMD" == "mount" ]]; then
echo " mount"
cryptsetup luksOpen $DEVICE $NAME
mount /dev/mapper/$NAME
elif [[ "$CMD" == "umount" ]]; then
echo " umount"
umount /media/$NAME
cryptsetup luksClose /dev/mapper/$NAME
else
echo "Can't '$CMD' $NAME."
exit
fi
|