mount_for_backup.sh 439 B

123456789101112131415161718192021222324252627
  1. #!/bin/sh
  2. #args:
  3. # 1) device path
  4. # 2) mountpoint name
  5. #check if path exists
  6. if [ ! -e $1 ]; then
  7. exit 1; #no such path
  8. fi
  9. #check if luks-encrypted
  10. if sudo cryptsetup isLuks $1 ; then
  11. # Is a luks device
  12. if ! kdialog --password "Please unlock the LUKS-encrypted $1 device:" | sudo pmount $1 $2 ; then
  13. exit 1;
  14. fi
  15. else
  16. #not luks!
  17. if ! sudo pmount $1 $2 ; then
  18. exit 1;
  19. fi
  20. fi
  21. #all ok :)
  22. exit 0;