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/live-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}" "${2}")
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])"
563 copyto="${copyfrom}_swap"
565 if [ -z "${MODULETORAM}" ]
567 size=$(fs_size "" ${copyfrom} "used")
569 MODULETORAMFILE="${copyfrom}/${LIVE_MEDIA_PATH}/${MODULETORAM}"
571 if [ -f "${MODULETORAMFILE}" ]
573 size=$( expr $(ls -la ${MODULETORAMFILE} | awk '{print $5}') / 1024 + 5000 )
575 log_warning_msg "Error: toram-module ${MODULETORAM} (${MODULETORAMFILE}) could not be read."
580 if [ "${copytodev}" = "ram" ]
583 freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( cat /proc/meminfo | grep Cached | head -n 1 | awk '/Cached/{print $2}' - ) )
584 mount_options="-o size=${size}k"
589 # it should be a writable block device
590 if [ -b "${copytodev}" ]
594 fstype=$(get_fstype "${dev}")
595 freespace=$(fs_size "${dev}")
597 [ "$quiet" != "y" ] && log_warning_msg "${copytodev} is not a block device."
602 if [ "${freespace}" -lt "${size}" ]
604 [ "${quiet}" != "y" ] && log_warning_msg "Not enough free ${free_string} (${freespace}k free, ${size}k needed) to copy live media in ${copytodev}."
608 # begin copying (or uncompressing)
610 echo "mount -t ${fstype} ${mount_options} ${dev} ${copyto}"
611 mount -t "${fstype}" ${mount_options} "${dev}" "${copyto}"
613 if [ "${extension}" = "tgz" ]
616 tar zxf "${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
617 rm -f "${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
618 mount -r -o move "${copyto}" "${rootmnt}"
621 if [ -n "${MODULETORAMFILE}" ]
623 cp ${MODULETORAMFILE} ${copyto} # copy only the filesystem module
625 cp -a ${copyfrom}/* ${copyto} # "cp -a" from busybox also copies hidden files
630 mount -r -o move ${copyto} ${copyfrom}
641 modprobe -q af_packet # For DHCP
646 ipconfig ${DEVICE} | tee /netboot.config
648 # source relevant ipconfig output
649 OLDHOSTNAME=${HOSTNAME}
650 . /tmp/net-${DEVICE}.conf
651 [ -z ${HOSTNAME} ] && HOSTNAME=${OLDHOSTNAME}
654 if [ "${NFSROOT}" = "auto" ]
656 NFSROOT=${ROOTSERVER}:${ROOTPATH}
659 if [ -n "${FETCH}" ] && do_httpmount
665 if [ "${NFSROOT#*:}" = "${NFSROOT}" ] && [ "$NETBOOT" != "cifs" ]
667 NFSROOT=${ROOTSERVER}:${NFSROOT}
670 [ "${quiet}" != "y" ] && log_begin_msg "Trying netboot from ${NFSROOT}"
672 if [ "${NETBOOT}" != "nfs" ] && do_cifsmount
682 [ "${quiet}" != "y" ] && log_end_msg
689 extension=$(echo "${FETCH}" | sed 's/\(.*\)\.\(.*\)/\2/')
691 case "${extension}" in
693 [ "${quiet}" != "y" ] && log_begin_msg "Trying wget ${FETCH} -O ${mountpoint}/$(basename ${FETCH})"
694 mkdir -p "${mountpoint}/${LIVE_MEDIA_PATH}"
695 wget "${FETCH}" -O "${mountpoint}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
696 [ ${?} -eq 0 ] && rc=0
697 [ "${extension}" = "tgz" ] && live_dest="ram"
701 [ "${quiet}" != "y" ] && log_begin_msg "Unrecognized archive extension for ${FETCH}"
713 if [ -z "${NFSOPTS}" ]
718 [ "${quiet}" != "y" ] && log_begin_msg "Trying nfsmount -o nolock -o ro ${NFSOPTS} ${NFSROOT} ${mountpoint}"
720 # FIXME: This for loop is an ugly HACK round an nfs bug
721 for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13
723 nfsmount -o nolock -o ro ${NFSOPTS} "${NFSROOT}" "${mountpoint}" && rc=0 && break
734 if [ -x "/sbin/mount.cifs" ]
736 if [ -z "${NFSOPTS}" ]
738 CIFSOPTS="-ouser=root,password="
740 CIFSOPTS="${NFSOPTS}"
743 [ "${quiet}" != "y" ] && log_begin_msg "Trying mount.cifs ${NFSROOT} ${mountpoint} ${CIFSOPTS}"
746 if mount.cifs "${NFSROOT}" "${mountpoint}" "${CIFSOPTS}"
760 size=$(fs_size "${fromdev}" "" "used")
762 if [ -b "${fromdev}" ]
765 if [ -n "${HOMEMOUNTED}" -a "${snap_type}" = "HOME" ]
767 todev=$(cat /proc/mounts | grep -s " $(base_path ${todir}) " | awk '{print $1}' )
768 freespace=$(df -k | grep -s ${todev} | awk '{print $4}')
770 freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( cat /proc/meminfo | grep Cached | head -n 1 | awk '/Cached/{print $2}' - ))
773 tomount="/mnt/tmpsnap"
775 if [ ! -d "${tomount}" ]
777 mkdir -p "${tomount}"
780 fstype=$(get_fstype "${fromdev}")
782 if [ -n "${fstype}" ]
785 mount -t "${fstype}" -o ro,noatime "${fromdev}" "${tomount}"
786 cp -a "${tomount}"/* ${todir}
789 log_warning_msg "Unrecognized fstype: ${fstype} on ${fromdev}:${snap_type}"
794 if echo ${fromdev} | grep -qs loop
796 losetup -d "${fromdev}"
803 [ "${quiet}" != "y" ] && log_warning_msg "Unable to find the snapshot ${snap_type} medium"
809 # Look for ${snap_label}.* in block devices and copy the contents to ${snap_mount}
810 # and remember the device and filename for resync on exit in live-initramfs.init
815 snapdata=$(find_files "${snap_label}.squashfs ${snap_label}.cpio.gz ${snap_label}.ext2 ${snap_label}.ext3 ${snap_label}.jffs2")
817 if [ ! -z "${snapdata}" ]
819 snapdev="$(echo ${snapdata} | cut -f1 -d ' ')"
820 snapback="$(echo ${snapdata} | cut -f2 -d ' ')"
821 snapfile="$(echo ${snapdata} | cut -f3 -d ' ')"
823 if echo "${snapfile}" | grep -qs '\(squashfs\|ext2\|ext3\|jffs2\)'
825 # squashfs, jffs2 or ext2/ext3 snapshot
826 dev=$(get_backing_device "${snapback}/${snapfile}")
828 if ! do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
830 log_warning_msg "Impossible to include the ${snapfile} Snapshot"
835 if ! (cd "${snap_mount}" && zcat "${snapback}/${snapfile}" | cpio -i -u -d 2>/dev/null)
837 log_warning_msg "Impossible to include the ${snapfile} Snapshot"
844 dev=$(find_cow_device "${snap_label}")
848 if echo "${dev}" | grep -qs loop
850 # strange things happens, user confused?
851 snaploop=$( losetup ${dev} | awk '{print $3}' | tr -d '()' )
852 snapfile=$(basename ${snaploop})
853 snapdev=$(cat /proc/mounts | awk '{print $2,$1}' | grep -es "^$( dirname ${snaploop} )" | cut -f2 -d ' ')
858 if ! do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
860 log_warning_msg "Impossible to include the ${snap_label} Snapshot"
863 if [ -n "${snapfile}" ]
865 # it was a loop device, user confused
870 log_warning_msg "Impossible to include the ${snap_label} Snapshot"
875 echo "export ${snap_type}SNAP="${snap_mount}":${snapdev}:${snapfile}" >> /etc/live.conf # for resync on reboot/halt
881 image_directory="${1}"
883 addimage_directory="${3}"
884 modprobe -q -b ${UNIONTYPE}
886 # run-init can't deal with images in a subdir, but we're going to
887 # move all of these away before it runs anyway. No, we're not,
888 # put them in / since move-mounting them into / breaks mono and
893 # Let's just mount the read-only file systems first
896 minor_kernel_version=$(uname -r|cut -c 5-|sed 's/[^0-9].*//')
898 if [ "${NETBOOT}" = "nfs" ] && [ "${minor_kernel_version}" -lt 22 ]
900 # go aroung a bug in nfs-unionfs locking for unionfs <= 1.4
902 elif [ "${UNIONTYPE}" = "aufs" ]
909 # Read image names from ${MODULE}.module if it exists
910 if [ -e "${image_directory}/filesystem.${MODULE}.module" ]
912 for IMAGE in $(cat ${image_directory}/filesystem.${MODULE}.module)
914 image_string="${image_string} ${image_directory}/${IMAGE}"
916 elif [ -e "${image_directory}/${MODULE}.module" ]
918 for IMAGE in $(cat ${image_directory}/${MODULE}.module)
920 image_string="${image_string} ${image_directory}/${IMAGE}"
923 # ${MODULE}.module does not exist, create a list of images
924 for FILESYSTEM in squashfs ext2 ext3 xfs jffs2 dir
926 for IMAGE in "${image_directory}"/*."${FILESYSTEM}"
930 image_string="${image_string} ${IMAGE}"
935 if [ -n "${addimage_directory}" ] && [ -d "${addimage_directory}" ]
937 for FILESYSTEM in squashfs ext2 ext3 xfs jffs2 dir
939 for IMAGE in "${addimage_directory}"/*."${FILESYSTEM}"
943 image_string="${image_string} ${IMAGE}"
950 image_string="$(echo ${image_string} | sed -e 's/ /\n/g' | sort )"
953 [ -n "${MODULETORAMFILE}" ] && image_string="${image_directory}/$(basename ${MODULETORAMFILE})"
957 for image in ${image_string}
959 imagename=$(basename "${image}")
963 # it is a plain directory: do nothing
964 rofsstring="${image}=${roopt}:${rofsstring}"
965 rofslist="${image} ${rofslist}"
966 elif [ -f "${image}" ]
968 backdev=$(get_backing_device "${image}" "-r")
969 fstype=$(get_fstype "${backdev}")
971 if [ "${fstype}" = "unknown" ]
973 panic "Unknown file system type on ${backdev} (${image})"
976 mkdir -p "${croot}/${imagename}"
977 echo "debug: Mounting backdev \"${backdev}\" (image = ${image}) on croot/imagename \"${croot}/${imagename}\""
978 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}"
982 rofsstring=${rofsstring%:}
986 # Looking for "${root_persistence}" device or file
987 if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
990 num_block=$(ls -l /sys/block | wc -l)
991 for module in sd_mod uhci-hcd ehci-hcd ohci-hcd usb-storage
993 modprobe -q -b ${module}
999 # For some reason, udevsettle does not block in this scenario,
1000 # so we sleep for a little while.
1002 # See https://bugs.launchpad.net/ubuntu/+source/casper/+bug/84591
1003 for timeout in 5 4 3 2 1
1007 if [ $(ls -l /sys/block | wc -l) -gt ${num_block} ]
1013 cowprobe=$(find_cow_device "${root_persistence}")
1015 if [ -b "${cowprobe}" ]
1017 cowdevice=${cowprobe}
1018 cow_fstype=$(get_fstype "${cowprobe}")
1020 [ "${quiet}" != "y" ] && log_warning_msg "Unable to find the persistent medium"
1024 elif [ -n "${NFS_COW}" ] && [ -z "${NOPERSISTENT}" ]
1026 # check if there are any nfs options
1027 if echo ${NFS_COW}|grep -q ','
1029 nfs_cow_opts="-o nolock,$(echo ${NFS_COW}|cut -d, -f2-)"
1030 nfs_cow=$(echo ${NFS_COW}|cut -d, -f1)
1032 nfs_cow_opts="-o nolock"
1038 cowdevice=$(echo ${nfs_cow}|sed "s/client_mac_address/${mac}/")
1041 panic "unable to determine mac address"
1048 if [ "${cow_fstype}" = "nfs" ]
1050 [ "${quiet}" != "y" ] && log_begin_msg \
1051 "Trying nfsmount ${nfs_cow_opts} ${cowdevice} /cow"
1052 nfsmount ${nfs_cow_opts} ${cowdevice} /cow || \
1053 panic "Can not mount ${cowdevice} (n: ${cow_fstype}) on /cow"
1055 mount -t ${cow_fstype} -o rw,noatime ${cowdevice} /cow || \
1056 panic "Can not mount ${cowdevice} (o: ${cow_fstype}) on /cow"
1059 rofscount=$(echo ${rofslist} |wc -w)
1061 if [ -n "${EXPOSED_ROOT}" ]
1063 if [ ${rofscount} -ne 1 ]
1065 panic "only one RO file system supported with exposedroot: ${rofslist}"
1067 exposedrootfs=${rofslist%% }
1069 mount --bind ${exposedrootfs} ${rootmnt} || \
1070 panic "bind mount of ${exposedrootfs} failed"
1072 cow_dirs='/var/tmp /var/lock /var/run /var/log /var/spool
1073 /home /var/lib/live'
1075 for dir in ${cow_dirs}; do
1077 mount -t ${UNIONTYPE} \
1078 -o rw,noatime,dirs=/cow${dir}=rw:${exposedrootfs}${dir}=ro \
1079 ${UNIONTYPE} "${rootmnt}${dir}" || \
1080 panic "mount ${UNIONTYPE} on ${rootmnt}${dir} failed with option \
1081 rw,noatime,dirs=/cow${dir}=rw:${exposedrootfs}${dir}=ro"
1084 mount -t ${UNIONTYPE} -o noatime,dirs=/cow=rw:${rofsstring} \
1085 ${UNIONTYPE} "${rootmnt}" || panic "mount ${UNIONTYPE} on \
1086 ${rootmnt} failed with option noatime,dirs=/cow=rw:${rofsstring}"
1089 # tmpfs file systems
1090 mkdir -p "${rootmnt}/live"
1091 mount -t tmpfs tmpfs ${rootmnt}/live
1093 # Adding other custom mounts
1094 if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
1096 # directly mount /home
1097 # FIXME: add a custom mounts configurable system
1098 homecow=$(find_cow_device "${home_persistence}" )
1100 if [ -b "${homecow}" ]
1102 mount -t $(get_fstype "${homecow}") -o rw,noatime "${homecow}" "${rootmnt}/home"
1103 export HOMEMOUNTED=1 # used to proper calculate free space in do_snap_copy()
1105 [ "${quiet}" != "y" ] && log_warning_msg "Unable to find the persistent home medium"
1108 # Look for other snapshots to copy in
1109 try_snap "${root_snapshot_label}" "${rootmnt}" "ROOT"
1110 try_snap "${home_snapshot_label}" "${rootmnt}/home" "HOME"
1113 if [ -n "${SHOWMOUNTS}" ]
1115 for d in ${rofslist}
1117 mkdir -p "${rootmnt}/live/${d##*/}"
1121 # do nothing # mount -o bind "${d}" "${rootmnt}/live/${d##*/}"
1125 mount -o move "${d}" "${rootmnt}/live/${d##*/}"
1131 # shows cow fs on /cow for use by live-snapshot
1132 mkdir -p "${rootmnt}/live/cow"
1133 mount -o move /cow "${rootmnt}/live/cow"
1140 skip_uuid_check="${3}"
1142 if [ -z "${devname}" ]
1144 devname=$(sys2dev "${sysdev}")
1147 if [ -n "${LIVE_MEDIA_OFFSET}" ]
1149 loopdevname=$(setup_loop "${devname}" "loop" "/sys/block/loop*" "${LIVE_MEDIA_OFFSET}" '')
1150 devname="${loopdevname}"
1153 if [ -d "${devname}" ]
1155 mount -o bind "${devname}" $mountpoint || continue
1157 if is_live_path $mountpoint
1166 fstype=$(get_fstype "${devname}")
1168 if is_supported_fs ${fstype}
1170 mount -t ${fstype} -o ro,noatime "${devname}" ${mountpoint} || continue
1172 if is_live_path ${mountpoint} && \
1173 ([ "${skip_uuid_check}" ] || matches_uuid ${mountpoint})
1178 umount ${mountpoint}
1182 if [ -n "${LIVE_MEDIA_OFFSET}" ]
1184 losetup -d "${loopdevname}"
1194 # first look at the one specified in the command line
1195 if [ ! -z "${LIVE_MEDIA}" ]
1197 if check_dev "null" "${LIVE_MEDIA}" "skip_uuid_check"
1203 # don't start autodetection before timeout has expired
1204 if [ -n "${LIVE_MEDIA_TIMEOUT}" ]
1206 if [ "${timeout}" -lt "${LIVE_MEDIA_TIMEOUT}" ]
1212 # or do the scan of block devices
1213 for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop | grep -v ram | grep -v 'dm-' | grep -v fd )
1215 devname=$(sys2dev "${sysblock}")
1216 fstype=$(get_fstype "${devname}")
1218 if /lib/udev/cdrom_id ${devname} > /dev/null
1220 if check_dev "null" "${devname}"
1224 elif is_nice_device "${sysblock}"
1226 for dev in $(subdevices "${sysblock}")
1228 if check_dev "${dev}"
1233 elif [ "${fstype}" = "squashfs" -o \
1234 "${fstype}" = "ext2" -o \
1235 "${fstype}" = "ext3" -o \
1236 "${fstype}" = "jffs2" ]
1238 # This is an ugly hack situation, the block device has
1239 # an image directly on it. It's hopefully
1240 # live-initramfs, so take it and run with it.
1241 ln -s "${devname}" "${devname}.${fstype}"
1242 echo "${devname}.${fstype}"
1250 set_usplash_timeout ()
1252 if [ -x /sbin/usplash_write ]
1254 /sbin/usplash_write "TIMEOUT 120"
1261 if [ -x /scripts/local-top/cryptroot ]; then
1262 /scripts/local-top/cryptroot
1269 tail -f live.log >&7 &
1275 [ "${quiet}" != "y" ] && log_begin_msg "Running /scripts/live-premount"
1276 run_scripts /scripts/live-premount
1277 [ "${quiet}" != "y" ] && log_end_msg
1279 # Needed here too because some things (*cough* udev *cough*)
1280 # changes the timeout
1284 if [ ! -z "${NETBOOT}" ] || [ ! -z "${FETCH}" ]
1288 livefs_root="${mountpoint}"
1290 panic "Unable to find a live file system on the network"
1293 if [ -n "${PLAIN_ROOT}" ] && [ -n "${ROOT}" ]
1295 # Do a local boot from hd
1298 # Scan local devices for the image
1299 for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
1301 livefs_root=$(find_livefs ${i})
1303 if [ -n "${livefs_root}" ]
1313 if [ -z "${livefs_root}" ]
1315 panic "Unable to find a medium containing a live file system"
1321 elif [ "${TODISK}" ]
1323 live_dest="${TODISK}"
1326 if [ "${live_dest}" ]
1328 log_begin_msg "Copying live media to ${live_dest}"
1329 copy_live_to "${livefs_root}" "${live_dest}"
1333 if [ -n "${MODULETORAMFILE}" ]
1335 setup_unionfs "${livefs_root}" "${rootmnt}"
1338 mac="$(echo ${mac} | sed 's/-//g')"
1339 mount_images_in_directory "${livefs_root}" "${rootmnt}" "${mac}"
1344 maybe_break live-bottom
1345 [ "${quiet}" != "y" ] && log_begin_msg "Running /scripts/live-bottom"
1347 run_scripts /scripts/live-bottom
1348 [ "${quiet}" != "y" ] && log_end_msg
1353 cp live.log "${rootmnt}/var/log/"