5 export PATH="/root/usr/bin:/root/usr/sbin:/root/bin:/root/sbin:/usr/bin:/usr/sbin:/bin:/sbin"
7 echo "/root/lib" >> /etc/ld.so.conf
8 echo "/root/usr/lib" >> /etc/ld.so.conf
10 mountpoint="/live/image"
11 LIVE_MEDIA_PATH="live"
13 root_persistence="live-rw"
14 home_persistence="home-rw"
15 root_snapshot_label="live-sn"
16 home_snapshot_label="home-sn"
19 USERFULLNAME="Live user"
22 mkdir -p "${mountpoint}"
24 [ -f /etc/live.conf ] && . /etc/live.conf
25 export USERNAME USERFULLNAME HOSTNAME
27 . /scripts/live-helpers
29 if [ ! -f /live.vars ]
38 for ARGUMENT in $(cat /proc/cmdline)
42 ACCESS="${ARGUMENT#access=}"
47 DEFCONSOLE="${ARGUMENT#*=}"
59 FETCH="${ARGUMENT#fetch=}"
64 HOOK="${ARGUMENT#hook=}"
69 HOSTNAME="${ARGUMENT#hostname=}"
71 export HOSTNAME LIVECONF
75 USERNAME="${ARGUMENT#username=}"
77 export USERNAME LIVECONF
81 USERFULLNAME="${ARGUMENT#userfullname=}"
83 export USERFULLNAME LIVECONF
92 STATICIP="${ARGUMENT#ip=}"
94 if [ -z "${STATICIP}" ]
102 keyb=*|kbd-chooser/method=*)
107 klayout=*|console-setup/layoutcode=*)
108 KLAYOUT="${ARGUMENT#*=}"
112 kvariant=*|console-setup/variantcode=*)
113 KVARIANT="${ARGUMENT#*=}"
117 kmodel=*|console-setup/modelcode=*)
118 KMODEL="${ARGUMENT#*=}"
123 KOPTIONS="${ARGUMENT#koptions=}"
132 live-media=*|bootfrom=*)
133 LIVE_MEDIA="${ARGUMENT#*=}"
137 live-media-encryption=*|encryption=*)
138 LIVE_MEDIA_ENCRYPTION="${ARGUMENT#*=}"
139 export LIVE_MEDIA_ENCRYPTION
143 LIVE_MEDIA_OFFSET="${ARGUMENT#live-media-offset=}"
144 export LIVE_MEDIA_OFFSET
148 LIVE_MEDIA_PATH="${ARGUMENT#live-media-path=}"
149 export LIVE_MEDIA_PATH
152 live-media-timeout=*)
153 LIVE_MEDIA_TIMEOUT="${ARGUMENT#live-media-timeout=}"
154 export LIVE_MEDIA_TIMEOUT
157 locale=*|debian-installer/locale=*)
158 LOCALE="${ARGUMENT#*=}"
163 MODULE="${ARGUMENT#module=}"
168 NETBOOT="${ARGUMENT#netboot=}"
173 NFSOPTS="${ARGUMENT#nfsopts=}"
178 NFS_COW="${ARGUMENT#nfscow=}"
183 NOACCESSIBILITY="Yes"
184 export NOACCESSIBILITY
208 NOCONSOLEKEYBOARD="Yes"
209 export NOCONSOLEKEYBOARD
233 NOKPERSONALIZER="Yes"
234 export NOKPERSONALIZER
238 NOLANGUAGESELECTOR="Yes"
239 export NOLANGUAGESELECTOR
253 NOPOWERMANAGEMENT="Yes"
254 export NOPOWERMANAGEMENT
258 NOPROGRAMCRASHES="Yes"
259 export NOPROGRAMCRASHES
263 NORESTRICTEDMANAGER="Yes"
264 export NORESTRICTEDMANAGER
278 NOUPDATENOTIFIER="Yes"
279 export NOUPDATENOTIFIER
294 export NOXSCREENSAVER
307 preseed/file=*|file=*)
308 LOCATION="${ARGUMENT#*=}"
318 location="${ARGUMENT#url=}"
320 mount -n -o bind /sys /root/sys
321 mount -n -o bind /proc /root/proc
322 mount -n -o bind /dev /root/dev
324 mkdir -p /root/var/run/network
325 chroot /root dhclient eth0
326 chroot /root wget -P /tmp "${location}"
327 chroot /root ifconfig eth0 down
333 LOCATION="/tmp/$(basename "${location}")"
337 question="${ARGUMENT%%=*}"
338 value="${ARGUMENT#*=}"
339 PRESEEDS="${PRESEEDS}\"${question}=${value}\" "
354 TIMEZONE="${ARGUMENT#timezone=}"
364 TODISK="${ARGUMENT#todisk=}"
375 MODULETORAM="${ARGUMENT#toram=}"
376 export TORAM MODULETORAM
390 ROOT="${ARGUMENT#root=}"
395 UNIONTYPE="${ARGUMENT#union=}"
400 UTC="${ARGUMENT#utc=}"
410 XDRIVER="${ARGUMENT#xdriver=}"
415 XVIDEOMODE="${ARGUMENT#xvideomode=}"
421 # sort of compatibility with netboot.h from linux docs
422 if [ -z "${NETBOOT}" ]
424 if [ "${ROOT}" = "/dev/nfs" ]
428 elif [ "${ROOT}" = "/dev/cifs" ]
435 if [ -z "${MODULE}" ]
441 if [ -z "${UNIONTYPE}" ]
452 if [ -d "${DIRECTORY}"/"${LIVE_MEDIA_PATH}" ]
454 for FILESYSTEM in squashfs ext2 ext3 xfs dir jffs2
456 if [ "$(echo ${DIRECTORY}/${LIVE_MEDIA_PATH}/*.${FILESYSTEM})" != "${DIRECTORY}/${LIVE_MEDIA_PATH}/*.${FILESYSTEM}" ]
468 if [ "${IGNORE_UUID}" ] || [ ! -e /conf/uuid.conf ]
474 uuid="$(cat /conf/uuid.conf)"
476 for try_uuid_file in "${mountpoint}/.disk/casper-uuid"*
478 [ -e "${try_uuid_file}" ] || continue
480 try_uuid="$(cat "${try_uuid_file}")"
482 if [ "${uuid}" = "${try_uuid}" ]
491 get_backing_device ()
494 *.squashfs|*.ext2|*.ext3|*.jffs2)
495 echo $(setup_loop "${1}" "loop" "/sys/block/loop*" '0' "${LIVE_MEDIA_ENCRYPTION}")
503 panic "Unrecognized live filesystem: ${1}"
508 match_files_in_dir ()
510 # Does any files match pattern ${1} ?
513 if [ "$(echo ${pattern})" != "${pattern}" ]
521 mount_images_in_directory ()
528 if match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.squashfs" ||
529 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext2" ||
530 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext3" ||
531 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.jffs2" ||
532 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.dir"
534 [ -n "${mac}" ] && adddirectory="${directory}/${LIVE_MEDIA_PATH}/${mac}"
535 setup_unionfs "${directory}/${LIVE_MEDIA_PATH}" "${rootmnt}" "${adddirectory}"
543 sysfs_path="${1#/sys}"
545 if /lib/udev/path_id "${sysfs_path}" | grep -E -q "ID_PATH=(usb|pci-[^-]*-[ide|scsi|usb])"
555 # FIXME: do something better like the scan of supported filesystems
559 vfat|iso9660|udf|ext2|ext3|ntfs|jffs2)
571 copyto="${copyfrom}_swap"
573 if [ -z "${MODULETORAM}" ]
575 size=$(fs_size "" ${copyfrom} "used")
577 MODULETORAMFILE="${copyfrom}/${LIVE_MEDIA_PATH}/${MODULETORAM}"
579 if [ -f "${MODULETORAMFILE}" ]
581 size=$( expr $(ls -la ${MODULETORAMFILE} | awk '{print $5}') / 1024 + 5000 )
583 log_warning_msg "Error: toram-module ${MODULETORAM} (${MODULETORAMFILE}) could not be read."
588 if [ "${copytodev}" = "ram" ]
591 freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( cat /proc/meminfo | grep Cached | head -n 1 | awk '/Cached/{print $2}' - ) )
592 mount_options="-o size=${size}k"
597 # it should be a writable block device
598 if [ -b "${copytodev}" ]
602 fstype=$(get_fstype "${dev}")
603 freespace=$(fs_size "${dev}")
605 [ "$quiet" != "y" ] && log_warning_msg "${copytodev} is not a block device."
610 if [ "${freespace}" -lt "${size}" ]
612 [ "${quiet}" != "y" ] && log_warning_msg "Not enough free ${free_string} (${freespace}k free, ${size}k needed) to copy live media in ${copytodev}."
616 # begin copying (or uncompressing)
618 echo "mount -t ${fstype} ${mount_options} ${dev} ${copyto}"
619 mount -t "${fstype}" ${mount_options} "${dev}" "${copyto}"
621 if [ "${extension}" = "tgz" ]
624 tar zxf "${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
625 rm -f "${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
626 mount -r --move "${copyto}" "${rootmnt}"
629 if [ -n "${MODULETORAMFILE}" ]
631 cp ${MODULETORAMFILE} ${copyto} # copy only the filesystem module
633 cp -a ${copyfrom}/* ${copyto} # "cp -a" from busybox also copies hidden files
638 mount -r --move ${copyto} ${copyfrom}
649 modprobe -q af_packet # For DHCP
654 ipconfig ${DEVICE} | tee /netboot.config
656 # source relevant ipconfig output
657 OLDHOSTNAME=${HOSTNAME}
658 . /tmp/net-${DEVICE}.conf
659 [ -z ${HOSTNAME} ] && HOSTNAME=${OLDHOSTNAME}
662 if [ "${NFSROOT}" = "auto" ]
664 NFSROOT=${ROOTSERVER}:${ROOTPATH}
667 if [ -n "${FETCH}" ] && do_httpmount
673 if [ "${NFSROOT#*:}" = "${NFSROOT}" ] && [ "$NETBOOT" != "cifs" ]
675 NFSROOT=${ROOTSERVER}:${NFSROOT}
678 [ "${quiet}" != "y" ] && log_begin_msg "Trying netboot from ${NFSROOT}"
680 if [ "${NETBOOT}" != "nfs" ] && do_cifsmount
690 [ "${quiet}" != "y" ] && log_end_msg
697 extension=$(echo "${FETCH}" | sed 's/\(.*\)\.\(.*\)/\2/')
699 case "${extension}" in
701 [ "${quiet}" != "y" ] && log_begin_msg "Trying wget ${FETCH} -O ${mountpoint}/$(basename ${FETCH})"
702 mkdir -p "${mountpoint}/${LIVE_MEDIA_PATH}"
703 wget "${FETCH}" -O "${mountpoint}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
704 [ ${?} -eq 0 ] && rc=0
705 [ "${extension}" = "tgz" ] && live_dest="ram"
709 [ "${quiet}" != "y" ] && log_begin_msg "Unrecognized archive extension for ${FETCH}"
721 if [ -z "${NFSOPTS}" ]
726 [ "${quiet}" != "y" ] && log_begin_msg "Trying nfsmount -o nolock -o ro ${NFSOPTS} ${NFSROOT} ${mountpoint}"
728 # FIXME: This for loop is an ugly HACK round an nfs bug
729 for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13
731 nfsmount -o nolock -o ro ${NFSOPTS} "${NFSROOT}" "${mountpoint}" && rc=0 && break
742 if [ -x "/sbin/mount.cifs" ]
744 if [ -z "${NFSOPTS}" ]
746 CIFSOPTS="-ouser=root,password="
748 CIFSOPTS="${NFSOPTS}"
751 [ "${quiet}" != "y" ] && log_begin_msg "Trying mount.cifs ${NFSROOT} ${mountpoint} ${CIFSOPTS}"
754 if mount.cifs "${NFSROOT}" "${mountpoint}" "${CIFSOPTS}"
768 size=$(fs_size "${fromdev}" "" "used")
770 if [ -b "${fromdev}" ]
773 if [ -n "${HOMEMOUNTED}" -a "${snap_type}" = "HOME" ]
775 todev=$(cat /proc/mounts | grep -s " $(base_path ${todir}) " | awk '{print $1}' )
776 freespace=$(df -k | grep -s ${todev} | awk '{print $4}')
778 freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( cat /proc/meminfo | grep Cached | head -n 1 | awk '/Cached/{print $2}' - ))
781 tomount="/mnt/tmpsnap"
783 if [ ! -d "${tomount}" ]
785 mkdir -p "${tomount}"
788 fstype=$(get_fstype "${fromdev}")
790 if [ -n "${fstype}" ]
793 mount -t "${fstype}" -o ro,noatime "${fromdev}" "${tomount}"
794 cp -a "${tomount}"/* ${todir}
797 log_warning_msg "Unrecognized fstype: ${fstype} on ${fromdev}:${snap_type}"
802 if echo ${fromdev} | grep -qs loop
804 losetup -d "${fromdev}"
811 [ "${quiet}" != "y" ] && log_warning_msg "Unable to find the snapshot ${snap_type} medium"
817 # Look for ${snap_label}.* in block devices and copy the contents to ${snap_mount}
818 # and remember the device and filename for resync on exit in live-initramfs.init
823 snapdata=$(find_files "${snap_label}.squashfs ${snap_label}.cpio.gz ${snap_label}.ext2 ${snap_label}.ext3 ${snap_label}.jffs2")
825 if [ ! -z "${snapdata}" ]
827 snapdev="$(echo ${snapdata} | cut -f1 -d ' ')"
828 snapback="$(echo ${snapdata} | cut -f2 -d ' ')"
829 snapfile="$(echo ${snapdata} | cut -f3 -d ' ')"
831 if echo "${snapfile}" | grep -qs '\(squashfs\|ext2\|ext3\|jffs2\)'
833 # squashfs, jffs2 or ext2/ext3 snapshot
834 dev=$(get_backing_device "${snapback}/${snapfile}")
836 if ! do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
838 log_warning_msg "Impossible to include the ${snapfile} Snapshot"
843 if ! (cd "${snap_mount}" && zcat "${snapback}/${snapfile}" | cpio -i -u -d 2>/dev/null)
845 log_warning_msg "Impossible to include the ${snapfile} Snapshot"
852 dev=$(find_cow_device "${snap_label}")
856 if echo "${dev}" | grep -qs loop
858 # strange things happens, user confused?
859 snaploop=$( losetup ${dev} | awk '{print $3}' | tr -d '()' )
860 snapfile=$(basename ${snaploop})
861 snapdev=$(cat /proc/mounts | awk '{print $2,$1}' | grep -es "^$( dirname ${snaploop} )" | cut -f2 -d ' ')
866 if ! do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
868 log_warning_msg "Impossible to include the ${snap_label} Snapshot"
871 if [ -n "${snapfile}" ]
873 # it was a loop device, user confused
878 log_warning_msg "Impossible to include the ${snap_label} Snapshot"
883 echo "export ${snap_type}SNAP="${snap_mount}":${snapdev}:${snapfile}" >> /etc/live.conf # for resync on reboot/halt
889 image_directory="${1}"
891 addimage_directory="${3}"
892 modprobe -q -b ${UNIONTYPE}
894 # run-init can't deal with images in a subdir, but we're going to
895 # move all of these away before it runs anyway. No, we're not,
896 # put them in / since move-mounting them into / breaks mono and
901 # Let's just mount the read-only file systems first
904 minor_kernel_version=$(uname -r|cut -c 5-|sed 's/[^0-9].*//')
906 if [ "${NETBOOT}" = "nfs" ] && [ "${minor_kernel_version}" -lt 22 ]
908 # go aroung a bug in nfs-unionfs locking for unionfs <= 1.4
910 elif [ "${UNIONTYPE}" = "aufs" ]
917 # Read image names from ${MODULE}.module if it exists
918 if [ -e "${image_directory}/filesystem.${MODULE}.module" ]
920 for IMAGE in $(cat ${image_directory}/filesystem.${MODULE}.module)
922 image_string="${image_string} ${image_directory}/${IMAGE}"
924 elif [ -e "${image_directory}/${MODULE}.module" ]
926 for IMAGE in $(cat ${image_directory}/${MODULE}.module)
928 image_string="${image_string} ${image_directory}/${IMAGE}"
931 # ${MODULE}.module does not exist, create a list of images
932 for FILESYSTEM in squashfs ext2 ext3 xfs jffs2 dir
934 for IMAGE in "${image_directory}"/*."${FILESYSTEM}"
938 image_string="${image_string} ${IMAGE}"
943 if [ -n "${addimage_directory}" ] && [ -d "${addimage_directory}" ]
945 for FILESYSTEM in squashfs ext2 ext3 xfs jffs2 dir
947 for IMAGE in "${addimage_directory}"/*."${FILESYSTEM}"
951 image_string="${image_string} ${IMAGE}"
958 image_string="$(echo ${image_string} | sed -e 's/ /\n/g' | sort )"
961 [ -n "${MODULETORAMFILE}" ] && image_string="${image_directory}/$(basename ${MODULETORAMFILE})"
965 for image in ${image_string}
967 imagename=$(basename "${image}")
971 # it is a plain directory: do nothing
972 rofsstring="${image}=${roopt}:${rofsstring}"
973 rofslist="${image} ${rofslist}"
974 elif [ -f "${image}" ]
976 backdev=$(get_backing_device "${image}")
977 fstype=$(get_fstype "${backdev}")
979 if [ "${fstype}" = "unknown" ]
981 panic "Unknown file system type on ${backdev} (${image})"
984 mkdir -p "${croot}/${imagename}"
985 echo "debug: Can not mount backdev ${backdev} (image = ${image}) on croot/imagename ${croot}/${imagename}"
986 mount -t "${fstype}" -o ro,noatime "${backdev}" "${croot}/${imagename}" || panic "Can not mount ${backdev} (${image}) on ${croot}/${imagename}" && rofsstring="${croot}/${imagename}=${roopt}:${rofsstring}" && rofslist="${croot}/${imagename} ${rofslist}"
990 rofsstring=${rofsstring%:}
994 # Looking for "${root_persistence}" device or file
995 if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
998 num_block=$(ls -l /sys/block | wc -l)
999 for module in sd_mod uhci-hcd ehci-hcd ohci-hcd usb-storage
1001 modprobe -q -b ${module}
1007 # For some reason, udevsettle does not block in this scenario,
1008 # so we sleep for a little while.
1010 # See https://bugs.launchpad.net/ubuntu/+source/casper/+bug/84591
1011 for timeout in 5 4 3 2 1
1015 if [ $(ls -l /sys/block | wc -l) -gt ${num_block} ]
1021 cowprobe=$(find_cow_device "${root_persistence}")
1023 if [ -b "${cowprobe}" ]
1025 cowdevice=${cowprobe}
1026 cow_fstype=$(get_fstype "${cowprobe}")
1028 [ "${quiet}" != "y" ] && log_warning_msg "Unable to find the persistent medium"
1032 elif [ -n "${NFS_COW}" ] && [ -z "${NOPERSISTENT}" ]
1034 # check if there are any nfs options
1035 if echo ${NFS_COW}|grep -q ','
1037 nfs_cow_opts="-o nolock,$(echo ${NFS_COW}|cut -d, -f2-)"
1038 nfs_cow=$(echo ${NFS_COW}|cut -d, -f1)
1040 nfs_cow_opts="-o nolock"
1046 cowdevice=$(echo ${nfs_cow}|sed "s/client_mac_address/${mac}/")
1049 panic "unable to determine mac address"
1056 if [ "${cow_fstype}" = "nfs" ]
1058 [ "${quiet}" != "y" ] && log_begin_msg \
1059 "Trying nfsmount ${nfs_cow_opts} ${cowdevice} /cow"
1060 nfsmount ${nfs_cow_opts} ${cowdevice} /cow || \
1061 panic "Can not mount ${cowdevice} on /cow"
1063 mount ${cowdevice} -t ${cow_fstype} -o rw,noatime /cow || \
1064 panic "Can not mount ${cowdevice} on /cow"
1067 rofscount=$(echo ${rofslist} |wc -w)
1069 if [ -n "${EXPOSED_ROOT}" ]
1071 if [ ${rofscount} -ne 1 ]
1073 panic "only one RO file system supported with exposedroot: ${rofslist}"
1075 exposedrootfs=${rofslist%% }
1077 mount --bind ${exposedrootfs} ${rootmnt} || \
1078 panic "bind mount of ${exposedrootfs} failed"
1080 cow_dirs='/var/tmp /var/lock /var/run /var/log /var/spool
1081 /home /var/lib/live'
1083 for dir in ${cow_dirs}; do
1085 mount -t ${UNIONTYPE} \
1086 -o rw,noatime,dirs=/cow${dir}=rw:${exposedrootfs}${dir}=ro \
1087 ${UNIONTYPE} "${rootmnt}${dir}" || \
1088 panic "mount ${UNIONTYPE} on ${rootmnt}${dir} failed with option \
1089 rw,noatime,dirs=/cow${dir}=rw:${exposedrootfs}${dir}=ro"
1092 mount -t ${UNIONTYPE} -o noatime,dirs=/cow=rw:${rofsstring} \
1093 ${UNIONTYPE} "${rootmnt}" || panic "mount ${UNIONTYPE} on \
1094 ${rootmnt} failed with option noatime,dirs=/cow=rw:${rofsstring}"
1097 # tmpfs file systems
1098 mkdir -p "${rootmnt}/live"
1099 mount -t tmpfs tmpfs ${rootmnt}/live
1101 # Adding other custom mounts
1102 if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
1104 # directly mount /home
1105 # FIXME: add a custom mounts configurable system
1106 homecow=$(find_cow_device "${home_persistence}" )
1108 if [ -b "${homecow}" ]
1110 mount -t $(get_fstype "${homecow}") -o rw,noatime "${homecow}" "${rootmnt}/home"
1111 export HOMEMOUNTED=1 # used to proper calculate free space in do_snap_copy()
1113 [ "${quiet}" != "y" ] && log_warning_msg "Unable to find the persistent home medium"
1116 # Look for other snapshots to copy in
1117 try_snap "${root_snapshot_label}" "${rootmnt}" "ROOT"
1118 try_snap "${home_snapshot_label}" "${rootmnt}/home" "HOME"
1121 if [ -n "${SHOWMOUNTS}" ]
1123 for d in ${rofslist}
1125 mkdir -p "${rootmnt}/live/${d##*/}"
1129 # do nothing # mount -o bind "${d}" "${rootmnt}/live/${d##*/}"
1133 mount --move "${d}" "${rootmnt}/live/${d##*/}"
1139 # shows cow fs on /cow for use by live-snapshot
1140 mkdir -p "${rootmnt}/live/cow"
1141 mount -o move /cow "${rootmnt}/live/cow"
1148 skip_uuid_check="${3}"
1150 if [ -z "${devname}" ]
1152 devname=$(sys2dev "${sysdev}")
1155 if [ -n "${LIVE_MEDIA_OFFSET}" ]
1157 loopdevname=$(setup_loop "${devname}" "loop" "/sys/block/loop*" "${LIVE_MEDIA_OFFSET}" '')
1158 devname="${loopdevname}"
1161 fstype=$(get_fstype "${devname}")
1163 if is_supported_fs ${fstype}
1165 mount -t ${fstype} -o ro,noatime "${devname}" ${mountpoint} || continue
1167 if is_live_path ${mountpoint} && \
1168 ([ "${skip_uuid_check}" ] || matches_uuid ${mountpoint})
1173 umount ${mountpoint}
1177 if [ -n "${LIVE_MEDIA_OFFSET}" ]
1179 losetup -d "${loopdevname}"
1189 # first look at the one specified in the command line
1190 if [ ! -z "${LIVE_MEDIA}" ]
1192 if check_dev "null" "${LIVE_MEDIA}" "skip_uuid_check"
1198 # don't start autodetection before timeout has expired
1199 if [ -n "${LIVE_MEDIA_TIMEOUT}" ]
1201 if [ "${timeout}" -lt "${LIVE_MEDIA_TIMEOUT}" ]
1207 # or do the scan of block devices
1208 for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop | grep -v ram | grep -v 'dm-')
1210 devname=$(sys2dev "${sysblock}")
1211 fstype=$(get_fstype "${devname}")
1213 if /lib/udev/cdrom_id ${devname} > /dev/null
1215 if check_dev "null" "${devname}"
1219 elif is_nice_device "${sysblock}"
1221 for dev in $(subdevices "${sysblock}")
1223 if check_dev "${dev}"
1228 elif [ "${fstype}" = "squashfs" -o \
1229 "${fstype}" = "ext2" -o \
1230 "${fstype}" = "ext3" -o \
1231 "${fstype}" = "jffs2" ]
1233 # This is an ugly hack situation, the block device has
1234 # an image directly on it. It's hopefully
1235 # live-initramfs, so take it and run with it.
1236 ln -s "${devname}" "${devname}.${fstype}"
1237 echo "${devname}.${fstype}"
1245 set_usplash_timeout ()
1247 if [ -x /sbin/usplash_write ]
1249 /sbin/usplash_write "TIMEOUT 120"
1256 if [ -x /scripts/local-top/cryptroot ]; then
1257 /scripts/local-top/cryptroot
1268 [ "${quiet}" != "y" ] && log_begin_msg "Running /scripts/live-premount"
1269 run_scripts /scripts/live-premount
1270 [ "${quiet}" != "y" ] && log_end_msg
1272 # Needed here too because some things (*cough* udev *cough*)
1273 # changes the timeout
1277 if [ ! -z "${NETBOOT}" ] || [ ! -z "${FETCH}" ]
1281 livefs_root="${mountpoint}"
1283 panic "Unable to find a live file system on the network"
1286 if [ -n "${PLAIN_ROOT}" ] && [ -n "${ROOT}" ]
1288 # Do a local boot from hd
1291 # Scan local devices for the image
1292 for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
1294 livefs_root=$(find_livefs ${i})
1296 if [ -n "${livefs_root}" ]
1306 if [ -z "${livefs_root}" ]
1308 panic "Unable to find a medium containing a live file system"
1314 elif [ "${TODISK}" ]
1316 live_dest="${TODISK}"
1319 if [ "${live_dest}" ]
1321 log_begin_msg "Copying live media to ${live_dest}"
1322 copy_live_to "${livefs_root}" "${live_dest}"
1326 if [ -n "${MODULETORAMFILE}" ]
1328 setup_unionfs "${livefs_root}" "${rootmnt}"
1331 mac="$(echo ${mac} | sed 's/-//g')"
1332 mount_images_in_directory "${livefs_root}" "${rootmnt}" "${mac}"
1337 maybe_break live-bottom
1338 [ "${quiet}" != "y" ] && log_begin_msg "Running /scripts/live-bottom"
1340 run_scripts /scripts/live-bottom
1341 [ "${quiet}" != "y" ] && log_end_msg
1345 cp live.log "${rootmnt}/var/log/"