mount_for_backup.sh 577 B

12345678910111213141516171819202122232425262728293031323334
  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. if type kdialog &> /dev/null; then
  10. PROMPT="kdialog --title Qubes --password"
  11. else
  12. PROMPT="zenity --entry --title Qubes --hide-text --text"
  13. fi
  14. #check if luks-encrypted
  15. if sudo cryptsetup isLuks $1 ; then
  16. # Is a luks device
  17. if ! $PROMPT "Please unlock the LUKS-encrypted $1 device:" | sudo pmount $1 $2 ; then
  18. exit 1
  19. fi
  20. else
  21. #not luks!
  22. if ! sudo pmount $1 $2 ; then
  23. exit 1
  24. fi
  25. fi
  26. #all ok :)
  27. exit 0