mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.0 KiB

  1. #!/bin/bash
  2. if [ -e /lvp.data1 ] ; then
  3. echo -n "Found "
  4. for x in /lvp.data* ; do
  5. echo -n "$x "
  6. done
  7. echo
  8. echo "Starting crypto-subroutine"
  9. echo "Please choose which encryption you want to use:"
  10. echo -e "\t1\tblowfish"
  11. echo -e "\t2\ttwofish"
  12. echo -e "\t3\tserpent"
  13. echo
  14. unset thisenc
  15. while [ -z "${thisenc}" ] ; do
  16. read -p "Please enter your choice: " rthisenc
  17. [ "${rthisenc}" == "1" ] && thisenc="blowfish256"
  18. [ "${rthisenc}" == "2" ] && thisenc="twofish256"
  19. [ "${rthisenc}" == "3" ] && thisenc="serpent256"
  20. done
  21. echo "Using ${thisenc%256} encryption."
  22. while [ ! -e /mnt1/lvp.xml ] ; do
  23. read -p "Please enter passphrase: " -s passphrase
  24. echo
  25. exec 2>/dev/null
  26. for x in /lvp.data* ; do
  27. echo "${passphrase}" | losetup -e ${thisenc} -p 0 /dev/loop/${x#/lvp.data} ${x}
  28. mount /dev/loop/${x#/lvp.data} /mnt${x#/lvp.data} 2>&1
  29. done
  30. if [ ! -e /mnt1/lvp.xml ] ; then
  31. echo "Wrong Passphrase!"
  32. for x in /lvp.data* ; do
  33. losetup -d /dev/loop/${x#/lvp.data}
  34. done
  35. fi
  36. exec 2>&1
  37. done
  38. fi