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 FTPFS="${ARGUMENT#ftpfs=}"
74 HTTPFS="${ARGUMENT#httpfs=}"
79 HOSTNAME="${ARGUMENT#hostname=}"
81 export HOSTNAME LIVECONF
85 USERNAME="${ARGUMENT#username=}"
87 export USERNAME LIVECONF
91 USERFULLNAME="${ARGUMENT#userfullname=}"
93 export USERFULLNAME LIVECONF
102 STATICIP="${ARGUMENT#ip=}"
104 if [ -z "${STATICIP}" ]
112 keyb=*|kbd-chooser/method=*)
117 klayout=*|console-setup/layoutcode=*)
118 KLAYOUT="${ARGUMENT#*=}"
122 kvariant=*|console-setup/variantcode=*)
123 KVARIANT="${ARGUMENT#*=}"
127 kmodel=*|console-setup/modelcode=*)
128 KMODEL="${ARGUMENT#*=}"
133 KOPTIONS="${ARGUMENT#koptions=}"
142 live-media=*|bootfrom=*)
143 LIVE_MEDIA="${ARGUMENT#*=}"
147 live-media-encryption=*|encryption=*)
148 LIVE_MEDIA_ENCRYPTION="${ARGUMENT#*=}"
149 export LIVE_MEDIA_ENCRYPTION
153 LIVE_MEDIA_OFFSET="${ARGUMENT#live-media-offset=}"
154 export LIVE_MEDIA_OFFSET
158 LIVE_MEDIA_PATH="${ARGUMENT#live-media-path=}"
159 export LIVE_MEDIA_PATH
162 live-media-timeout=*)
163 LIVE_MEDIA_TIMEOUT="${ARGUMENT#live-media-timeout=}"
164 export LIVE_MEDIA_TIMEOUT
167 language=*|debian-installer/language=*)
168 language=${x#debian-installer/language=}
169 locale="$(lang2locale "$language")"
173 locale=*|debian-installer/locale=*)
174 LOCALE="${ARGUMENT#*=}"
179 MODULE="${ARGUMENT#module=}"
184 NETBOOT="${ARGUMENT#netboot=}"
189 NFSOPTS="${ARGUMENT#nfsopts=}"
194 NFS_COW="${ARGUMENT#nfscow=}"
199 NOACCESSIBILITY="Yes"
200 export NOACCESSIBILITY
224 NOCONSOLEKEYBOARD="Yes"
225 export NOCONSOLEKEYBOARD
249 NOKPERSONALIZER="Yes"
250 export NOKPERSONALIZER
254 NOLANGUAGESELECTOR="Yes"
255 export NOLANGUAGESELECTOR
269 NOPOWERMANAGEMENT="Yes"
270 export NOPOWERMANAGEMENT
274 NOPROGRAMCRASHES="Yes"
275 export NOPROGRAMCRASHES
279 NORESTRICTEDMANAGER="Yes"
280 export NORESTRICTEDMANAGER
294 NOUPDATENOTIFIER="Yes"
295 export NOUPDATENOTIFIER
310 export NOXSCREENSAVER
323 preseed/file=*|file=*)
324 LOCATION="${ARGUMENT#*=}"
334 location="${ARGUMENT#url=}"
336 mount -n -o bind /sys /root/sys
337 mount -n -o bind /proc /root/proc
338 mount -n -o bind /dev /root/dev
340 mkdir -p /root/var/run/network
341 chroot /root dhclient eth0
342 chroot /root wget -P /tmp "${location}"
343 chroot /root ifconfig eth0 down
349 LOCATION="/tmp/$(basename "${location}")"
353 question="${ARGUMENT%%=*}"
354 value="${ARGUMENT#*=}"
355 PRESEEDS="${PRESEEDS}\"${question}=${value}\" "
370 TIMEZONE="${ARGUMENT#timezone=}"
380 TODISK="${ARGUMENT#todisk=}"
391 MODULETORAM="${ARGUMENT#toram=}"
392 export TORAM MODULETORAM
406 ROOT="${ARGUMENT#root=}"
411 UNIONTYPE="${ARGUMENT#union=}"
416 UTC="${ARGUMENT#utc=}"
426 XDRIVER="${ARGUMENT#xdriver=}"
431 XVIDEOMODE="${ARGUMENT#xvideomode=}"
437 # sort of compatibility with netboot.h from linux docs
438 if [ -z "${NETBOOT}" ]
440 if [ "${ROOT}" = "/dev/nfs" ]
444 elif [ "${ROOT}" = "/dev/cifs" ]
451 if [ -z "${MODULE}" ]
457 if [ -z "${UNIONTYPE}" ]
468 if [ -d "${DIRECTORY}"/"${LIVE_MEDIA_PATH}" ]
470 for FILESYSTEM in squashfs ext2 ext3 xfs dir jffs2
472 if [ "$(echo ${DIRECTORY}/${LIVE_MEDIA_PATH}/*.${FILESYSTEM})" != "${DIRECTORY}/${LIVE_MEDIA_PATH}/*.${FILESYSTEM}" ]
484 if [ "${IGNORE_UUID}" ] || [ ! -e /conf/uuid.conf ]
490 uuid="$(cat /conf/uuid.conf)"
492 for try_uuid_file in "${mountpoint}/.disk/live-uuid"*
494 [ -e "${try_uuid_file}" ] || continue
496 try_uuid="$(cat "${try_uuid_file}")"
498 if [ "${uuid}" = "${try_uuid}" ]
507 get_backing_device ()
510 *.squashfs|*.ext2|*.ext3|*.jffs2)
511 echo $(setup_loop "${1}" "loop" "/sys/block/loop*" '0' "${LIVE_MEDIA_ENCRYPTION}" "${2}")
519 panic "Unrecognized live filesystem: ${1}"
524 match_files_in_dir ()
526 # Does any files match pattern ${1} ?
529 if [ "$(echo ${pattern})" != "${pattern}" ]
537 mount_images_in_directory ()
544 if match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.squashfs" ||
545 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext2" ||
546 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext3" ||
547 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.jffs2" ||
548 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.dir"
550 [ -n "${mac}" ] && adddirectory="${directory}/${LIVE_MEDIA_PATH}/${mac}"
551 setup_unionfs "${directory}/${LIVE_MEDIA_PATH}" "${rootmnt}" "${adddirectory}"
559 sysfs_path="${1#/sys}"
561 if /lib/udev/path_id "${sysfs_path}" | grep -E -q "ID_PATH=(usb|pci-[^-]*-[ide|scsi|usb])"
564 elif echo "${sysfs_path}" | grep -q '^/block/vd[a-z]$'
576 copyto="${copyfrom}_swap"
578 if [ -z "${MODULETORAM}" ]
580 size=$(fs_size "" ${copyfrom} "used")
582 MODULETORAMFILE="${copyfrom}/${LIVE_MEDIA_PATH}/${MODULETORAM}"
584 if [ -f "${MODULETORAMFILE}" ]
586 size=$( expr $(ls -la ${MODULETORAMFILE} | awk '{print $5}') / 1024 + 5000 )
588 log_warning_msg "Error: toram-module ${MODULETORAM} (${MODULETORAMFILE}) could not be read."
593 if [ "${copytodev}" = "ram" ]
596 freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( cat /proc/meminfo | grep Cached | head -n 1 | awk '/Cached/{print $2}' - ) )
597 mount_options="-o size=${size}k"
602 # it should be a writable block device
603 if [ -b "${copytodev}" ]
607 fstype=$(get_fstype "${dev}")
608 freespace=$(fs_size "${dev}")
610 [ "$quiet" != "y" ] && log_warning_msg "${copytodev} is not a block device."
615 if [ "${freespace}" -lt "${size}" ]
617 [ "${quiet}" != "y" ] && log_warning_msg "Not enough free ${free_string} (${freespace}k free, ${size}k needed) to copy live media in ${copytodev}."
621 # begin copying (or uncompressing)
623 echo "mount -t ${fstype} ${mount_options} ${dev} ${copyto}"
624 mount -t "${fstype}" ${mount_options} "${dev}" "${copyto}"
626 if [ "${extension}" = "tgz" ]
629 tar zxf "${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
630 rm -f "${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
631 mount -r -o move "${copyto}" "${rootmnt}"
634 if [ -n "${MODULETORAMFILE}" ]
636 cp ${MODULETORAMFILE} ${copyto} # copy only the filesystem module
638 cp -a ${copyfrom}/* ${copyto} # "cp -a" from busybox also copies hidden files
643 mount -r -o move ${copyto} ${copyfrom}
654 modprobe -q af_packet # For DHCP
656 if [ -x /sbin/udevadm ]
667 ipconfig ${DEVICE} | tee /netboot.config
669 # source relevant ipconfig output
670 OLDHOSTNAME=${HOSTNAME}
671 . /tmp/net-${DEVICE}.conf
672 [ -z ${HOSTNAME} ] && HOSTNAME=${OLDHOSTNAME}
675 if [ "${NFSROOT}" = "auto" ]
677 NFSROOT=${ROOTSERVER}:${ROOTPATH}
680 if ( [ -n "${FETCH}" ] || [ -n "${HTTPFS}" ] || [ -n "${FTPFS}" ] ) && do_httpmount
686 if [ "${NFSROOT#*:}" = "${NFSROOT}" ] && [ "$NETBOOT" != "cifs" ]
688 NFSROOT=${ROOTSERVER}:${NFSROOT}
691 [ "${quiet}" != "y" ] && log_begin_msg "Trying netboot from ${NFSROOT}"
693 if [ "${NETBOOT}" != "nfs" ] && do_cifsmount
703 [ "${quiet}" != "y" ] && log_end_msg
710 dest="${mountpoint}/${LIVE_MEDIA_PATH}"
711 mount -t ramfs ram "${mountpoint}"
714 for webfile in HTTPFS FTPFS FETCH
716 url="$(eval echo \"\$\{${webfile}\}\")"
717 extension="$(echo "${url}" | sed 's/\(.*\)\.\(.*\)/\2/')"
721 case "${extension}" in
723 if [ "${webfile}" = "FETCH" ]
727 ip="$(dirname $url | sed -e 's|tftp://||g')"
728 [ "${quiet}" != "y" ] &&
729 log_begin_msg "Trying tftp -g -b 10240 -r $(basename ${url}) -l ${dest}/$(basename ${url}) $ip"
730 tftp -g -b 10240 -r $(basename ${url}) -l ${dest}/$(basename ${url}) $ip
734 [ "${quiet}" != "y" ] &&
735 log_begin_msg "Trying wget ${url} -O ${dest}/$(basename ${url})"
736 wget "${url}" -O "${dest}/$(basename ${url})"
740 [ "${quiet}" != "y" ] &&
741 log_begin_msg "Trying to mount ${url} on ${dest}/$(basename ${url})"
742 if [ "${webfile}" = "FTPFS" ]
744 FUSE_MOUNT="curlftpfs"
745 url="$(dirname ${url})"
750 $FUSE_MOUNT "${url}" "${dest}"
752 [ ${?} -eq 0 ] && rc=0
753 [ "${extension}" = "tgz" ] && live_dest="ram"
758 [ "${quiet}" != "y" ] && log_begin_msg "Unrecognized archive extension for ${url}"
766 umount "${mountpoint}"
778 if [ -z "${NFSOPTS}" ]
783 [ "${quiet}" != "y" ] && log_begin_msg "Trying nfsmount -o nolock -o ro ${NFSOPTS} ${NFSROOT} ${mountpoint}"
785 # FIXME: This for loop is an ugly HACK round an nfs bug
786 for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13
788 nfsmount -o nolock -o ro ${NFSOPTS} "${NFSROOT}" "${mountpoint}" && rc=0 && break
799 if [ -x "/sbin/mount.cifs" ]
801 if [ -z "${NFSOPTS}" ]
803 CIFSOPTS="-ouser=root,password="
805 CIFSOPTS="${NFSOPTS}"
808 [ "${quiet}" != "y" ] && log_begin_msg "Trying mount.cifs ${NFSROOT} ${mountpoint} ${CIFSOPTS}"
811 if mount.cifs "${NFSROOT}" "${mountpoint}" "${CIFSOPTS}"
825 size=$(fs_size "${fromdev}" "" "used")
827 if [ -b "${fromdev}" ]
830 if [ -n "${HOMEMOUNTED}" -a "${snap_type}" = "HOME" ]
832 todev=$(cat /proc/mounts | grep -s " $(base_path ${todir}) " | awk '{print $1}' )
833 freespace=$(df -k | grep -s ${todev} | awk '{print $4}')
835 freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( cat /proc/meminfo | grep Cached | head -n 1 | awk '/Cached/{print $2}' - ))
838 tomount="/mnt/tmpsnap"
840 if [ ! -d "${tomount}" ]
842 mkdir -p "${tomount}"
845 fstype=$(get_fstype "${fromdev}")
847 if [ -n "${fstype}" ]
850 mount -t "${fstype}" -o ro,noatime "${fromdev}" "${tomount}"
851 cp -a "${tomount}"/* ${todir}
854 log_warning_msg "Unrecognized fstype: ${fstype} on ${fromdev}:${snap_type}"
859 if echo ${fromdev} | grep -qs loop
861 losetup -d "${fromdev}"
868 [ "${quiet}" != "y" ] && log_warning_msg "Unable to find the snapshot ${snap_type} medium"
874 # Look for ${snap_label}.* in block devices and copy the contents to ${snap_mount}
875 # and remember the device and filename for resync on exit in live-initramfs.init
880 snapdata=$(find_files "${snap_label}.squashfs ${snap_label}.cpio.gz ${snap_label}.ext2 ${snap_label}.ext3 ${snap_label}.jffs2")
882 if [ ! -z "${snapdata}" ]
884 snapdev="$(echo ${snapdata} | cut -f1 -d ' ')"
885 snapback="$(echo ${snapdata} | cut -f2 -d ' ')"
886 snapfile="$(echo ${snapdata} | cut -f3 -d ' ')"
888 if echo "${snapfile}" | grep -qs '\(squashfs\|ext2\|ext3\|jffs2\)'
890 # squashfs, jffs2 or ext2/ext3 snapshot
891 dev=$(get_backing_device "${snapback}/${snapfile}")
893 if ! do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
895 log_warning_msg "Impossible to include the ${snapfile} Snapshot"
900 if ! (cd "${snap_mount}" && zcat "${snapback}/${snapfile}" | cpio --extract --preserve-modification-time --no-absolute-filenames --sparse --unconditional --make-directories > /dev/null 2>&1)
902 log_warning_msg "Impossible to include the ${snapfile} Snapshot"
909 dev=$(find_cow_device "${snap_label}")
913 if echo "${dev}" | grep -qs loop
915 # strange things happens, user confused?
916 snaploop=$( losetup ${dev} | awk '{print $3}' | tr -d '()' )
917 snapfile=$(basename ${snaploop})
918 snapdev=$(cat /proc/mounts | awk '{print $2,$1}' | grep -es "^$( dirname ${snaploop} )" | cut -f2 -d ' ')
923 if ! do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
925 log_warning_msg "Impossible to include the ${snap_label} Snapshot"
928 if [ -n "${snapfile}" ]
930 # it was a loop device, user confused
935 log_warning_msg "Impossible to include the ${snap_label} Snapshot"
940 echo "export ${snap_type}SNAP="${snap_mount}":${snapdev}:${snapfile}" >> /etc/live.conf # for resync on reboot/halt
946 image_directory="${1}"
948 addimage_directory="${3}"
949 modprobe -q -b ${UNIONTYPE}
951 # run-init can't deal with images in a subdir, but we're going to
952 # move all of these away before it runs anyway. No, we're not,
953 # put them in / since move-mounting them into / breaks mono and
958 # Let's just mount the read-only file systems first
961 minor_kernel_version=$(uname -r|cut -c 5-|sed 's/[^0-9].*//')
963 if [ "${NETBOOT}" = "nfs" ] && [ "${minor_kernel_version}" -lt 22 ]
965 # go aroung a bug in nfs-unionfs locking for unionfs <= 1.4
967 elif [ "${UNIONTYPE}" = "aufs" ]
974 # Read image names from ${MODULE}.module if it exists
975 if [ -e "${image_directory}/filesystem.${MODULE}.module" ]
977 for IMAGE in $(cat ${image_directory}/filesystem.${MODULE}.module)
979 image_string="${image_string} ${image_directory}/${IMAGE}"
981 elif [ -e "${image_directory}/${MODULE}.module" ]
983 for IMAGE in $(cat ${image_directory}/${MODULE}.module)
985 image_string="${image_string} ${image_directory}/${IMAGE}"
988 # ${MODULE}.module does not exist, create a list of images
989 for FILESYSTEM in squashfs ext2 ext3 xfs jffs2 dir
991 for IMAGE in "${image_directory}"/*."${FILESYSTEM}"
995 image_string="${image_string} ${IMAGE}"
1000 if [ -n "${addimage_directory}" ] && [ -d "${addimage_directory}" ]
1002 for FILESYSTEM in squashfs ext2 ext3 xfs jffs2 dir
1004 for IMAGE in "${addimage_directory}"/*."${FILESYSTEM}"
1006 if [ -e "${IMAGE}" ]
1008 image_string="${image_string} ${IMAGE}"
1015 image_string="$(echo ${image_string} | sed -e 's/ /\n/g' | sort )"
1018 [ -n "${MODULETORAMFILE}" ] && image_string="${image_directory}/$(basename ${MODULETORAMFILE})"
1022 for image in ${image_string}
1024 imagename=$(basename "${image}")
1026 if [ -d "${image}" ]
1028 # it is a plain directory: do nothing
1029 rofsstring="${image}=${roopt}:${rofsstring}"
1030 rofslist="${image} ${rofslist}"
1031 elif [ -f "${image}" ]
1033 if losetup --help 2>&1 | grep -q -- "-r\b"
1035 backdev=$(get_backing_device "${image}" "-r")
1037 backdev=$(get_backing_device "${image}")
1039 fstype=$(get_fstype "${backdev}")
1041 if [ "${fstype}" = "unknown" ]
1043 panic "Unknown file system type on ${backdev} (${image})"
1046 mkdir -p "${croot}/${imagename}"
1047 echo "debug: Mounting backdev \"${backdev}\" (image = ${image}) on croot/imagename \"${croot}/${imagename}\""
1048 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}"
1052 rofsstring=${rofsstring%:}
1056 # Looking for "${root_persistence}" device or file
1057 if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
1060 num_block=$(ls -l /sys/block | wc -l)
1061 for module in sd_mod uhci-hcd ehci-hcd ohci-hcd usb-storage
1063 modprobe -q -b ${module}
1066 if [ -x /sbin/udevadm ]
1077 # For some reason, udevsettle does not block in this scenario,
1078 # so we sleep for a little while.
1080 # See https://bugs.launchpad.net/ubuntu/+source/casper/+bug/84591
1081 for timeout in 5 4 3 2 1
1085 if [ $(ls -l /sys/block | wc -l) -gt ${num_block} ]
1091 cowprobe=$(find_cow_device "${root_persistence}")
1093 if [ -b "${cowprobe}" ]
1095 cowdevice=${cowprobe}
1096 cow_fstype=$(get_fstype "${cowprobe}")
1097 cow_mountopt="rw,noatime"
1099 [ "${quiet}" != "y" ] && log_warning_msg "Unable to find the persistent medium"
1102 cow_mountopt="rw,noatime,mode=755"
1104 elif [ -n "${NFS_COW}" ] && [ -z "${NOPERSISTENT}" ]
1106 # check if there are any nfs options
1107 if echo ${NFS_COW}|grep -q ','
1109 nfs_cow_opts="-o nolock,$(echo ${NFS_COW}|cut -d, -f2-)"
1110 nfs_cow=$(echo ${NFS_COW}|cut -d, -f1)
1112 nfs_cow_opts="-o nolock"
1118 cowdevice=$(echo ${nfs_cow}|sed "s/client_mac_address/${mac}/")
1121 panic "unable to determine mac address"
1126 cow_mountopt="rw,noatime,mode=755"
1129 if [ "${cow_fstype}" = "nfs" ]
1131 [ "${quiet}" != "y" ] && log_begin_msg \
1132 "Trying nfsmount ${nfs_cow_opts} ${cowdevice} /cow"
1133 nfsmount ${nfs_cow_opts} ${cowdevice} /cow || \
1134 panic "Can not mount ${cowdevice} (n: ${cow_fstype}) on /cow"
1136 mount -t ${cow_fstype} -o ${cow_mountopt} ${cowdevice} /cow || \
1137 panic "Can not mount ${cowdevice} (o: ${cow_fstype}) on /cow"
1140 rofscount=$(echo ${rofslist} |wc -w)
1142 if [ -n "${EXPOSED_ROOT}" ]
1144 if [ ${rofscount} -ne 1 ]
1146 panic "only one RO file system supported with exposedroot: ${rofslist}"
1148 exposedrootfs=${rofslist%% }
1150 mount --bind ${exposedrootfs} ${rootmnt} || \
1151 panic "bind mount of ${exposedrootfs} failed"
1153 cow_dirs='/var/tmp /var/lock /var/run /var/log /var/spool
1154 /home /var/lib/live'
1156 for dir in ${cow_dirs}; do
1158 mount -t ${UNIONTYPE} \
1159 -o rw,noatime,dirs=/cow${dir}=rw:${exposedrootfs}${dir}=ro \
1160 ${UNIONTYPE} "${rootmnt}${dir}" || \
1161 panic "mount ${UNIONTYPE} on ${rootmnt}${dir} failed with option \
1162 rw,noatime,dirs=/cow${dir}=rw:${exposedrootfs}${dir}=ro"
1165 mount -t ${UNIONTYPE} -o noatime,dirs=/cow=rw:${rofsstring} \
1166 ${UNIONTYPE} "${rootmnt}" || panic "mount ${UNIONTYPE} on \
1167 ${rootmnt} failed with option noatime,dirs=/cow=rw:${rofsstring}"
1170 # tmpfs file systems
1171 mkdir -p "${rootmnt}/live"
1172 mount -t tmpfs tmpfs ${rootmnt}/live
1174 # Adding other custom mounts
1175 if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
1177 # directly mount /home
1178 # FIXME: add a custom mounts configurable system
1179 homecow=$(find_cow_device "${home_persistence}" )
1181 if [ -b "${homecow}" ]
1183 mount -t $(get_fstype "${homecow}") -o rw,noatime "${homecow}" "${rootmnt}/home"
1184 export HOMEMOUNTED=1 # used to proper calculate free space in do_snap_copy()
1186 [ "${quiet}" != "y" ] && log_warning_msg "Unable to find the persistent home medium"
1189 # Look for other snapshots to copy in
1190 try_snap "${root_snapshot_label}" "${rootmnt}" "ROOT"
1191 try_snap "${home_snapshot_label}" "${rootmnt}/home" "HOME"
1194 if [ -n "${SHOWMOUNTS}" ]
1196 for d in ${rofslist}
1198 mkdir -p "${rootmnt}/live/${d##*/}"
1202 # do nothing # mount -o bind "${d}" "${rootmnt}/live/${d##*/}"
1206 mount -o move "${d}" "${rootmnt}/live/${d##*/}"
1212 # shows cow fs on /cow for use by live-snapshot
1213 mkdir -p "${rootmnt}/live/cow"
1214 mount -o move /cow "${rootmnt}/live/cow" || mount -o bind /cow "${rootmnt}/live/cow" || [ "${quiet}" != "y" ] && log_warning_msg "Unable to move or bind /cow to ${rootmnt}/live/cow"
1221 skip_uuid_check="${3}"
1223 if [ -z "${devname}" ]
1225 devname=$(sys2dev "${sysdev}")
1228 if [ -d "${devname}" ]
1230 mount -o bind "${devname}" $mountpoint || continue
1232 if is_live_path $mountpoint
1241 if [ -n "${LIVE_MEDIA_OFFSET}" ]
1243 loopdevname=$(setup_loop "${devname}" "loop" "/sys/block/loop*" "${LIVE_MEDIA_OFFSET}" '')
1244 devname="${loopdevname}"
1247 fstype=$(get_fstype "${devname}")
1249 if is_supported_fs ${fstype}
1251 mount -t ${fstype} -o ro,noatime "${devname}" ${mountpoint} || continue
1253 if is_live_path ${mountpoint} && \
1254 ([ "${skip_uuid_check}" ] || matches_uuid ${mountpoint})
1259 umount ${mountpoint}
1263 if [ -n "${LIVE_MEDIA_OFFSET}" ]
1265 losetup -d "${loopdevname}"
1275 # first look at the one specified in the command line
1276 if [ ! -z "${LIVE_MEDIA}" ]
1278 if check_dev "null" "${LIVE_MEDIA}" "skip_uuid_check"
1284 # don't start autodetection before timeout has expired
1285 if [ -n "${LIVE_MEDIA_TIMEOUT}" ]
1287 if [ "${timeout}" -lt "${LIVE_MEDIA_TIMEOUT}" ]
1293 # or do the scan of block devices
1294 for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop | grep -v ram | grep -v 'dm-' | grep -v fd )
1296 devname=$(sys2dev "${sysblock}")
1297 fstype=$(get_fstype "${devname}")
1299 if /lib/udev/cdrom_id ${devname} > /dev/null
1301 if check_dev "null" "${devname}"
1305 elif is_nice_device "${sysblock}"
1307 for dev in $(subdevices "${sysblock}")
1309 if check_dev "${dev}"
1314 elif [ "${fstype}" = "squashfs" -o \
1315 "${fstype}" = "ext2" -o \
1316 "${fstype}" = "ext3" -o \
1317 "${fstype}" = "jffs2" ]
1319 # This is an ugly hack situation, the block device has
1320 # an image directly on it. It's hopefully
1321 # live-initramfs, so take it and run with it.
1322 ln -s "${devname}" "${devname}.${fstype}"
1323 echo "${devname}.${fstype}"
1331 set_usplash_timeout ()
1333 if [ -x /sbin/usplash_write ]
1335 /sbin/usplash_write "TIMEOUT 120"
1342 if [ -x /scripts/local-top/cryptroot ]; then
1343 /scripts/local-top/cryptroot
1350 tail -f live.log >&7 &
1353 # Ensure 'panic' function is overridden
1354 . /scripts/live-functions
1359 [ "${quiet}" != "y" ] && log_begin_msg "Running /scripts/live-premount"
1360 run_scripts /scripts/live-premount
1361 [ "${quiet}" != "y" ] && log_end_msg
1363 # Needed here too because some things (*cough* udev *cough*)
1364 # changes the timeout
1368 if [ ! -z "${NETBOOT}" ] || [ ! -z "${FETCH}" ] || [ ! -z "${HTTPFS}" ] || [ ! -z "${FTPFS}" ]
1372 livefs_root="${mountpoint}"
1374 panic "Unable to find a live file system on the network"
1377 if [ -n "${PLAIN_ROOT}" ] && [ -n "${ROOT}" ]
1379 # Do a local boot from hd
1382 # Scan local devices for the image
1383 for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
1385 livefs_root=$(find_livefs ${i})
1387 if [ -n "${livefs_root}" ]
1397 if [ -z "${livefs_root}" ]
1399 panic "Unable to find a medium containing a live file system"
1405 elif [ "${TODISK}" ]
1407 live_dest="${TODISK}"
1410 if [ "${live_dest}" ]
1412 log_begin_msg "Copying live media to ${live_dest}"
1413 copy_live_to "${livefs_root}" "${live_dest}"
1417 if [ -n "${MODULETORAMFILE}" ]
1419 setup_unionfs "${livefs_root}" "${rootmnt}"
1422 mac="$(echo ${mac} | sed 's/-//g')"
1423 mount_images_in_directory "${livefs_root}" "${rootmnt}" "${mac}"
1428 maybe_break live-bottom
1429 [ "${quiet}" != "y" ] && log_begin_msg "Running /scripts/live-bottom"
1431 run_scripts /scripts/live-bottom
1432 [ "${quiet}" != "y" ] && log_end_msg
1437 cp live.log "${rootmnt}/var/log/"