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 language=*|debian-installer/language=*)
158 language=${x#debian-installer/language=}
159 locale="$(lang2locale "$language")"
163 locale=*|debian-installer/locale=*)
164 LOCALE="${ARGUMENT#*=}"
169 MODULE="${ARGUMENT#module=}"
174 NETBOOT="${ARGUMENT#netboot=}"
179 NFSOPTS="${ARGUMENT#nfsopts=}"
184 NFS_COW="${ARGUMENT#nfscow=}"
189 NOACCESSIBILITY="Yes"
190 export NOACCESSIBILITY
214 NOCONSOLEKEYBOARD="Yes"
215 export NOCONSOLEKEYBOARD
239 NOKPERSONALIZER="Yes"
240 export NOKPERSONALIZER
244 NOLANGUAGESELECTOR="Yes"
245 export NOLANGUAGESELECTOR
259 NOPOWERMANAGEMENT="Yes"
260 export NOPOWERMANAGEMENT
264 NOPROGRAMCRASHES="Yes"
265 export NOPROGRAMCRASHES
269 NORESTRICTEDMANAGER="Yes"
270 export NORESTRICTEDMANAGER
284 NOUPDATENOTIFIER="Yes"
285 export NOUPDATENOTIFIER
300 export NOXSCREENSAVER
313 preseed/file=*|file=*)
314 LOCATION="${ARGUMENT#*=}"
324 location="${ARGUMENT#url=}"
326 mount -n -o bind /sys /root/sys
327 mount -n -o bind /proc /root/proc
328 mount -n -o bind /dev /root/dev
330 mkdir -p /root/var/run/network
331 chroot /root dhclient eth0
332 chroot /root wget -P /tmp "${location}"
333 chroot /root ifconfig eth0 down
339 LOCATION="/tmp/$(basename "${location}")"
343 question="${ARGUMENT%%=*}"
344 value="${ARGUMENT#*=}"
345 PRESEEDS="${PRESEEDS}\"${question}=${value}\" "
360 TIMEZONE="${ARGUMENT#timezone=}"
370 TODISK="${ARGUMENT#todisk=}"
381 MODULETORAM="${ARGUMENT#toram=}"
382 export TORAM MODULETORAM
396 ROOT="${ARGUMENT#root=}"
401 UNIONTYPE="${ARGUMENT#union=}"
406 UTC="${ARGUMENT#utc=}"
416 XDRIVER="${ARGUMENT#xdriver=}"
421 XVIDEOMODE="${ARGUMENT#xvideomode=}"
427 # sort of compatibility with netboot.h from linux docs
428 if [ -z "${NETBOOT}" ]
430 if [ "${ROOT}" = "/dev/nfs" ]
434 elif [ "${ROOT}" = "/dev/cifs" ]
441 if [ -z "${MODULE}" ]
447 if [ -z "${UNIONTYPE}" ]
458 if [ -d "${DIRECTORY}"/"${LIVE_MEDIA_PATH}" ]
460 for FILESYSTEM in squashfs ext2 ext3 xfs dir jffs2
462 if [ "$(echo ${DIRECTORY}/${LIVE_MEDIA_PATH}/*.${FILESYSTEM})" != "${DIRECTORY}/${LIVE_MEDIA_PATH}/*.${FILESYSTEM}" ]
474 if [ "${IGNORE_UUID}" ] || [ ! -e /conf/uuid.conf ]
480 uuid="$(cat /conf/uuid.conf)"
482 for try_uuid_file in "${mountpoint}/.disk/casper-uuid"*
484 [ -e "${try_uuid_file}" ] || continue
486 try_uuid="$(cat "${try_uuid_file}")"
488 if [ "${uuid}" = "${try_uuid}" ]
497 get_backing_device ()
500 *.squashfs|*.ext2|*.ext3|*.jffs2)
501 echo $(setup_loop "${1}" "loop" "/sys/block/loop*" '0' "${LIVE_MEDIA_ENCRYPTION}")
509 panic "Unrecognized live filesystem: ${1}"
514 match_files_in_dir ()
516 # Does any files match pattern ${1} ?
519 if [ "$(echo ${pattern})" != "${pattern}" ]
527 mount_images_in_directory ()
534 if match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.squashfs" ||
535 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext2" ||
536 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext3" ||
537 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.jffs2" ||
538 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.dir"
540 [ -n "${mac}" ] && adddirectory="${directory}/${LIVE_MEDIA_PATH}/${mac}"
541 setup_unionfs "${directory}/${LIVE_MEDIA_PATH}" "${rootmnt}" "${adddirectory}"
549 sysfs_path="${1#/sys}"
551 if /lib/udev/path_id "${sysfs_path}" | grep -E -q "ID_PATH=(usb|pci-[^-]*-[ide|scsi|usb])"
561 # FIXME: do something better like the scan of supported filesystems
565 vfat|iso9660|udf|ext2|ext3|ntfs|jffs2)
577 copyto="${copyfrom}_swap"
579 if [ -z "${MODULETORAM}" ]
581 size=$(fs_size "" ${copyfrom} "used")
583 MODULETORAMFILE="${copyfrom}/${LIVE_MEDIA_PATH}/${MODULETORAM}"
585 if [ -f "${MODULETORAMFILE}" ]
587 size=$( expr $(ls -la ${MODULETORAMFILE} | awk '{print $5}') / 1024 + 5000 )
589 log_warning_msg "Error: toram-module ${MODULETORAM} (${MODULETORAMFILE}) could not be read."
594 if [ "${copytodev}" = "ram" ]
597 freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( cat /proc/meminfo | grep Cached | head -n 1 | awk '/Cached/{print $2}' - ) )
598 mount_options="-o size=${size}k"
603 # it should be a writable block device
604 if [ -b "${copytodev}" ]
608 fstype=$(get_fstype "${dev}")
609 freespace=$(fs_size "${dev}")
611 [ "$quiet" != "y" ] && log_warning_msg "${copytodev} is not a block device."
616 if [ "${freespace}" -lt "${size}" ]
618 [ "${quiet}" != "y" ] && log_warning_msg "Not enough free ${free_string} (${freespace}k free, ${size}k needed) to copy live media in ${copytodev}."
622 # begin copying (or uncompressing)
624 echo "mount -t ${fstype} ${mount_options} ${dev} ${copyto}"
625 mount -t "${fstype}" ${mount_options} "${dev}" "${copyto}"
627 if [ "${extension}" = "tgz" ]
630 tar zxf "${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
631 rm -f "${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
632 mount -r --move "${copyto}" "${rootmnt}"
635 if [ -n "${MODULETORAMFILE}" ]
637 cp ${MODULETORAMFILE} ${copyto} # copy only the filesystem module
639 cp -a ${copyfrom}/* ${copyto} # "cp -a" from busybox also copies hidden files
644 mount -r --move ${copyto} ${copyfrom}
655 modprobe -q af_packet # For DHCP
660 ipconfig ${DEVICE} | tee /netboot.config
662 # source relevant ipconfig output
663 OLDHOSTNAME=${HOSTNAME}
664 . /tmp/net-${DEVICE}.conf
665 [ -z ${HOSTNAME} ] && HOSTNAME=${OLDHOSTNAME}
668 if [ "${NFSROOT}" = "auto" ]
670 NFSROOT=${ROOTSERVER}:${ROOTPATH}
673 if [ -n "${FETCH}" ] && do_httpmount
679 if [ "${NFSROOT#*:}" = "${NFSROOT}" ] && [ "$NETBOOT" != "cifs" ]
681 NFSROOT=${ROOTSERVER}:${NFSROOT}
684 [ "${quiet}" != "y" ] && log_begin_msg "Trying netboot from ${NFSROOT}"
686 if [ "${NETBOOT}" != "nfs" ] && do_cifsmount
696 [ "${quiet}" != "y" ] && log_end_msg
703 extension=$(echo "${FETCH}" | sed 's/\(.*\)\.\(.*\)/\2/')
705 case "${extension}" in
707 [ "${quiet}" != "y" ] && log_begin_msg "Trying wget ${FETCH} -O ${mountpoint}/$(basename ${FETCH})"
708 mkdir -p "${mountpoint}/${LIVE_MEDIA_PATH}"
709 wget "${FETCH}" -O "${mountpoint}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
710 [ ${?} -eq 0 ] && rc=0
711 [ "${extension}" = "tgz" ] && live_dest="ram"
715 [ "${quiet}" != "y" ] && log_begin_msg "Unrecognized archive extension for ${FETCH}"
727 if [ -z "${NFSOPTS}" ]
732 [ "${quiet}" != "y" ] && log_begin_msg "Trying nfsmount -o nolock -o ro ${NFSOPTS} ${NFSROOT} ${mountpoint}"
734 # FIXME: This for loop is an ugly HACK round an nfs bug
735 for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13
737 nfsmount -o nolock -o ro ${NFSOPTS} "${NFSROOT}" "${mountpoint}" && rc=0 && break
748 if [ -x "/sbin/mount.cifs" ]
750 if [ -z "${NFSOPTS}" ]
752 CIFSOPTS="-ouser=root,password="
754 CIFSOPTS="${NFSOPTS}"
757 [ "${quiet}" != "y" ] && log_begin_msg "Trying mount.cifs ${NFSROOT} ${mountpoint} ${CIFSOPTS}"
760 if mount.cifs "${NFSROOT}" "${mountpoint}" "${CIFSOPTS}"
774 size=$(fs_size "${fromdev}" "" "used")
776 if [ -b "${fromdev}" ]
779 if [ -n "${HOMEMOUNTED}" -a "${snap_type}" = "HOME" ]
781 todev=$(cat /proc/mounts | grep -s " $(base_path ${todir}) " | awk '{print $1}' )
782 freespace=$(df -k | grep -s ${todev} | awk '{print $4}')
784 freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( cat /proc/meminfo | grep Cached | head -n 1 | awk '/Cached/{print $2}' - ))
787 tomount="/mnt/tmpsnap"
789 if [ ! -d "${tomount}" ]
791 mkdir -p "${tomount}"
794 fstype=$(get_fstype "${fromdev}")
796 if [ -n "${fstype}" ]
799 mount -t "${fstype}" -o ro,noatime "${fromdev}" "${tomount}"
800 cp -a "${tomount}"/* ${todir}
803 log_warning_msg "Unrecognized fstype: ${fstype} on ${fromdev}:${snap_type}"
808 if echo ${fromdev} | grep -qs loop
810 losetup -d "${fromdev}"
817 [ "${quiet}" != "y" ] && log_warning_msg "Unable to find the snapshot ${snap_type} medium"
823 # Look for ${snap_label}.* in block devices and copy the contents to ${snap_mount}
824 # and remember the device and filename for resync on exit in live-initramfs.init
829 snapdata=$(find_files "${snap_label}.squashfs ${snap_label}.cpio.gz ${snap_label}.ext2 ${snap_label}.ext3 ${snap_label}.jffs2")
831 if [ ! -z "${snapdata}" ]
833 snapdev="$(echo ${snapdata} | cut -f1 -d ' ')"
834 snapback="$(echo ${snapdata} | cut -f2 -d ' ')"
835 snapfile="$(echo ${snapdata} | cut -f3 -d ' ')"
837 if echo "${snapfile}" | grep -qs '\(squashfs\|ext2\|ext3\|jffs2\)'
839 # squashfs, jffs2 or ext2/ext3 snapshot
840 dev=$(get_backing_device "${snapback}/${snapfile}")
842 if ! do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
844 log_warning_msg "Impossible to include the ${snapfile} Snapshot"
849 if ! (cd "${snap_mount}" && zcat "${snapback}/${snapfile}" | cpio -i -u -d 2>/dev/null)
851 log_warning_msg "Impossible to include the ${snapfile} Snapshot"
858 dev=$(find_cow_device "${snap_label}")
862 if echo "${dev}" | grep -qs loop
864 # strange things happens, user confused?
865 snaploop=$( losetup ${dev} | awk '{print $3}' | tr -d '()' )
866 snapfile=$(basename ${snaploop})
867 snapdev=$(cat /proc/mounts | awk '{print $2,$1}' | grep -es "^$( dirname ${snaploop} )" | cut -f2 -d ' ')
872 if ! do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
874 log_warning_msg "Impossible to include the ${snap_label} Snapshot"
877 if [ -n "${snapfile}" ]
879 # it was a loop device, user confused
884 log_warning_msg "Impossible to include the ${snap_label} Snapshot"
889 echo "export ${snap_type}SNAP="${snap_mount}":${snapdev}:${snapfile}" >> /etc/live.conf # for resync on reboot/halt
895 image_directory="${1}"
897 addimage_directory="${3}"
898 modprobe -q -b ${UNIONTYPE}
900 # run-init can't deal with images in a subdir, but we're going to
901 # move all of these away before it runs anyway. No, we're not,
902 # put them in / since move-mounting them into / breaks mono and
907 # Let's just mount the read-only file systems first
910 minor_kernel_version=$(uname -r|cut -c 5-|sed 's/[^0-9].*//')
912 if [ "${NETBOOT}" = "nfs" ] && [ "${minor_kernel_version}" -lt 22 ]
914 # go aroung a bug in nfs-unionfs locking for unionfs <= 1.4
916 elif [ "${UNIONTYPE}" = "aufs" ]
923 # Read image names from ${MODULE}.module if it exists
924 if [ -e "${image_directory}/filesystem.${MODULE}.module" ]
926 for IMAGE in $(cat ${image_directory}/filesystem.${MODULE}.module)
928 image_string="${image_string} ${image_directory}/${IMAGE}"
930 elif [ -e "${image_directory}/${MODULE}.module" ]
932 for IMAGE in $(cat ${image_directory}/${MODULE}.module)
934 image_string="${image_string} ${image_directory}/${IMAGE}"
937 # ${MODULE}.module does not exist, create a list of images
938 for FILESYSTEM in squashfs ext2 ext3 xfs jffs2 dir
940 for IMAGE in "${image_directory}"/*."${FILESYSTEM}"
944 image_string="${image_string} ${IMAGE}"
949 if [ -n "${addimage_directory}" ] && [ -d "${addimage_directory}" ]
951 for FILESYSTEM in squashfs ext2 ext3 xfs jffs2 dir
953 for IMAGE in "${addimage_directory}"/*."${FILESYSTEM}"
957 image_string="${image_string} ${IMAGE}"
964 image_string="$(echo ${image_string} | sed -e 's/ /\n/g' | sort )"
967 [ -n "${MODULETORAMFILE}" ] && image_string="${image_directory}/$(basename ${MODULETORAMFILE})"
971 for image in ${image_string}
973 imagename=$(basename "${image}")
977 # it is a plain directory: do nothing
978 rofsstring="${image}=${roopt}:${rofsstring}"
979 rofslist="${image} ${rofslist}"
980 elif [ -f "${image}" ]
982 backdev=$(get_backing_device "${image}")
983 fstype=$(get_fstype "${backdev}")
985 if [ "${fstype}" = "unknown" ]
987 panic "Unknown file system type on ${backdev} (${image})"
990 mkdir -p "${croot}/${imagename}"
991 echo "debug: Mounting backdev \"${backdev}\" (image = ${image}) on croot/imagename \"${croot}/${imagename}\""
992 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}"
996 rofsstring=${rofsstring%:}
1000 # Looking for "${root_persistence}" device or file
1001 if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
1004 num_block=$(ls -l /sys/block | wc -l)
1005 for module in sd_mod uhci-hcd ehci-hcd ohci-hcd usb-storage
1007 modprobe -q -b ${module}
1013 # For some reason, udevsettle does not block in this scenario,
1014 # so we sleep for a little while.
1016 # See https://bugs.launchpad.net/ubuntu/+source/casper/+bug/84591
1017 for timeout in 5 4 3 2 1
1021 if [ $(ls -l /sys/block | wc -l) -gt ${num_block} ]
1027 cowprobe=$(find_cow_device "${root_persistence}")
1029 if [ -b "${cowprobe}" ]
1031 cowdevice=${cowprobe}
1032 cow_fstype=$(get_fstype "${cowprobe}")
1034 [ "${quiet}" != "y" ] && log_warning_msg "Unable to find the persistent medium"
1038 elif [ -n "${NFS_COW}" ] && [ -z "${NOPERSISTENT}" ]
1040 # check if there are any nfs options
1041 if echo ${NFS_COW}|grep -q ','
1043 nfs_cow_opts="-o nolock,$(echo ${NFS_COW}|cut -d, -f2-)"
1044 nfs_cow=$(echo ${NFS_COW}|cut -d, -f1)
1046 nfs_cow_opts="-o nolock"
1052 cowdevice=$(echo ${nfs_cow}|sed "s/client_mac_address/${mac}/")
1055 panic "unable to determine mac address"
1062 if [ "${cow_fstype}" = "nfs" ]
1064 [ "${quiet}" != "y" ] && log_begin_msg \
1065 "Trying nfsmount ${nfs_cow_opts} ${cowdevice} /cow"
1066 nfsmount ${nfs_cow_opts} ${cowdevice} /cow || \
1067 panic "Can not mount ${cowdevice} (n: ${cow_fstype}) on /cow"
1069 mount -t ${cow_fstype} -o rw,noatime ${cowdevice} /cow || \
1070 panic "Can not mount ${cowdevice} (o: ${cow_fstype}) on /cow"
1073 rofscount=$(echo ${rofslist} |wc -w)
1075 if [ -n "${EXPOSED_ROOT}" ]
1077 if [ ${rofscount} -ne 1 ]
1079 panic "only one RO file system supported with exposedroot: ${rofslist}"
1081 exposedrootfs=${rofslist%% }
1083 mount --bind ${exposedrootfs} ${rootmnt} || \
1084 panic "bind mount of ${exposedrootfs} failed"
1086 cow_dirs='/var/tmp /var/lock /var/run /var/log /var/spool
1087 /home /var/lib/live'
1089 for dir in ${cow_dirs}; do
1091 mount -t ${UNIONTYPE} \
1092 -o rw,noatime,dirs=/cow${dir}=rw:${exposedrootfs}${dir}=ro \
1093 ${UNIONTYPE} "${rootmnt}${dir}" || \
1094 panic "mount ${UNIONTYPE} on ${rootmnt}${dir} failed with option \
1095 rw,noatime,dirs=/cow${dir}=rw:${exposedrootfs}${dir}=ro"
1098 mount -t ${UNIONTYPE} -o noatime,dirs=/cow=rw:${rofsstring} \
1099 ${UNIONTYPE} "${rootmnt}" || panic "mount ${UNIONTYPE} on \
1100 ${rootmnt} failed with option noatime,dirs=/cow=rw:${rofsstring}"
1103 # tmpfs file systems
1104 mkdir -p "${rootmnt}/live"
1105 mount -t tmpfs tmpfs ${rootmnt}/live
1107 # Adding other custom mounts
1108 if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
1110 # directly mount /home
1111 # FIXME: add a custom mounts configurable system
1112 homecow=$(find_cow_device "${home_persistence}" )
1114 if [ -b "${homecow}" ]
1116 mount -t $(get_fstype "${homecow}") -o rw,noatime "${homecow}" "${rootmnt}/home"
1117 export HOMEMOUNTED=1 # used to proper calculate free space in do_snap_copy()
1119 [ "${quiet}" != "y" ] && log_warning_msg "Unable to find the persistent home medium"
1122 # Look for other snapshots to copy in
1123 try_snap "${root_snapshot_label}" "${rootmnt}" "ROOT"
1124 try_snap "${home_snapshot_label}" "${rootmnt}/home" "HOME"
1127 if [ -n "${SHOWMOUNTS}" ]
1129 for d in ${rofslist}
1131 mkdir -p "${rootmnt}/live/${d##*/}"
1135 # do nothing # mount -o bind "${d}" "${rootmnt}/live/${d##*/}"
1139 mount --move "${d}" "${rootmnt}/live/${d##*/}"
1145 # shows cow fs on /cow for use by live-snapshot
1146 mkdir -p "${rootmnt}/live/cow"
1147 mount -o move /cow "${rootmnt}/live/cow"
1154 skip_uuid_check="${3}"
1156 if [ -z "${devname}" ]
1158 devname=$(sys2dev "${sysdev}")
1161 if [ -n "${LIVE_MEDIA_OFFSET}" ]
1163 loopdevname=$(setup_loop "${devname}" "loop" "/sys/block/loop*" "${LIVE_MEDIA_OFFSET}" '')
1164 devname="${loopdevname}"
1167 fstype=$(get_fstype "${devname}")
1169 if is_supported_fs ${fstype}
1171 mount -t ${fstype} -o ro,noatime "${devname}" ${mountpoint} || continue
1173 if is_live_path ${mountpoint} && \
1174 ([ "${skip_uuid_check}" ] || matches_uuid ${mountpoint})
1179 umount ${mountpoint}
1183 if [ -n "${LIVE_MEDIA_OFFSET}" ]
1185 losetup -d "${loopdevname}"
1195 # first look at the one specified in the command line
1196 if [ ! -z "${LIVE_MEDIA}" ]
1198 if check_dev "null" "${LIVE_MEDIA}" "skip_uuid_check"
1204 # don't start autodetection before timeout has expired
1205 if [ -n "${LIVE_MEDIA_TIMEOUT}" ]
1207 if [ "${timeout}" -lt "${LIVE_MEDIA_TIMEOUT}" ]
1213 # or do the scan of block devices
1214 for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop | grep -v ram | grep -v 'dm-' | grep -v fd )
1216 devname=$(sys2dev "${sysblock}")
1217 fstype=$(get_fstype "${devname}")
1219 if /lib/udev/cdrom_id ${devname} > /dev/null
1221 if check_dev "null" "${devname}"
1225 elif is_nice_device "${sysblock}"
1227 for dev in $(subdevices "${sysblock}")
1229 if check_dev "${dev}"
1234 elif [ "${fstype}" = "squashfs" -o \
1235 "${fstype}" = "ext2" -o \
1236 "${fstype}" = "ext3" -o \
1237 "${fstype}" = "jffs2" ]
1239 # This is an ugly hack situation, the block device has
1240 # an image directly on it. It's hopefully
1241 # live-initramfs, so take it and run with it.
1242 ln -s "${devname}" "${devname}.${fstype}"
1243 echo "${devname}.${fstype}"
1251 set_usplash_timeout ()
1253 if [ -x /sbin/usplash_write ]
1255 /sbin/usplash_write "TIMEOUT 120"
1262 if [ -x /scripts/local-top/cryptroot ]; then
1263 /scripts/local-top/cryptroot
1270 tail -f live.log >&7 &
1276 [ "${quiet}" != "y" ] && log_begin_msg "Running /scripts/live-premount"
1277 run_scripts /scripts/live-premount
1278 [ "${quiet}" != "y" ] && log_end_msg
1280 # Needed here too because some things (*cough* udev *cough*)
1281 # changes the timeout
1285 if [ ! -z "${NETBOOT}" ] || [ ! -z "${FETCH}" ]
1289 livefs_root="${mountpoint}"
1291 panic "Unable to find a live file system on the network"
1294 if [ -n "${PLAIN_ROOT}" ] && [ -n "${ROOT}" ]
1296 # Do a local boot from hd
1299 # Scan local devices for the image
1300 for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
1302 livefs_root=$(find_livefs ${i})
1304 if [ -n "${livefs_root}" ]
1314 if [ -z "${livefs_root}" ]
1316 panic "Unable to find a medium containing a live file system"
1322 elif [ "${TODISK}" ]
1324 live_dest="${TODISK}"
1327 if [ "${live_dest}" ]
1329 log_begin_msg "Copying live media to ${live_dest}"
1330 copy_live_to "${livefs_root}" "${live_dest}"
1334 if [ -n "${MODULETORAMFILE}" ]
1336 setup_unionfs "${livefs_root}" "${rootmnt}"
1339 mac="$(echo ${mac} | sed 's/-//g')"
1340 mount_images_in_directory "${livefs_root}" "${rootmnt}" "${mac}"
1345 maybe_break live-bottom
1346 [ "${quiet}" != "y" ] && log_begin_msg "Running /scripts/live-bottom"
1348 run_scripts /scripts/live-bottom
1349 [ "${quiet}" != "y" ] && log_end_msg
1354 cp live.log "${rootmnt}/var/log/"