mount-extdata-hdd.sh 776 B

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