+# detect cdrom device
+if ! $INSTALLED ; then
+ # new live-initramfs layout:
+ if [ -d /live/image ] ; then
+ CDROM="$(awk '/ \/live\/image /{print $1;exit 0;}' /proc/mounts)"
+ MOUNTPATH="/live/image"
+ else # old unionfs layout:
+ CDROM="$(awk '/ \/cdrom /{print $1;exit 0;}' /proc/mounts)"
+ MOUNTPATH="/cdrom"
+ fi
+
+ # try to remove only removable devices
+ DEVICE=""
+ if [ -n "$CDROM" ] ; then
+ DEVICE="${CDROM##/dev/}"
+ [ -d /sys/block/${DEVICE} ] || DEVICE="${DEVICE%%[0-9]*}"
+
+ if [ -n "$DEVICE" ] ; then
+ # is it a removable device?
+ [ "$(cat /sys/block/${DEVICE}/removable 2>/dev/null)" = "1" ] && REMOVABLE=true
+ # is it a usb device?
+ readlink /sys/block/${DEVICE} 2>/dev/null | grep -q '/usb' && USB_DEVICE=true
+ $USB_DEVICE && USB_INFO=" ($(cat /sys/block/${DEVICE}/device/model 2>/dev/null))"
+ fi
+ fi