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.

47 lines
1.6 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. insmod /lib/modules/`uname -r`/block/loop.o >/dev/null 2>/dev/null
  10. insmod /lib/modules/`uname -r`/block/loop_blowfish.o >/dev/null 2>/dev/null && blowfish=1
  11. insmod /lib/modules/`uname -r`/block/loop_twofish.o >/dev/null 2>/dev/null && twofish=1
  12. insmod /lib/modules/`uname -r`/block/loop_serpent.o >/dev/null 2>/dev/null && serpent=1
  13. echo "Please choose which encryption you want to use:"
  14. [ "${blowfish}" == 1 ] && echo -e "\t1\tblowfish"
  15. [ "${twofish}" == 1 ] && echo -e "\t2\ttwofish"
  16. [ "${serpent}" == 1 ] && echo -e "\t3\tserpent"
  17. echo
  18. if [ "${blowfish}" != 1 -a "${twofish}" != 1 -a "${serpent}" != 1 ] ; then
  19. echo "Couldn't find a usable cipher for encryption." >&2
  20. echo "Can't mount encrypted data." >&2
  21. echo "Sorry >_<" >&2
  22. echo >&2
  23. read -p "Press -<Enter>- to shut down the system"
  24. echo 'o' >/proc/sysrq-trigger
  25. fi
  26. unset thisenc
  27. while [ -z "${thisenc}" ] ; do
  28. echo -n "Please enter your choice: "
  29. read rthisenc
  30. [ "${rthisenc}" == "1" -a "${blowfish}" == "1" ] && thisenc="blowfish256"
  31. [ "${rthisenc}" == "2" -a "${twofish}" == "1" ] && thisenc="twofish256"
  32. [ "${rthisenc}" == "3" -a "${serpent}" == "1" ] && thisenc="serpent256"
  33. done
  34. echo "Using ${thisenc%256} encryption."
  35. while [ ! -e /mnt1/lvp.xml ] ; do
  36. umount /mnt* >/dev/null 2>&1
  37. read -p "Please enter passphrase: " -s passphrase
  38. echo
  39. for x in /lvp.data* ; do
  40. echo "${passphrase}" | mount -o encryption=${thisenc} -p 0 ${x} /mnt${x#/lvp.data} 2>&1
  41. done
  42. [ ! -e /mnt1/lvp.xml ] && echo "Wrong Passphrase!"
  43. done
  44. fi