1234567891011121314151617181920212223242526 |
- #!/bin/bash
- # http://www.absurde.org/2012/10/08/automatiser-ses-donnees-cryptees-feat-crypsetup-udev-automount/
- #!/bin/sh
- if [ "$1" = "open" ]; then
- if [ "$2" ]; then
- echo "opening encrypted partition $2"
- sudo cryptsetup luksOpen $2 ExtData --key-file=/home/bach/.lukskeyfiles/ExtData.key
- echo "mounting ExtData to /mnt/ExtData"
- sudo mount /dev/mapper/ExtData /mnt/ExtData
- echo "done, $2 available at /mnt/ExtData"
- else
- echo "Please give the device partition to open (eg: /dev/sdc1)"
- fi
- elif [ "$1" = "close" ]; then
- echo "unmounting /mnt/ExtData"
- sudo umount /mnt/ExtData
- echo "Closing encrypted ExtData"
- sudo cryptsetup close ExtData
- else
- echo "please choose a command : open or close"
- fi
|