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 alt_mountpoint="/media"
12 LIVE_MEDIA_PATH="live"
14 root_persistence="live-rw"
15 home_persistence="home-rw"
16 root_snapshot_label="live-sn"
17 home_snapshot_label="home-sn"
20 USERFULLNAME="Live user"
23 mkdir -p "${mountpoint}"
26 # Create /etc/mtab for debug purpose and future syncs
37 . /scripts/live-helpers
39 if [ ! -f /live.vars ]
49 for ARGUMENT in $(cat /proc/cmdline)
58 export NOACCESSIBILITY NOFASTBOOT NOFSTAB NONETWORKING
62 ACCESS="${ARGUMENT#access=}"
67 DEFCONSOLE="${ARGUMENT#*=}"
83 # Force dhcp even while netbooting
84 # Use for debugging in case somebody works on fixing dhclient
94 DEVICE="${ARGUMENT#ethdevice=}"
96 export DEVICE ETHDEVICE
100 ETHDEV_TIMEOUT="${ARGUMENT#ethdevice-timeout=}"
101 export ETHDEV_TIMEOUT
105 FETCH="${ARGUMENT#fetch=}"
110 FORCEPERSISTENTFSCK="Yes"
111 export FORCEPERSISTENTFSCK
115 FTPFS="${ARGUMENT#ftpfs=}"
120 HTTPFS="${ARGUMENT#httpfs=}"
125 ISCSI="${ARGUMENT#iscsi=}"
126 #ip:port - separated by ;
127 ISCSI_PORTAL="${ISCSI%;*}"
128 if echo "${ISCSI_PORTAL}" | grep -q , ; then
129 ISCSI_SERVER="${ISCSI_PORTAL%,*}"
130 ISCSI_PORT="${ISCSI_PORTAL#*,}"
133 ISCSI_TARGET="${ISCSI#*;}"
134 export ISCSI ISCSI_PORTAL ISCSI_TARGET ISCSI_SERVER ISCSI_PORT
138 FROMISO="${ARGUMENT#*=}"
148 INTEGRITY_CHECK="Yes"
149 export INTEGRITY_CHECK
153 STATICIP="${ARGUMENT#ip=}"
155 if [ -z "${STATICIP}" ]
168 live-media=*|bootfrom=*)
169 LIVE_MEDIA="${ARGUMENT#*=}"
173 live-media-encryption=*|encryption=*)
174 LIVE_MEDIA_ENCRYPTION="${ARGUMENT#*=}"
175 export LIVE_MEDIA_ENCRYPTION
179 LIVE_MEDIA_OFFSET="${ARGUMENT#live-media-offset=}"
180 export LIVE_MEDIA_OFFSET
184 LIVE_MEDIA_PATH="${ARGUMENT#live-media-path=}"
185 export LIVE_MEDIA_PATH
188 live-media-timeout=*)
189 LIVE_MEDIA_TIMEOUT="${ARGUMENT#live-media-timeout=}"
190 export LIVE_MEDIA_TIMEOUT
194 MODULE="${ARGUMENT#module=}"
199 NETBOOT="${ARGUMENT#netboot=}"
204 NFSOPTS="${ARGUMENT#nfsopts=}"
209 NFS_COW="${ARGUMENT#nfscow=}"
214 NOACCESSIBILITY="Yes"
215 export NOACCESSIBILITY
234 ramdisk_size="${ARGUMENT#ramdisk-size=}"
247 persistent-encryption=*)
248 PERSISTENT_ENCRYPTION="${ARGUMENT#*=}"
249 export PERSISTENT_ENCRYPTION
253 PERSISTENT_MEDIA="${ARGUMENT#*=}"
254 export PERSISTENT_MEDIA
258 PERSISTENT_PATH="${ARGUMENT#persistent-path=}"
259 export PERSISTENT_PATH
262 persistent-storage=*)
263 PERSISTENT_STORAGE="${ARGUMENT#persistent-storage=}"
264 export PERSISTENT_STORAGE
267 persistent-subtext=*)
268 root_persistence="${root_persistence}-${ARGUMENT#persistent-subtext=}"
269 home_persistence="${home_persistence}-${ARGUMENT#persistent-subtext=}"
270 root_snapshot_label="${root_snapshot_label}-${ARGUMENT#persistent-subtext=}"
271 home_snapshot_label="${home_snapshot_label}-${ARGUMENT#persistent-subtext=}"
285 NOPROMPT="${ARGUMENT#noprompt=}"
290 QUICKUSBMODULES="Yes"
291 export QUICKUSBMODULES
294 preseed/file=*|file=*)
295 LOCATIONS="${ARGUMENT#*=} ${LOCATIONS}"
305 question="${ARGUMENT%%=*}"
306 value="${ARGUMENT#*=}"
307 PRESEEDS="${PRESEEDS}\"${question}=${value}\" "
322 TODISK="${ARGUMENT#todisk=}"
333 MODULETORAM="${ARGUMENT#toram=}"
334 export TORAM MODULETORAM
348 SKIP_UNION_MOUNTS="Yes"
349 export SKIP_UNION_MOUNTS
353 ROOT="${ARGUMENT#root=}"
358 UNIONTYPE="${ARGUMENT#union=}"
364 # sort of compatibility with netboot.h from linux docs
365 if [ -z "${NETBOOT}" ]
367 if [ "${ROOT}" = "/dev/nfs" ]
371 elif [ "${ROOT}" = "/dev/cifs" ]
378 if [ -z "${MODULE}" ]
384 if [ -z "${UNIONTYPE}" ]
390 if [ -n "${PERSISTENT}" ] && [ -z "${PERSISTENT_STORAGE}" ]
392 PERSISTENT_STORAGE="filesystem,file"
393 export PERSISTENT_STORAGE
401 if [ -d "${DIRECTORY}"/"${LIVE_MEDIA_PATH}" ]
403 for FILESYSTEM in squashfs ext2 ext3 ext4 xfs dir jffs2
405 if [ "$(echo ${DIRECTORY}/${LIVE_MEDIA_PATH}/*.${FILESYSTEM})" != "${DIRECTORY}/${LIVE_MEDIA_PATH}/*.${FILESYSTEM}" ]
417 if [ "${IGNORE_UUID}" ] || [ ! -e /conf/uuid.conf ]
423 uuid="$(cat /conf/uuid.conf)"
425 for try_uuid_file in "${path}/.disk/live-uuid"*
427 [ -e "${try_uuid_file}" ] || continue
429 try_uuid="$(cat "${try_uuid_file}")"
431 if [ "${uuid}" = "${try_uuid}" ]
440 get_backing_device ()
443 *.squashfs|*.ext2|*.ext3|*.ext4|*.jffs2)
444 echo $(setup_loop "${1}" "loop" "/sys/block/loop*" '0' "${LIVE_MEDIA_ENCRYPTION}" "${2}")
452 panic "Unrecognized live filesystem: ${1}"
457 match_files_in_dir ()
459 # Does any files match pattern ${1} ?
462 if [ "$(echo ${pattern})" != "${pattern}" ]
470 mount_images_in_directory ()
477 if match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.squashfs" ||
478 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext2" ||
479 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext3" ||
480 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext4" ||
481 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.jffs2" ||
482 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.dir"
484 [ -n "${mac}" ] && adddirectory="${directory}/${LIVE_MEDIA_PATH}/${mac}"
485 setup_unionfs "${directory}/${LIVE_MEDIA_PATH}" "${rootmnt}" "${adddirectory}"
487 panic "No supported filesystem images found at /${LIVE_MEDIA_PATH}."
493 sysfs_path="${1#/sys}"
495 if [ -e /lib/udev/path_id ]
498 PATH_ID="/lib/udev/path_id"
500 # wheezy/sid (udev >= 174)
501 PATH_ID="/sbin/udevadm test-builtin path_id"
504 if "${PATH_ID}" "${sysfs_path}" | egrep -q "ID_PATH=(usb|pci-[^-]*-(ide|sas|scsi|usb|virtio)|platform-sata_mv|platform-orion-ehci|platform-mmc|platform-mxsdhci)"
507 elif echo "${sysfs_path}" | grep -q '^/block/vd[a-z]$'
510 elif echo ${sysfs_path} | grep -q "^/block/dm-"
513 elif echo ${sysfs_path} | grep -q "^/block/mtdblock"
525 copyto="${copyfrom}_swap"
527 if [ -z "${MODULETORAM}" ]
529 size=$(fs_size "" ${copyfrom}/${LIVE_MEDIA_PATH} "used")
531 MODULETORAMFILE="${copyfrom}/${LIVE_MEDIA_PATH}/${MODULETORAM}"
533 if [ -f "${MODULETORAMFILE}" ]
535 size=$( expr $(ls -la ${MODULETORAMFILE} | awk '{print $5}') / 1024 + 5000 )
537 log_warning_msg "Error: toram-module ${MODULETORAM} (${MODULETORAMFILE}) could not be read."
542 if [ "${copytodev}" = "ram" ]
545 freespace=$(awk '/^MemFree:/{f=$2} /^Cached:/{c=$2} END{print f+c}' /proc/meminfo)
546 mount_options="-o size=${size}k"
551 # it should be a writable block device
552 if [ -b "${copytodev}" ]
556 fstype=$(get_fstype "${dev}")
557 freespace=$(fs_size "${dev}")
559 log_warning_msg "${copytodev} is not a block device."
564 if [ "${freespace}" -lt "${size}" ]
566 log_warning_msg "Not enough free ${free_string} (${freespace}k free, ${size}k needed) to copy live media in ${copytodev}."
570 # Custom ramdisk size
571 if [ -z "${mount_options}" ] && [ -n "${ramdisk_size}" ]
573 # FIXME: should check for wrong values
574 mount_options="-o size=${ramdisk_size}"
577 # begin copying (or uncompressing)
579 log_begin_msg "mount -t ${fstype} ${mount_options} ${dev} ${copyto}"
580 mount -t "${fstype}" ${mount_options} "${dev}" "${copyto}"
582 if [ "${extension}" = "tgz" ]
585 tar zxf "${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
586 rm -f "${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
587 mount -r -o move "${copyto}" "${rootmnt}"
590 if [ -n "${MODULETORAMFILE}" ]
594 echo " * Copying $MODULETORAMFILE to RAM" 1>/dev/console
595 rsync -a --progress ${MODULETORAMFILE} ${copyto} 1>/dev/console # copy only the filesystem module
597 cp ${MODULETORAMFILE} ${copyto} # copy only the filesystem module
602 echo " * Copying whole medium to RAM" 1>/dev/console
603 rsync -a --progress ${copyfrom}/* ${copyto} 1>/dev/console # "cp -a" from busybox also copies hidden files
605 mkdir -p ${copyto}/${LIVE_MEDIA_PATH}
606 cp -a ${copyfrom}/${LIVE_MEDIA_PATH}/* ${copyto}/${LIVE_MEDIA_PATH}
607 if [ -e ${copyfrom}/${LIVE_MEDIA_PATH}/.disk ]
609 cp -a ${copyfrom}/${LIVE_MEDIA_PATH}/.disk ${copyto}
615 mount -r -o move ${copyto} ${copyfrom}
624 modprobe -q af_packet # For DHCP
629 [ -n "$ETHDEV_TIMEOUT" ] || ETHDEV_TIMEOUT=15
630 echo "Using timeout of $ETHDEV_TIMEOUT seconds for network configuration."
632 if [ -z "${NETBOOT}" ] && [ -z "${FETCH}" ] && \
633 [ -z "${HTTPFS}" ] && [ -z "${FTPFS}" ]
637 # support for Syslinux IPAPPEND parameter
638 # it sets the BOOTIF variable on the kernel parameter
640 if [ -n "${BOOTIF}" ]
642 # pxelinux sets BOOTIF to a value based on the mac address of the
643 # network card used to PXE boot, so use this value for DEVICE rather
644 # than a hard-coded device name from initramfs.conf. this facilitates
645 # network booting when machines may have multiple network cards.
646 # pxelinux sets BOOTIF to 01-$mac_address
648 # strip off the leading "01-", which isn't part of the mac
650 temp_mac=${BOOTIF#*-}
652 # convert to typical mac address format by replacing "-" with ":"
657 if [ -z "$bootif_mac" ]
661 bootif_mac="$bootif_mac:$x"
666 # look for devices with matching mac address, and set DEVICE to
667 # appropriate value if match is found.
669 for device in /sys/class/net/*
671 if [ -f "$device/address" ]
673 current_mac=$(cat "$device/address")
675 if [ "$bootif_mac" = "$current_mac" ]
684 # if ethdevice was not specified on the kernel command line
685 # make sure we try to get a working network configuration
686 # for *every* present network device (except for loopback of course)
687 if [ -z "$ETHDEVICE" ] ; then
688 echo "If you want to boot from a specific device use bootoption ethdevice=..."
689 for device in /sys/class/net/*; do
691 if [ "$dev" != "lo" ] ; then
692 ETHDEVICE="$ETHDEVICE $dev"
697 # split args of ethdevice=eth0,eth1 into "eth0 eth1"
698 for device in $(echo $ETHDEVICE | sed 's/,/ /g') ; do
699 devlist="$devlist $device"
702 # this is tricky (and ugly) because ipconfig sometimes just hangs/runs into
703 # an endless loop; iff execution fails give it two further tries, that's
704 # why we use '$devlist $devlist $devlist' for the other for loop
705 for dev in $devlist $devlist $devlist ; do
706 echo "Executing ipconfig -t $ETHDEV_TIMEOUT $dev"
707 ipconfig -t "$ETHDEV_TIMEOUT" $dev | tee -a /netboot.config &
709 sleep "$ETHDEV_TIMEOUT" ; sleep 1
710 if [ -r /proc/"$jobid"/status ] ; then
711 echo "Killing job $jobid for device $dev as ipconfig ran into recursion..."
715 # if configuration of device worked we should have an assigned
716 # IP address, iff so let's use the according as $DEVICE for later usage
717 # simple and primitive approach which seems to work fine
718 if ifconfig $dev | grep -q 'inet.*addr:' ; then
725 for interface in ${DEVICE}; do
726 ipconfig -t "$ETHDEV_TIMEOUT" ${interface} | tee /netboot-${interface}.config
727 [ -e /tmp/net-${interface}.conf ] && . /tmp/net-${interface}.conf
728 if [ "$IPV4ADDR" != "0.0.0.0" ]
735 for interface in ${DEVICE}; do
736 # source relevant ipconfig output
737 OLDHOSTNAME=${HOSTNAME}
738 [ -e /tmp/net-${interface}.conf ] && . /tmp/net-${interface}.conf
739 [ -z ${HOSTNAME} ] && HOSTNAME=${OLDHOSTNAME}
742 if [ -n "${interface}" ]
744 HWADDR="$(cat /sys/class/net/${interface}/address)"
747 if [ ! -e "/etc/resolv.conf" ]
749 echo "Creating /etc/resolv.conf"
751 if [ -n "${DNSDOMAIN}" ]
753 echo "domain ${DNSDOMAIN}" > /etc/resolv.conf
754 echo "search ${DNSDOMAIN}" >> /etc/resolv.conf
757 for i in ${IPV4DNS0} ${IPV4DNS1} ${IPV4DNS1}
759 if [ -n "$i" ] && [ "$i" != 0.0.0.0 ]
761 echo "nameserver $i" >> /etc/resolv.conf
766 # Check if we have a network device at all
767 if ! ls /sys/class/net/"$interface" > /dev/null 2>&1 && \
768 ! ls /sys/class/net/eth0 > /dev/null 2>&1 && \
769 ! ls /sys/class/net/wlan0 > /dev/null 2>&1 && \
770 ! ls /sys/class/net/ath0 > /dev/null 2>&1 && \
771 ! ls /sys/class/net/ra0 > /dev/null 2>&1
773 panic "No supported network device found, maybe a non-mainline driver is required."
782 if [ "${NFSROOT}" = "auto" ]
784 NFSROOT=${ROOTSERVER}:${ROOTPATH}
789 if ( [ -n "${FETCH}" ] || [ -n "${HTTPFS}" ] || [ -n "${FTPFS}" ] )
795 if [ "${NFSROOT#*:}" = "${NFSROOT}" ] && [ "$NETBOOT" != "cifs" ]
797 NFSROOT=${ROOTSERVER}:${NFSROOT}
800 log_begin_msg "Trying netboot from ${NFSROOT}"
802 if [ "${NETBOOT}" != "nfs" ] && do_cifsmount
822 [ "${DEBUG}" == "Yes" ] && debugopt="-d 8"
823 #FIXME this name is supposed to be unique - some date + ifconfig hash?
824 ISCSI_INITIATORNAME="iqn.1993-08.org.debian.live:01:$(echo "${HWADDR}" | sed -e s/://g)"
825 export ISCSI_INITIATORNAME
826 if [ -n "${ISCSI_SERVER}" ] ; then
827 iscsistart $debugopt -i "${ISCSI_INITIATORNAME}" -t "${ISCSI_TARGET}" -g 1 -a "${ISCSI_SERVER}" -p "${ISCSI_PORT}"
829 iscsistart $debugopt -i "${ISCSI_INITIATORNAME}" -t "${ISCSI_TARGET}" -g 1 -a "${ISCSI_PORTAL}" -p 3260
833 panic "Failed to log into iscsi target"
835 local host="$(ls -d /sys/class/scsi_host/host*/device/iscsi_host:host* \
836 /sys/class/scsi_host/host*/device/iscsi_host/host* | sed -e 's:/device.*::' -e 's:.*host::')"
841 while [ -z "${devices}" -a $i -lt 60 ]
844 devices="$(ls -d /sys/class/scsi_device/${host}*/device/block:* \
845 /sys/class/scsi_device/${host}*/device/block/* | sed -e 's!.*[:/]!!')"
851 if check_dev "null" "/dev/$dev"
858 panic "Failed to locate a live device on iSCSI devices (tried: $devices)."
860 panic "Failed to locate iSCSI host in /sys"
868 for webfile in HTTPFS FTPFS FETCH
870 local url="$(eval echo \"\$\{${webfile}\}\")"
871 local extension="$(echo "${url}" | sed 's/\(.*\)\.\(.*\)/\2/')"
875 case "${extension}" in
876 iso|squashfs|tgz|tar)
877 if [ "${extension}" = "iso" ]
879 mkdir -p "${alt_mountpoint}"
880 dest="${alt_mountpoint}"
882 local dest="${mountpoint}/${LIVE_MEDIA_PATH}"
883 mount -t ramfs ram "${mountpoint}"
886 if [ "${webfile}" = "FETCH" ]
890 ip="$(dirname $url | sed -e 's|tftp://||g' -e 's|/.*$||g')"
891 rfile="$(echo $url | sed -e "s|tftp://$ip||g")"
892 lfile="$(basename $url)"
893 log_begin_msg "Trying tftp -g -b 10240 -r $rfile -l ${dest}/$lfile $ip"
894 tftp -g -b 10240 -r $rfile -l ${dest}/$lfile $ip
898 log_begin_msg "Trying wget ${url} -O ${dest}/$(basename ${url})"
899 wget "${url}" -O "${dest}/$(basename ${url})"
903 log_begin_msg "Trying to mount ${url} on ${dest}/$(basename ${url})"
904 if [ "${webfile}" = "FTPFS" ]
906 FUSE_MOUNT="curlftpfs"
907 url="$(dirname ${url})"
912 $FUSE_MOUNT "${url}" "${dest}"
913 ROOT_PID="$(minips h -C "$FUSE_MOUNT" | { read x y ; echo "$x" ; } )"
915 [ ${?} -eq 0 ] && rc=0
916 [ "${extension}" = "tgz" ] && live_dest="ram"
917 if [ "${extension}" = "iso" ]
919 isoloop=$(setup_loop "${dest}/$(basename "${url}")" "loop" "/sys/block/loop*" "" '')
920 mount -t iso9660 "${isoloop}" "${mountpoint}"
927 log_begin_msg "Unrecognized archive extension for ${url}"
935 if [ -d "${alt_mountpoint}" ]
937 umount "${alt_mountpoint}"
938 rmdir "${alt_mountpoint}"
940 umount "${mountpoint}"
941 elif [ "${webfile}" != "FETCH" ] ; then
955 if [ -z "${NFSOPTS}" ]
960 log_begin_msg "Trying nfsmount -o nolock -o ro ${NFSOPTS} ${NFSROOT} ${mountpoint}"
962 # FIXME: This while loop is an ugly HACK round an nfs bug
964 while [ "$i" -lt 60 ]
966 nfsmount -o nolock -o ro ${NFSOPTS} "${NFSROOT}" "${mountpoint}" && rc=0 && break
978 if [ -x "/sbin/mount.cifs" ]
980 if [ -z "${NFSOPTS}" ]
982 CIFSOPTS="-ouser=root,password="
984 CIFSOPTS="${NFSOPTS}"
987 log_begin_msg "Trying mount.cifs ${NFSROOT} ${mountpoint} ${CIFSOPTS}"
990 if mount.cifs "${NFSROOT}" "${mountpoint}" "${CIFSOPTS}"
1004 size=$(fs_size "${fromdev}" "" "used")
1006 if [ -b "${fromdev}" ]
1008 log_success_msg "Copying snapshot ${fromdev} to ${todir}..."
1011 if [ -n "${HOMEMOUNTED}" -a "${snap_type}" = "HOME" ]
1013 todev=$(awk -v pat="$(base_path ${todir})" '$2 == pat { print $1 }' /proc/mounts)
1014 freespace=$(df -k | awk '/'${todev}'/{print $4}')
1016 freespace=$(awk '/^MemFree:/{f=$2} /^Cached:/{c=$2} END{print f+c}' /proc/meminfo)
1019 tomount="/mnt/tmpsnap"
1021 if [ ! -d "${tomount}" ]
1023 mkdir -p "${tomount}"
1026 fstype=$(get_fstype "${fromdev}")
1028 if [ -n "${fstype}" ]
1031 mount -o ro -t "${fstype}" "${fromdev}" "${tomount}" || log_warning_msg "Error in mount -t ${fstype} -o ro ${fromdev} ${tomount}"
1032 cp -a "${tomount}"/* ${todir}
1035 log_warning_msg "Unrecognized fstype: ${fstype} on ${fromdev}:${snap_type}"
1040 if echo ${fromdev} | grep -qs loop
1042 losetup -d "${fromdev}"
1047 log_warning_msg "Unable to find the snapshot ${snap_type} medium"
1054 # Look for ${snap_label}.* in block devices
1056 black_listed_devices="${2}"
1057 white_listed_devices="${3}"
1059 if echo ${PERSISTENT_STORAGE} | grep -qw file
1061 # search for image files
1062 snapdata=$(find_files "${PERSISTENT_PATH}${snap_label}.squashfs ${PERSISTENT_PATH}${snap_label}.cpio.gz ${PERSISTENT_PATH}${snap_label}.ext2 ${PERSISTENT_PATH}${snap_label}.ext3 ${PERSISTENT_PATH}${snap_label}.ext4 ${PERSISTENT_PATH}${snap_label}.jffs2" "${black_listed_devices}" "${white_listed_devices}")
1065 if echo ${PERSISTENT_STORAGE} | grep -qw filesystem && [ -z "${snapdata}" ]
1067 snapdata=$(find_cow_device "${snap_label}" "${black_listed_devices}" "${white_listed_devices}")
1074 # copy the contents of previously found snapshot to ${snap_mount}
1075 # and remember the device and filename for resync on exit in live-boot.init
1082 if [ -z "${snap_relpath}" ]
1084 # root snapshot, default usage
1087 # relative snapshot (actually used just for "/home" snapshots)
1088 snap_mount="${2}${snap_relpath}"
1091 if [ -n "${snapdata}" ] && [ ! -b "${snapdata}" ]
1093 log_success_msg "found snapshot: ${snapdata}"
1094 snapdev="$(echo ${snapdata} | cut -f1 -d ' ')"
1095 snapback="$(echo ${snapdata} | cut -f2 -d ' ')"
1096 snapfile="$(echo ${snapdata} | cut -f3 -d ' ')"
1098 if ! try_mount "${snapdev}" "${snapback}" "ro"
1105 if echo "${snapfile}" | grep -qs '\(squashfs\|ext2\|ext3\|ext4\|jffs2\)'
1107 # squashfs, jffs2 or ext2/ext3/ext4 snapshot
1108 dev=$(get_backing_device "${snapback}/${snapfile}")
1110 do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
1115 # Unfortunately klibc's cpio is incompatible with the
1116 # rest of the world; everything else requires -u -d,
1117 # while klibc doesn't implement them. Try to detect
1118 # whether it's in use.
1119 cpiopath="$(which cpio)" || true
1120 if [ "$cpiopath" ] && grep -aq /lib/klibc "$cpiopath"
1124 cpioargs='--unconditional --make-directories'
1127 if [ -s "${snapback}/${snapfile}" ]
1130 cd "${snap_mount}" && zcat "${snapback}/${snapfile}" | $cpiopath $cpioargs --extract --preserve-modification-time --no-absolute-filenames --sparse 2>/dev/null
1134 log_warning_msg "${snapback}/${snapfile} is empty, adding it for sync on reboot."
1138 if [ "${RES}" != "0" ]
1140 log_warning_msg "failure to \"zcat ${snapback}/${snapfile} | $cpiopath $cpioargs --extract --preserve-modification-time --no-absolute-filenames --sparse\""
1144 umount "${snapback}" || log_warning_msg "failure to \"umount ${snapback}\""
1146 if [ "${RES}" != "0" ]
1148 log_warning_msg "Impossible to include the ${snapfile} Snapshot file"
1151 elif [ -b "${snapdata}" ]
1153 # Try to find if it could be a snapshot partition
1155 log_success_msg "found snapshot ${snap_type} device on ${dev}"
1156 if echo "${dev}" | grep -qs loop
1158 # strange things happens, user confused?
1159 snaploop=$( losetup ${dev} | awk '{print $3}' | tr -d '()' )
1160 snapfile=$(basename ${snaploop})
1161 snapdev=$(awk -v pat="$( dirname ${snaploop})" '$2 == pat { print $1 }' /proc/mounts)
1166 if ! do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
1168 log_warning_msg "Impossible to include the ${snap_type} Snapshot (i)"
1171 if [ -n "${snapfile}" ]
1173 # it was a loop device, user confused
1178 log_warning_msg "Impossible to include the ${snap_type} Snapshot (o)"
1182 echo "export ${snap_type}SNAP=${snap_relpath}:${snapdev}:${snapfile}" >> snapshot.conf # for resync on reboot/halt
1188 image_directory="${1}"
1190 addimage_directory="${3}"
1192 case ${UNIONTYPE} in
1194 modprobe -q -b ${UNIONTYPE}
1196 if ! cut -f2 /proc/filesystems | grep -q "^${UNIONTYPE}\$" && [ -x /bin/unionfs-fuse ]
1198 echo "${UNIONTYPE} not available, falling back to unionfs-fuse."
1199 echo "This might be really slow."
1201 UNIONTYPE="unionfs-fuse"
1206 if [ "${UNIONTYPE}" = unionfs-fuse ]
1211 # run-init can't deal with images in a subdir, but we're going to
1212 # move all of these away before it runs anyway. No, we're not,
1213 # put them in / since move-mounting them into / breaks mono and
1218 # Let's just mount the read-only file systems first
1221 if [ "${UNIONTYPE}" = "aufs" ]
1224 noxino_opt="noxino,"
1225 elif [ "${UNIONTYPE}" = "unionfs-fuse" ]
1232 if [ -z "${PLAIN_ROOT}" ]
1234 # Read image names from ${MODULE}.module if it exists
1235 if [ -e "${image_directory}/filesystem.${MODULE}.module" ]
1237 for IMAGE in $(cat ${image_directory}/filesystem.${MODULE}.module)
1239 image_string="${image_string} ${image_directory}/${IMAGE}"
1241 elif [ -e "${image_directory}/${MODULE}.module" ]
1243 for IMAGE in $(cat ${image_directory}/${MODULE}.module)
1245 image_string="${image_string} ${image_directory}/${IMAGE}"
1248 # ${MODULE}.module does not exist, create a list of images
1249 for FILESYSTEM in squashfs ext2 ext3 ext4 xfs jffs2 dir
1251 for IMAGE in "${image_directory}"/*."${FILESYSTEM}"
1253 if [ -e "${IMAGE}" ]
1255 image_string="${image_string} ${IMAGE}"
1260 if [ -n "${addimage_directory}" ] && [ -d "${addimage_directory}" ]
1262 for FILESYSTEM in squashfs ext2 ext3 ext4 xfs jffs2 dir
1264 for IMAGE in "${addimage_directory}"/*."${FILESYSTEM}"
1266 if [ -e "${IMAGE}" ]
1268 image_string="${image_string} ${IMAGE}"
1275 image_string="$(echo ${image_string} | sed -e 's/ /\n/g' | sort )"
1278 [ -n "${MODULETORAMFILE}" ] && image_string="${image_directory}/$(basename ${MODULETORAMFILE})"
1282 for image in ${image_string}
1284 imagename=$(basename "${image}")
1286 export image devname
1287 maybe_break live-realpremount
1288 log_begin_msg "Running /scripts/live-realpremount"
1289 run_scripts /scripts/live-realpremount
1292 if [ -d "${image}" ]
1294 # it is a plain directory: do nothing
1295 rofslist="${image} ${rofslist}"
1296 elif [ -f "${image}" ]
1298 if losetup --help 2>&1 | grep -q -- "-r\b"
1300 backdev=$(get_backing_device "${image}" "-r")
1302 backdev=$(get_backing_device "${image}")
1304 fstype=$(get_fstype "${backdev}")
1306 if [ "${fstype}" = "unknown" ]
1308 panic "Unknown file system type on ${backdev} (${image})"
1311 if [ -z "${fstype}" ]
1313 fstype="${imagename##*.}"
1314 log_warning_msg "Unknown file system type on ${backdev} (${image}), assuming ${fstype}."
1317 if [ "${UNIONTYPE}" != "unionmount" ]
1319 mpoint="${croot}/${imagename}"
1320 rofslist="${mpoint} ${rofslist}"
1323 rofslist="${rootmnt} ${rofslist}"
1325 mkdir -p "${mpoint}"
1326 log_begin_msg "Mounting \"${image}\" on \"${mpoint}\" via \"${backdev}\""
1327 mount -t "${fstype}" -o ro,noatime "${backdev}" "${mpoint}" || panic "Can not mount ${backdev} (${image}) on ${mpoint}"
1332 # we have a plain root system
1333 mkdir -p "${croot}/filesystem"
1334 log_begin_msg "Mounting \"${image_directory}\" on \"${croot}/filesystem\""
1335 mount -t $(get_fstype "${image_directory}") -o ro,noatime "${image_directory}" "${croot}/filesystem" || \
1336 panic "Can not mount ${image_directory} on ${croot}/filesystem" && \
1337 rofslist="${croot}/filesystem ${rofslist}"
1339 mount -o bind ${croot}/filesystem $mountpoint
1345 # Looking for "${root_persistence}" device or file
1346 if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
1349 if [ -z "${QUICKUSBMODULES}" ]
1352 num_block=$(ls -l /sys/block | wc -l)
1353 for module in sd_mod uhci-hcd ehci-hcd ohci-hcd usb-storage
1355 modprobe -q -b ${module}
1361 # For some reason, udevsettle does not block in this scenario,
1362 # so we sleep for a little while.
1364 # See https://bugs.launchpad.net/ubuntu/+source/casper/+bug/84591
1365 for timeout in 5 4 3 2 1
1369 if [ $(ls -l /sys/block | wc -l) -gt ${num_block} ]
1376 case "${PERSISTENT_MEDIA}" in
1378 whitelistdev="$(removable_dev)"
1381 whitelistdev="$(removable_usb_dev)"
1388 # search for label and files (this could be hugely optimized)
1389 cowprobe=$(find_cow_device "${root_persistence}" "${blacklistdev}" "${whitelistdev}")
1390 if [ -b "${cowprobe}" ]
1392 # Blacklist /cow device, to avoid inconsistent setups for overlapping snapshots
1393 # makes sense to have both persistence for /cow and /home mounted, maybe also with
1394 # snapshots to be sure to really store some e.g key config files,
1395 # but not on the same media
1396 blacklistdev="${cowprobe}"
1397 PERSISTENCE_IS_ON="1"
1398 export PERSISTENCE_IS_ON
1400 # homecow just mount something on /home, this should be generalized some way
1401 homecow=$(find_cow_device "${home_persistence}" "${blacklistdev}" "${whitelistdev}")
1402 if [ -b "${homecow}" ]
1404 PERSISTENCE_IS_ON="1"
1405 export PERSISTENCE_IS_ON
1407 root_snapdata=$(find_snap "${root_snapshot_label}" "${blacklistdev}" "${whitelistdev}")
1408 # This second type should be removed when snapshot will get smarter,
1409 # hence when "/etc/live-snapshot*list" will be supported also by
1410 # ext2|ext3|ext4|jffs2 snapshot types.
1411 home_snapdata=$(find_snap "${home_snapshot_label}" "${blacklistdev}" "${whitelistdev}")
1413 if [ -b "${cowprobe}" ]
1415 cowdevice=${cowprobe}
1416 cow_fstype=$(get_fstype "${cowprobe}")
1417 cow_mountopt="rw,noatime"
1419 if [ "${FORCEPERSISTENTFSCK}" = "Yes" ]
1421 fsck -y ${cowdevice}
1424 log_warning_msg "Unable to find the persistent medium"
1427 cow_mountopt="rw,noatime,mode=755"
1429 elif [ -n "${NFS_COW}" ] && [ -z "${NOPERSISTENT}" ]
1431 # check if there are any nfs options
1432 if echo ${NFS_COW}|grep -q ','
1434 nfs_cow_opts="-o nolock,$(echo ${NFS_COW}|cut -d, -f2-)"
1435 nfs_cow=$(echo ${NFS_COW}|cut -d, -f1)
1437 nfs_cow_opts="-o nolock"
1443 cowdevice=$(echo ${nfs_cow}|sed "s/client_mac_address/${mac}/")
1446 panic "unable to determine mac address"
1451 cow_mountopt="rw,noatime,mode=755"
1454 if [ "${UNIONTYPE}" != "unionmount" ]
1457 if [ "${cow_fstype}" = "nfs" ]
1460 "Trying nfsmount ${nfs_cow_opts} ${cowdevice} /cow"
1461 nfsmount ${nfs_cow_opts} ${cowdevice} /cow || \
1462 panic "Can not mount ${cowdevice} (n: ${cow_fstype}) on /cow"
1464 mount -t ${cow_fstype} -o ${cow_mountopt} ${cowdevice} /cow || \
1465 panic "Can not mount ${cowdevice} (o: ${cow_fstype}) on /cow"
1469 rofscount=$(echo ${rofslist} |wc -w)
1471 if [ ${rofscount} -ne 1 ]
1473 panic "only one RO file system supported with exposedroot: ${rofslist}"
1477 if [ -n "${EXPOSED_ROOT}" ]
1479 mount --bind ${rofs} ${rootmnt} || \
1480 panic "bind mount of ${rofs} failed"
1482 if [ -z "${SKIP_UNION_MOUNTS}" ]
1484 cow_dirs='/var/tmp /var/lock /var/run /var/log /var/spool /home /var/lib/live'
1492 if [ "${cow_fstype}" != "tmpfs" ] && [ "${cow_dirs}" != "/" ] && [ "${UNIONTYPE}" = "unionmount" ]
1494 true # FIXME: Maybe it does, I don't really know.
1495 #panic "unionmount does not support subunions (${cow_dirs})."
1501 for dir in ${cow_dirs}; do
1504 unionmountpoint="${rootmnt}${dir}"
1505 unionrw="/cow${dir}"
1506 unionro="${rofs}${dir}"
1507 # We don't handle spaces and other junk gracefully here, hopefully not needed.
1508 case "${UNIONTYPE}" in
1510 unionmountopts="-o cow -o noinitgroups -o default_permissions -o allow_other -o use_ino -o suid"
1511 unionmountopts="${unionmountopts} ${unionrw}=RW:${unionro}=RO"
1512 ( sysctl -w fs.file-max=391524 ; ulimit -HSn 16384
1513 unionfs-fuse ${unionmountopts} "${unionmountpoint}" ) && \
1514 ( mkdir -p /run/sendsigs.omit.d
1515 pidof unionfs-fuse >> /run/sendsigs.omit.d/unionfs-fuse || true )
1519 unionmountopts="-t ${cow_fstype} -o noatime,union,${cow_mountopt} ${cowdevice}"
1520 mount_full $unionmountopts "${unionmountpoint}"
1525 unionmountopts="-o noatime,${noxino_opt}dirs=${unionrw}=rw:${unionro}=${roopt}"
1526 mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}"
1529 panic "mount ${UNIONTYPE} on ${unionmountpoint} failed with option ${unionmountopts}"
1532 # Correct the permissions of /:
1533 chmod 0755 "${rootmnt}"
1535 # tmpfs file systems
1537 mkdir -p "${rootmnt}/live"
1538 mount -t tmpfs tmpfs ${rootmnt}/live
1540 # Adding other custom mounts
1541 if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
1543 # directly mount /home
1544 # FIXME: add a custom mounts configurable system
1546 if [ -b "${homecow}" ]
1548 mount -t $(get_fstype "${homecow}") -o rw,noatime "${homecow}" "${rootmnt}/home"
1549 export HOMEMOUNTED=1 # used to proper calculate free space in do_snap_copy()
1551 log_warning_msg "Unable to find the persistent home medium"
1554 # Look for other snapshots to copy in
1555 try_snap "${root_snapdata}" "${rootmnt}" "ROOT"
1556 # This second type should be removed when snapshot grow smarter
1557 try_snap "${home_snapdata}" "${rootmnt}" "HOME" "/home"
1560 if [ -n "${SHOWMOUNTS}" ]
1562 for d in ${rofslist}
1564 mkdir -p "${rootmnt}/live/${d##*/}"
1568 # do nothing # mount -o bind "${d}" "${rootmnt}/live/${d##*/}"
1572 case "${UNIONTYPE}" in
1574 mount -o bind "${d}" "${rootmnt}/live/${d##*/}"
1578 mount -o move "${d}" "${rootmnt}/live/${d##*/}"
1586 # shows cow fs on /cow for use by live-snapshot
1587 mkdir -p "${rootmnt}/live/cow"
1588 mount -o move /cow "${rootmnt}/live/cow" >/dev/null 2>&1 || mount -o bind /cow "${rootmnt}/live/cow" || log_warning_msg "Unable to move or bind /cow to ${rootmnt}/live/cow"
1595 skip_uuid_check="${3}"
1597 # support for fromiso=.../isofrom=....
1598 if [ -n "$FROMISO" ]
1600 ISO_DEVICE=$(dirname $FROMISO)
1601 if ! [ -b $ISO_DEVICE ]
1603 # to support unusual device names like /dev/cciss/c0d0p1
1604 # as well we have to identify the block device name, let's
1605 # do that for up to 15 levels
1607 while [ -n "$ISO_DEVICE" ] && [ "$i" -gt 0 ]
1609 ISO_DEVICE=$(dirname ${ISO_DEVICE})
1610 [ -b "$ISO_DEVICE" ] && break
1615 if [ "$ISO_DEVICE" = "/" ]
1617 echo "Warning: device for bootoption isofrom= ($FROMISO) not found.">>/live-boot.log
1619 fs_type=$(get_fstype "${ISO_DEVICE}")
1620 if is_supported_fs ${fs_type}
1623 mount -t $fs_type "$ISO_DEVICE" /isofrom
1624 ISO_NAME="$(echo $FROMISO | sed "s|$ISO_DEVICE||")"
1625 loopdevname=$(setup_loop "/isofrom/${ISO_NAME}" "loop" "/sys/block/loop*" "" '')
1626 devname="${loopdevname}"
1628 echo "Warning: unable to mount $ISO_DEVICE." >>/live-boot.log
1633 if [ -z "${devname}" ]
1635 devname=$(sys2dev "${sysdev}")
1638 if [ -d "${devname}" ]
1640 mount -o bind "${devname}" $mountpoint || continue
1642 if is_live_path $mountpoint
1652 for device in ${devname}
1656 # Adding lvm support
1657 if [ -x /scripts/local-top/lvm2 ]
1659 ROOT="$device" resume="" /scripts/local-top/lvm2
1664 # Adding raid support
1665 if [ -x /scripts/local-top/mdadm ]
1667 cp /conf/conf.d/md /conf/conf.d/md.orig
1668 echo "MD_DEVS=$device " >> /conf/conf.d/md
1669 /scripts/local-top/mdadm
1670 mv /conf/conf.d/md.orig /conf/conf.d/md
1677 [ -n "$device" ] && devname="$device"
1679 [ -e "$devname" ] || continue
1681 if [ -n "${LIVE_MEDIA_OFFSET}" ]
1683 loopdevname=$(setup_loop "${devname}" "loop" "/sys/block/loop*" "${LIVE_MEDIA_OFFSET}" '')
1684 devname="${loopdevname}"
1687 fstype=$(get_fstype "${devname}")
1689 if is_supported_fs ${fstype}
1691 devuid=$(blkid -o value -s UUID "$devname")
1692 [ -n "$devuid" ] && grep -qs "\<$devuid\>" $tried && continue
1693 mount -t ${fstype} -o ro,noatime "${devname}" ${mountpoint} || continue
1694 [ -n "$devuid" ] && echo "$devuid" >> $tried
1696 if is_live_path ${mountpoint} && \
1697 ([ "${skip_uuid_check}" ] || matches_uuid ${mountpoint})
1702 umount ${mountpoint} 2>/dev/null
1706 if [ -n "${LIVE_MEDIA_OFFSET}" ]
1708 losetup -d "${loopdevname}"
1718 # don't start autodetection before timeout has expired
1719 if [ -n "${LIVE_MEDIA_TIMEOUT}" ]
1721 if [ "${timeout}" -lt "${LIVE_MEDIA_TIMEOUT}" ]
1727 # first look at the one specified in the command line
1728 case "${LIVE_MEDIA}" in
1730 for sysblock in $(removable_usb_dev "sys")
1732 for dev in $(subdevices "${sysblock}")
1734 if check_dev "${dev}"
1744 for sysblock in $(removable_dev "sys")
1746 for dev in $(subdevices "${sysblock}")
1748 if check_dev "${dev}"
1758 if [ ! -z "${LIVE_MEDIA}" ]
1760 if check_dev "null" "${LIVE_MEDIA}" "skip_uuid_check"
1768 # or do the scan of block devices
1769 # prefer removable devices over non-removable devices, so scan them first
1770 devices_to_scan="$(removable_dev 'sys') $(non_removable_dev 'sys')"
1772 for sysblock in $devices_to_scan
1774 devname=$(sys2dev "${sysblock}")
1775 [ -e "$devname" ] || continue
1776 fstype=$(get_fstype "${devname}")
1778 if /lib/udev/cdrom_id ${devname} > /dev/null
1780 if check_dev "null" "${devname}"
1784 elif is_nice_device "${sysblock}"
1786 for dev in $(subdevices "${sysblock}")
1788 if check_dev "${dev}"
1793 elif [ "${fstype}" = "squashfs" -o \
1794 "${fstype}" = "btrfs" -o \
1795 "${fstype}" = "ext2" -o \
1796 "${fstype}" = "ext3" -o \
1797 "${fstype}" = "ext4" -o \
1798 "${fstype}" = "jffs2" ]
1800 # This is an ugly hack situation, the block device has
1801 # an image directly on it. It's hopefully
1802 # live-boot, so take it and run with it.
1803 ln -s "${devname}" "${devname}.${fstype}"
1804 echo "${devname}.${fstype}"
1814 media_mountpoint="${1}"
1816 log_begin_msg "Checking media integrity"
1818 cd ${media_mountpoint}
1819 /bin/md5sum -c md5sum.txt < /dev/tty8 > /dev/tty8
1824 if [ "${RC}" -eq 0 ]
1826 log_success_msg "Everything ok, will reboot in 10 seconds."
1829 umount ${media_mountpoint}
1831 echo u > /proc/sysrq-trigger
1832 echo b > /proc/sysrq-trigger
1834 panic "Not ok, a media defect is likely, switch to VT8 for details."
1840 if [ -x /scripts/local-top/cryptroot ]; then
1841 /scripts/local-top/cryptroot
1846 exec > live-boot.log
1848 tail -f live-boot.log >&7 &
1851 # Ensure 'panic' function is overridden
1852 . /scripts/live-functions
1856 maybe_break live-premount
1857 log_begin_msg "Running /scripts/live-premount"
1858 run_scripts /scripts/live-premount
1861 # Needed here too because some things (*cough* udev *cough*)
1862 # changes the timeout
1864 if [ ! -z "${NETBOOT}" ] || [ ! -z "${FETCH}" ] || [ ! -z "${HTTPFS}" ] || [ ! -z "${FTPFS}" ]
1868 livefs_root="${mountpoint}"
1870 panic "Unable to find a live file system on the network"
1873 if [ -n "${ISCSI_PORTAL}" ]
1875 do_iscsi && livefs_root="${mountpoint}"
1876 elif [ -n "${PLAIN_ROOT}" ] && [ -n "${ROOT}" ]
1878 # Do a local boot from hd
1881 if [ -x /usr/bin/memdiskfind ]
1883 MEMDISK=$(/usr/bin/memdiskfind)
1887 # We found a memdisk, set up phram
1888 modprobe phram phram=memdisk,${MEMDISK}
1890 # Load mtdblock, the memdisk will be /dev/mtdblock0
1895 # Scan local devices for the image
1897 while [ "$i" -lt 60 ]
1899 livefs_root=$(find_livefs ${i})
1901 if [ -n "${livefs_root}" ]
1912 if [ -z "${livefs_root}" ]
1914 panic "Unable to find a medium containing a live file system"
1917 if [ "${INTEGRITY_CHECK}" ]
1919 integrity_check "${livefs_root}"
1925 elif [ "${TODISK}" ]
1927 live_dest="${TODISK}"
1930 if [ "${live_dest}" ]
1932 log_begin_msg "Copying live media to ${live_dest}"
1933 copy_live_to "${livefs_root}" "${live_dest}"
1937 # if we do not unmount the ISO we can't run "fsck /dev/ice" later on
1938 # because the mountpoint is left behind in /proc/mounts, so let's get
1939 # rid of it when running from RAM
1940 if [ -n "$FROMISO" ] && [ "${TORAM}" ]
1942 losetup -d /dev/loop0
1943 grep -q /isofrom /proc/mounts && umount /isofrom
1946 if [ -n "${MODULETORAMFILE}" ] || [ -n "${PLAIN_ROOT}" ]
1948 setup_unionfs "${livefs_root}" "${rootmnt}"
1951 mac="$(echo ${mac} | sed 's/-//g')"
1952 mount_images_in_directory "${livefs_root}" "${rootmnt}" "${mac}"
1956 if [ -n "${ROOT_PID}" ] ; then
1957 echo "${ROOT_PID}" > "${rootmnt}"/live/root.pid
1962 # unionfs-fuse needs /dev to be bind-mounted for the duration of
1963 # live-bottom; udev's init script will take care of things after that
1964 if [ "${UNIONTYPE}" = unionfs-fuse ]
1966 mount -n -o bind /dev "${rootmnt}/dev"
1969 # Move to the new root filesystem so that programs there can get at it.
1970 if [ ! -d /root/live/image ]
1972 mkdir -p /root/live/image
1973 mount --move /live/image /root/live/image
1976 # aufs2 in kernel versions around 2.6.33 has a regression:
1977 # directories can't be accessed when read for the first the time,
1978 # causing a failure for example when accessing /var/lib/fai
1979 # when booting FAI, this simple workaround solves it
1980 ls /root/* >/dev/null 2>&1
1982 # copy snapshot configuration if exists
1983 if [ -f snapshot.conf ]
1985 log_begin_msg "Copying snapshot.conf to ${rootmnt}/etc/live/boot.d"
1986 if [ ! -d "${rootmnt}/etc/live/boot.d" ]
1988 mkdir -p "${rootmnt}/etc/live/boot.d"
1990 cp snapshot.conf "${rootmnt}/etc/live/boot.d/"
1994 if [ -f /etc/resolv.conf ] && [ ! -s ${rootmnt}/etc/resolv.conf ]
1996 log_begin_msg "Copying /etc/resolv.conf to ${rootmnt}/etc/resolv.conf"
1997 cp -v /etc/resolv.conf ${rootmnt}/etc/resolv.conf
2001 maybe_break live-bottom
2002 log_begin_msg "Running /scripts/live-bottom\n"
2004 run_scripts /scripts/live-bottom
2007 if [ "${UNIONFS}" = unionfs-fuse ]
2009 umount "${rootmnt}/dev"
2015 [ -w "${rootmnt}/var/log/" ] && cp live-boot.log "${rootmnt}/var/log/" 2>/dev/null