if echo "${black_listed_devices}" | grep -q -w "${devname}"
then
# skip this subdevice
- break
+ continue
fi
# Checking for a luks device
- if [ "${PERSISTENT}" = "cryptsetup" ] && [ -e /sbin/cryptsetup ] && /sbin/cryptsetup isLuks ${devname}
+ if [ "${PERSISTENT_ENCRYPTION}" = "luks" ] && [ -e /sbin/cryptsetup ]
then
+ if ! modprobe dm-crypt
+ then
+ log_warning_msg "Unable to load module dm-crypt"
+ continue
+ fi
+
+ if ! /sbin/cryptsetup isLuks ${devname}
+ then
+ # we only look for encrypted subdevices
+ continue
+ fi
+
while true
do
load_keymap
break
fi
- echo
+ echo >&6
echo -n "There was an error decrypting ${devname} ... Retry? [Y/n] " >&6
read answer
if [ "$(echo "${answer}" | cut -b1 | tr A-Z a-z)" = "n" ]
then
unset answer
- break
+ # skip to next subdevice
+ continue 2
fi
done
fi
- if [ "$(/sbin/blkid -s LABEL -o value $devname 2>/dev/null)" = "${pers_label}" ]
+ if echo ${PERSISTENT_STORAGE} | grep -qw filesystem && [ "$(/sbin/blkid -s LABEL -o value $devname 2>/dev/null)" = "${pers_label}" ]
then
echo "${devname}"
return 0
fi
- if [ "${PERSISTENT}" = "nofiles" ]
+ if ! echo ${PERSISTENT_STORAGE} | grep -qw file
then
# do not mount the device to find for image files
# just skip this
fi
}
+
+removable_dev ()
+{
+ output_format="${1}"
+ want_usb="${2}"
+ ret=
+
+ for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -vE "/(loop|ram|dm-|fd)")
+ do
+ dev_ok=
+ if [ "$(cat ${sysblock}/removable)" = "1" ]
+ then
+ if [ -z "${want_usb}" ]
+ then
+ dev_ok="yes"
+ else
+ if readlink ${sysblock} | grep -q usb
+ then
+ dev_ok="yes"
+ fi
+ fi
+ fi
+
+ if [ "${dev_ok}" = "yes" ]
+ then
+ case "${output_format}" in
+ sys)
+ ret="${ret} ${sysblock}"
+ ;;
+ *)
+ devname=$(sys2dev "${sysblock}")
+ ret="${ret} ${devname}"
+ ;;
+ esac
+ fi
+ done
+
+ echo "${ret}"
+}
+
+removable_usb_dev ()
+{
+ output_format="${1}"
+
+ removable_dev "${output_format}" "want_usb"
+}
+
+non_removable_dev ()
+{
+ output_format="${1}"
+ ret=
+
+ for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -vE "/(loop|ram|dm-|fd)")
+ do
+ if [ "$(cat ${sysblock}/removable)" = "0" ]
+ then
+ case "${output_format}" in
+ sys)
+ ret="${ret} ${sysblock}"
+ ;;
+ *)
+ devname=$(sys2dev "${sysblock}")
+ ret="${ret} ${devname}"
+ ;;
+ esac
+ fi
+ done
+
+ echo "${ret}"
+}