Lines 282-287
findnfsmount() {
Link Here
|
282 |
fi |
282 |
fi |
283 |
} |
283 |
} |
284 |
|
284 |
|
|
|
285 |
find_real_device() { |
286 |
local DEVICE="${1}" |
287 |
case "${DEVICE}" in |
288 |
UUID\=*|LABEL\=*) |
289 |
local REAL_DEVICE="" |
290 |
local retval=1 |
291 |
|
292 |
if [ "${retval}" -ne 0 ]; then |
293 |
REAL_DEVICE=`findfs "${DEVICE}" 2>/dev/null` |
294 |
retval=$? |
295 |
fi |
296 |
|
297 |
if [ "$retval" -ne 0 ]; then |
298 |
REAL_DEVICE=`busybox findfs "${DEVICE}" 2>/dev/null` |
299 |
retval=$? |
300 |
fi |
301 |
|
302 |
if [ "${retval}" -ne 0 ]; then |
303 |
REAL_DEVICE=`blkid -o device -l -t "${DEVICE}"` |
304 |
retval=$? |
305 |
fi |
306 |
|
307 |
if [ "${retval}" -eq 0 ] && [ -n "${REAL_DEVICE}" ]; then |
308 |
DEVICE="${REAL_DEVICE}" |
309 |
fi |
310 |
;; |
311 |
esac |
312 |
echo -n "${DEVICE}" |
313 |
} |
314 |
|
285 |
check_loop() { |
315 |
check_loop() { |
286 |
if [ "${LOOP}" = '' -o ! -e "${CDROOT_PATH}/${LOOP}" ] |
316 |
if [ "${LOOP}" = '' -o ! -e "${CDROOT_PATH}/${LOOP}" ] |
287 |
then |
317 |
then |
Lines 801-832
openLUKS() {
Link Here
|
801 |
prompt_user "LUKS_KEYDEV" "${LUKS_NAME} key device" |
831 |
prompt_user "LUKS_KEYDEV" "${LUKS_NAME} key device" |
802 |
KEYDEV_ERROR=0 |
832 |
KEYDEV_ERROR=0 |
803 |
else |
833 |
else |
804 |
case "${LUKS_DEVICE}" in |
834 |
LUKS_DEVICE=$(find_real_device "${LUKS_DEVICE}") |
805 |
UUID\=*|LABEL\=*) |
|
|
806 |
local REAL_LUKS="" |
807 |
local retval=1 |
808 |
|
809 |
if [ "${retval}" -ne 0 ]; then |
810 |
REAL_LUKS=`findfs "${LUKS_DEVICE}" 2>/dev/null` |
811 |
retval=$? |
812 |
fi |
813 |
|
814 |
if [ "$retval" -ne 0 ]; then |
815 |
REAL_LUKS=`busybox findfs "${LUKS_DEVICE}" 2>/dev/null` |
816 |
retval=$? |
817 |
fi |
818 |
|
819 |
if [ "${retval}" -ne 0 ]; then |
820 |
REAL_LUKS=`blkid -o device -l -t "${LUKS_DEVICE}"` |
821 |
retval=$? |
822 |
fi |
823 |
|
824 |
if [ "${retval}" -eq 0 ] && [ -n "${REAL_LUKS}" ]; then |
825 |
good_msg "Detected device ${REAL_LUKS}" |
826 |
LUKS_DEVICE="${REAL_LUKS}" |
827 |
fi |
828 |
;; |
829 |
esac |
830 |
|
835 |
|
831 |
setup_md_device ${LUKS_DEVICE} |
836 |
setup_md_device ${LUKS_DEVICE} |
832 |
cryptsetup isLuks ${LUKS_DEVICE} |
837 |
cryptsetup isLuks ${LUKS_DEVICE} |
Lines 845-854
openLUKS() {
Link Here
|
845 |
|
850 |
|
846 |
if [ -n "${LUKS_KEY}" ] |
851 |
if [ -n "${LUKS_KEY}" ] |
847 |
then |
852 |
then |
|
|
853 |
local REAL_LUKS_KEYDEV="${LUKS_KEYDEV}" |
848 |
if [ ! -e "${mntkey}${LUKS_KEY}" ] |
854 |
if [ ! -e "${mntkey}${LUKS_KEY}" ] |
849 |
then |
855 |
then |
850 |
if [ -b "${LUKS_KEYDEV}" ] |
856 |
REAL_LUKS_KEYDEV=$(find_real_device "${LUKS_KEYDEV}") |
851 |
then good_msg "Using key device ${LUKS_KEYDEV}." ${CRYPT_SILENT} |
857 |
if [ -b "${REAL_LUKS_KEYDEV}" ] |
|
|
858 |
then good_msg "Using key device ${REAL_LUKS_KEYDEV}." ${CRYPT_SILENT} |
852 |
else |
859 |
else |
853 |
good_msg "Please insert removable device ${LUKS_KEYDEV} for ${LUKS_NAME}" ${CRYPT_SILENT} |
860 |
good_msg "Please insert removable device ${LUKS_KEYDEV} for ${LUKS_NAME}" ${CRYPT_SILENT} |
854 |
# abort after 10 secs |
861 |
# abort after 10 secs |
Lines 857-874
openLUKS() {
Link Here
|
857 |
do |
864 |
do |
858 |
count=$((count-1)) |
865 |
count=$((count-1)) |
859 |
sleep 1 |
866 |
sleep 1 |
860 |
if [ -b "${LUKS_KEYDEV}" ] |
867 |
REAL_LUKS_KEYDEV=$(find_real_device "${LUKS_KEYDEV}") |
|
|
868 |
if [ -b "${REAL_LUKS_KEYDEV}" ] |
861 |
then |
869 |
then |
862 |
good_msg "Removable device ${LUKS_KEYDEV} detected." ${CRYPT_SILENT} |
870 |
good_msg "Removable device ${REAL_LUKS_KEYDEV} detected." ${CRYPT_SILENT} |
863 |
break |
871 |
break |
864 |
fi |
872 |
fi |
865 |
done |
873 |
done |
866 |
if [ ! -b "${LUKS_KEYDEV}" ] |
874 |
if [ ! -b "${REAL_LUKS_KEYDEV}" ] |
867 |
then |
875 |
then |
868 |
eval CRYPT_${TYPE}_KEY=${LUKS_KEY} |
876 |
eval CRYPT_${TYPE}_KEY=${LUKS_KEY} |
869 |
bootstrapKey ${TYPE} |
877 |
bootstrapKey ${TYPE} |
870 |
eval LUKS_KEYDEV='"${CRYPT_'${TYPE}'_KEYDEV}"' |
878 |
eval LUKS_KEYDEV='"${CRYPT_'${TYPE}'_KEYDEV}"' |
871 |
if [ ! -b "${LUKS_KEYDEV}" ]; then |
879 |
REAL_LUKS_KEYDEV=$(find_real_device "${LUKS_KEYDEV}") |
|
|
880 |
if [ ! -b "${REAL_LUKS_KEYDEV}" ]; then |
872 |
KEYDEV_ERROR=1 |
881 |
KEYDEV_ERROR=1 |
873 |
bad_msg "Removable device ${LUKS_KEYDEV} not found." ${CRYPT_SILENT} |
882 |
bad_msg "Removable device ${LUKS_KEYDEV} not found." ${CRYPT_SILENT} |
874 |
continue |
883 |
continue |
Lines 880-906
openLUKS() {
Link Here
|
880 |
# At this point a device was recognized, now let's see if the key is there |
889 |
# At this point a device was recognized, now let's see if the key is there |
881 |
[ ! -d "$mntkey" ] && mkdir -p ${mntkey} 2>/dev/null >/dev/null |
890 |
[ ! -d "$mntkey" ] && mkdir -p ${mntkey} 2>/dev/null >/dev/null |
882 |
|
891 |
|
883 |
mount -n -o ro ${LUKS_KEYDEV} ${mntkey} >/dev/null 2>/dev/null |
892 |
mount -n -o ro ${REAL_LUKS_KEYDEV} ${mntkey} >/dev/null 2>/dev/null |
884 |
if [ "$?" != '0' ] |
893 |
if [ "$?" != '0' ] |
885 |
then |
894 |
then |
886 |
KEYDEV_ERROR=1 |
895 |
KEYDEV_ERROR=1 |
887 |
bad_msg "Mounting of device ${LUKS_KEYDEV} failed." ${CRYPT_SILENT} |
896 |
bad_msg "Mounting of device ${REAL_LUKS_KEYDEV} failed." ${CRYPT_SILENT} |
888 |
continue |
897 |
continue |
889 |
else |
898 |
else |
890 |
good_msg "Removable device ${LUKS_KEYDEV} mounted." ${CRYPT_SILENT} |
899 |
good_msg "Removable device ${REAL_LUKS_KEYDEV} mounted." ${CRYPT_SILENT} |
891 |
sleep 2 |
900 |
sleep 2 |
892 |
# keyfile exists? |
901 |
# keyfile exists? |
893 |
if [ ! -e "${mntkey}${LUKS_KEY}" ]; then |
902 |
if [ ! -e "${mntkey}${LUKS_KEY}" ]; then |
894 |
umount -n ${mntkey} 2>/dev/null >/dev/null |
903 |
umount -n ${mntkey} 2>/dev/null >/dev/null |
895 |
KEY_ERROR=1 |
904 |
KEY_ERROR=1 |
896 |
KEYDEV_ERROR=1 |
905 |
KEYDEV_ERROR=1 |
897 |
bad_msg "Key {LUKS_KEY} on device ${LUKS_KEYDEV} not found." ${CRYPT_SILENT} |
906 |
bad_msg "Key {LUKS_KEY} on device ${REAL_LUKS_KEYDEV} not found." ${CRYPT_SILENT} |
898 |
continue |
907 |
continue |
899 |
fi |
908 |
fi |
900 |
fi |
909 |
fi |
901 |
fi |
910 |
fi |
902 |
# At this point a candidate key exists (either mounted before or not) |
911 |
# At this point a candidate key exists (either mounted before or not) |
903 |
good_msg "${LUKS_KEY} on device ${LUKS_KEYDEV} found" ${CRYPT_SILENT} |
912 |
good_msg "${LUKS_KEY} on device ${REAL_LUKS_KEYDEV} found" ${CRYPT_SILENT} |
904 |
if [ "$(echo ${LUKS_KEY} | grep -o '.gpg$')" = ".gpg" ] && [ -e /sbin/gpg ] ; then |
913 |
if [ "$(echo ${LUKS_KEY} | grep -o '.gpg$')" = ".gpg" ] && [ -e /sbin/gpg ] ; then |
905 |
[ -e /dev/tty ] && mv /dev/tty /dev/tty.org |
914 |
[ -e /dev/tty ] && mv /dev/tty /dev/tty.org |
906 |
mknod /dev/tty c 5 1 |
915 |
mknod /dev/tty c 5 1 |