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
257 PERSISTENT_METHOD="${ARGUMENT#*=}"
258 export PERSISTENT_METHOD
262 PERSISTENT_PATH="${ARGUMENT#persistent-path=}"
263 export PERSISTENT_PATH
266 persistent-storage=*)
267 PERSISTENT_STORAGE="${ARGUMENT#persistent-storage=}"
268 export PERSISTENT_STORAGE
271 persistent-subtext=*)
272 root_persistence="${root_persistence}-${ARGUMENT#persistent-subtext=}"
273 home_persistence="${home_persistence}-${ARGUMENT#persistent-subtext=}"
274 root_snapshot_label="${root_snapshot_label}-${ARGUMENT#persistent-subtext=}"
275 home_snapshot_label="${home_snapshot_label}-${ARGUMENT#persistent-subtext=}"
289 NOPROMPT="${ARGUMENT#noprompt=}"
294 QUICKUSBMODULES="Yes"
295 export QUICKUSBMODULES
298 preseed/file=*|file=*)
299 LOCATIONS="${ARGUMENT#*=} ${LOCATIONS}"
309 question="${ARGUMENT%%=*}"
310 value="${ARGUMENT#*=}"
311 PRESEEDS="${PRESEEDS}\"${question}=${value}\" "
326 TODISK="${ARGUMENT#todisk=}"
337 MODULETORAM="${ARGUMENT#toram=}"
338 export TORAM MODULETORAM
352 SKIP_UNION_MOUNTS="Yes"
353 export SKIP_UNION_MOUNTS
357 ROOT="${ARGUMENT#root=}"
362 UNIONTYPE="${ARGUMENT#union=}"
368 # sort of compatibility with netboot.h from linux docs
369 if [ -z "${NETBOOT}" ]
371 if [ "${ROOT}" = "/dev/nfs" ]
375 elif [ "${ROOT}" = "/dev/cifs" ]
382 if [ -z "${MODULE}" ]
388 if [ -z "${UNIONTYPE}" ]
394 if [ -n "${PERSISTENT}" ] && [ -z "${PERSISTENT_METHOD}" ]
396 PERSISTENT_METHOD="snapshot,overlay"
397 export PERSISTENT_METHOD
400 if [ -n "${PERSISTENT}" ] && [ -z "${PERSISTENT_STORAGE}" ]
402 PERSISTENT_STORAGE="filesystem,file"
403 export PERSISTENT_STORAGE
411 if [ -d "${DIRECTORY}"/"${LIVE_MEDIA_PATH}" ]
413 for FILESYSTEM in squashfs ext2 ext3 ext4 xfs dir jffs2
415 if [ "$(echo ${DIRECTORY}/${LIVE_MEDIA_PATH}/*.${FILESYSTEM})" != "${DIRECTORY}/${LIVE_MEDIA_PATH}/*.${FILESYSTEM}" ]
427 if [ "${IGNORE_UUID}" ] || [ ! -e /conf/uuid.conf ]
433 uuid="$(cat /conf/uuid.conf)"
435 for try_uuid_file in "${path}/.disk/live-uuid"*
437 [ -e "${try_uuid_file}" ] || continue
439 try_uuid="$(cat "${try_uuid_file}")"
441 if [ "${uuid}" = "${try_uuid}" ]
450 get_backing_device ()
453 *.squashfs|*.ext2|*.ext3|*.ext4|*.jffs2)
454 echo $(setup_loop "${1}" "loop" "/sys/block/loop*" '0' "${LIVE_MEDIA_ENCRYPTION}" "${2}")
462 panic "Unrecognized live filesystem: ${1}"
467 match_files_in_dir ()
469 # Does any files match pattern ${1} ?
472 if [ "$(echo ${pattern})" != "${pattern}" ]
480 mount_images_in_directory ()
487 if match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.squashfs" ||
488 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext2" ||
489 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext3" ||
490 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext4" ||
491 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.jffs2" ||
492 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.dir"
494 [ -n "${mac}" ] && adddirectory="${directory}/${LIVE_MEDIA_PATH}/${mac}"
495 setup_unionfs "${directory}/${LIVE_MEDIA_PATH}" "${rootmnt}" "${adddirectory}"
497 panic "No supported filesystem images found at /${LIVE_MEDIA_PATH}."
503 sysfs_path="${1#/sys}"
505 if [ -e /lib/udev/path_id ]
508 PATH_ID="/lib/udev/path_id"
510 # wheezy/sid (udev >= 174)
511 PATH_ID="/sbin/udevadm test-builtin path_id"
514 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)"
517 elif echo "${sysfs_path}" | grep -q '^/block/vd[a-z]$'
520 elif echo ${sysfs_path} | grep -q "^/block/dm-"
523 elif echo ${sysfs_path} | grep -q "^/block/mtdblock"
535 copyto="${copyfrom}_swap"
537 if [ -z "${MODULETORAM}" ]
539 size=$(fs_size "" ${copyfrom}/${LIVE_MEDIA_PATH} "used")
541 MODULETORAMFILE="${copyfrom}/${LIVE_MEDIA_PATH}/${MODULETORAM}"
543 if [ -f "${MODULETORAMFILE}" ]
545 size=$( expr $(ls -la ${MODULETORAMFILE} | awk '{print $5}') / 1024 + 5000 )
547 log_warning_msg "Error: toram-module ${MODULETORAM} (${MODULETORAMFILE}) could not be read."
552 if [ "${copytodev}" = "ram" ]
555 freespace=$(awk '/^MemFree:/{f=$2} /^Cached:/{c=$2} END{print f+c}' /proc/meminfo)
556 mount_options="-o size=${size}k"
561 # it should be a writable block device
562 if [ -b "${copytodev}" ]
566 fstype=$(get_fstype "${dev}")
567 freespace=$(fs_size "${dev}")
569 log_warning_msg "${copytodev} is not a block device."
574 if [ "${freespace}" -lt "${size}" ]
576 log_warning_msg "Not enough free ${free_string} (${freespace}k free, ${size}k needed) to copy live media in ${copytodev}."
580 # Custom ramdisk size
581 if [ -z "${mount_options}" ] && [ -n "${ramdisk_size}" ]
583 # FIXME: should check for wrong values
584 mount_options="-o size=${ramdisk_size}"
587 # begin copying (or uncompressing)
589 log_begin_msg "mount -t ${fstype} ${mount_options} ${dev} ${copyto}"
590 mount -t "${fstype}" ${mount_options} "${dev}" "${copyto}"
592 if [ "${extension}" = "tgz" ]
595 tar zxf "${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
596 rm -f "${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
597 mount -r -o move "${copyto}" "${rootmnt}"
600 if [ -n "${MODULETORAMFILE}" ]
604 echo " * Copying $MODULETORAMFILE to RAM" 1>/dev/console
605 rsync -a --progress ${MODULETORAMFILE} ${copyto} 1>/dev/console # copy only the filesystem module
607 cp ${MODULETORAMFILE} ${copyto} # copy only the filesystem module
612 echo " * Copying whole medium to RAM" 1>/dev/console
613 rsync -a --progress ${copyfrom}/* ${copyto} 1>/dev/console # "cp -a" from busybox also copies hidden files
615 mkdir -p ${copyto}/${LIVE_MEDIA_PATH}
616 cp -a ${copyfrom}/${LIVE_MEDIA_PATH}/* ${copyto}/${LIVE_MEDIA_PATH}
617 if [ -e ${copyfrom}/${LIVE_MEDIA_PATH}/.disk ]
619 cp -a ${copyfrom}/${LIVE_MEDIA_PATH}/.disk ${copyto}
625 mount -r -o move ${copyto} ${copyfrom}
634 modprobe -q af_packet # For DHCP
639 [ -n "$ETHDEV_TIMEOUT" ] || ETHDEV_TIMEOUT=15
640 echo "Using timeout of $ETHDEV_TIMEOUT seconds for network configuration."
642 if [ -z "${NETBOOT}" ] && [ -z "${FETCH}" ] && \
643 [ -z "${HTTPFS}" ] && [ -z "${FTPFS}" ]
647 # support for Syslinux IPAPPEND parameter
648 # it sets the BOOTIF variable on the kernel parameter
650 if [ -n "${BOOTIF}" ]
652 # pxelinux sets BOOTIF to a value based on the mac address of the
653 # network card used to PXE boot, so use this value for DEVICE rather
654 # than a hard-coded device name from initramfs.conf. this facilitates
655 # network booting when machines may have multiple network cards.
656 # pxelinux sets BOOTIF to 01-$mac_address
658 # strip off the leading "01-", which isn't part of the mac
660 temp_mac=${BOOTIF#*-}
662 # convert to typical mac address format by replacing "-" with ":"
667 if [ -z "$bootif_mac" ]
671 bootif_mac="$bootif_mac:$x"
676 # look for devices with matching mac address, and set DEVICE to
677 # appropriate value if match is found.
679 for device in /sys/class/net/*
681 if [ -f "$device/address" ]
683 current_mac=$(cat "$device/address")
685 if [ "$bootif_mac" = "$current_mac" ]
694 # if ethdevice was not specified on the kernel command line
695 # make sure we try to get a working network configuration
696 # for *every* present network device (except for loopback of course)
697 if [ -z "$ETHDEVICE" ] ; then
698 echo "If you want to boot from a specific device use bootoption ethdevice=..."
699 for device in /sys/class/net/*; do
701 if [ "$dev" != "lo" ] ; then
702 ETHDEVICE="$ETHDEVICE $dev"
707 # split args of ethdevice=eth0,eth1 into "eth0 eth1"
708 for device in $(echo $ETHDEVICE | sed 's/,/ /g') ; do
709 devlist="$devlist $device"
712 # this is tricky (and ugly) because ipconfig sometimes just hangs/runs into
713 # an endless loop; iff execution fails give it two further tries, that's
714 # why we use '$devlist $devlist $devlist' for the other for loop
715 for dev in $devlist $devlist $devlist ; do
716 echo "Executing ipconfig -t $ETHDEV_TIMEOUT $dev"
717 ipconfig -t "$ETHDEV_TIMEOUT" $dev | tee -a /netboot.config &
719 sleep "$ETHDEV_TIMEOUT" ; sleep 1
720 if [ -r /proc/"$jobid"/status ] ; then
721 echo "Killing job $jobid for device $dev as ipconfig ran into recursion..."
725 # if configuration of device worked we should have an assigned
726 # IP address, iff so let's use the according as $DEVICE for later usage
727 # simple and primitive approach which seems to work fine
728 if ifconfig $dev | grep -q 'inet.*addr:' ; then
735 for interface in ${DEVICE}; do
736 ipconfig -t "$ETHDEV_TIMEOUT" ${interface} | tee /netboot-${interface}.config
737 [ -e /tmp/net-${interface}.conf ] && . /tmp/net-${interface}.conf
738 if [ "$IPV4ADDR" != "0.0.0.0" ]
745 for interface in ${DEVICE}; do
746 # source relevant ipconfig output
747 OLDHOSTNAME=${HOSTNAME}
748 [ -e /tmp/net-${interface}.conf ] && . /tmp/net-${interface}.conf
749 [ -z ${HOSTNAME} ] && HOSTNAME=${OLDHOSTNAME}
752 if [ -n "${interface}" ]
754 HWADDR="$(cat /sys/class/net/${interface}/address)"
757 if [ ! -e "/etc/resolv.conf" ]
759 echo "Creating /etc/resolv.conf"
761 if [ -n "${DNSDOMAIN}" ]
763 echo "domain ${DNSDOMAIN}" > /etc/resolv.conf
764 echo "search ${DNSDOMAIN}" >> /etc/resolv.conf
767 for i in ${IPV4DNS0} ${IPV4DNS1} ${IPV4DNS1}
769 if [ -n "$i" ] && [ "$i" != 0.0.0.0 ]
771 echo "nameserver $i" >> /etc/resolv.conf
776 # Check if we have a network device at all
777 if ! ls /sys/class/net/"$interface" > /dev/null 2>&1 && \
778 ! ls /sys/class/net/eth0 > /dev/null 2>&1 && \
779 ! ls /sys/class/net/wlan0 > /dev/null 2>&1 && \
780 ! ls /sys/class/net/ath0 > /dev/null 2>&1 && \
781 ! ls /sys/class/net/ra0 > /dev/null 2>&1
783 panic "No supported network device found, maybe a non-mainline driver is required."
792 if [ "${NFSROOT}" = "auto" ]
794 NFSROOT=${ROOTSERVER}:${ROOTPATH}
799 if ( [ -n "${FETCH}" ] || [ -n "${HTTPFS}" ] || [ -n "${FTPFS}" ] )
805 if [ "${NFSROOT#*:}" = "${NFSROOT}" ] && [ "$NETBOOT" != "cifs" ]
807 NFSROOT=${ROOTSERVER}:${NFSROOT}
810 log_begin_msg "Trying netboot from ${NFSROOT}"
812 if [ "${NETBOOT}" != "nfs" ] && do_cifsmount
832 [ "${DEBUG}" == "Yes" ] && debugopt="-d 8"
833 #FIXME this name is supposed to be unique - some date + ifconfig hash?
834 ISCSI_INITIATORNAME="iqn.1993-08.org.debian.live:01:$(echo "${HWADDR}" | sed -e s/://g)"
835 export ISCSI_INITIATORNAME
836 if [ -n "${ISCSI_SERVER}" ] ; then
837 iscsistart $debugopt -i "${ISCSI_INITIATORNAME}" -t "${ISCSI_TARGET}" -g 1 -a "${ISCSI_SERVER}" -p "${ISCSI_PORT}"
839 iscsistart $debugopt -i "${ISCSI_INITIATORNAME}" -t "${ISCSI_TARGET}" -g 1 -a "${ISCSI_PORTAL}" -p 3260
843 panic "Failed to log into iscsi target"
845 local host="$(ls -d /sys/class/scsi_host/host*/device/iscsi_host:host* \
846 /sys/class/scsi_host/host*/device/iscsi_host/host* | sed -e 's:/device.*::' -e 's:.*host::')"
851 while [ -z "${devices}" -a $i -lt 60 ]
854 devices="$(ls -d /sys/class/scsi_device/${host}*/device/block:* \
855 /sys/class/scsi_device/${host}*/device/block/* | sed -e 's!.*[:/]!!')"
861 if check_dev "null" "/dev/$dev"
868 panic "Failed to locate a live device on iSCSI devices (tried: $devices)."
870 panic "Failed to locate iSCSI host in /sys"
878 for webfile in HTTPFS FTPFS FETCH
880 local url="$(eval echo \"\$\{${webfile}\}\")"
881 local extension="$(echo "${url}" | sed 's/\(.*\)\.\(.*\)/\2/')"
885 case "${extension}" in
886 iso|squashfs|tgz|tar)
887 if [ "${extension}" = "iso" ]
889 mkdir -p "${alt_mountpoint}"
890 dest="${alt_mountpoint}"
892 local dest="${mountpoint}/${LIVE_MEDIA_PATH}"
893 mount -t ramfs ram "${mountpoint}"
896 if [ "${webfile}" = "FETCH" ]
900 ip="$(dirname $url | sed -e 's|tftp://||g' -e 's|/.*$||g')"
901 rfile="$(echo $url | sed -e "s|tftp://$ip||g")"
902 lfile="$(basename $url)"
903 log_begin_msg "Trying tftp -g -b 10240 -r $rfile -l ${dest}/$lfile $ip"
904 tftp -g -b 10240 -r $rfile -l ${dest}/$lfile $ip
908 log_begin_msg "Trying wget ${url} -O ${dest}/$(basename ${url})"
909 wget "${url}" -O "${dest}/$(basename ${url})"
913 log_begin_msg "Trying to mount ${url} on ${dest}/$(basename ${url})"
914 if [ "${webfile}" = "FTPFS" ]
916 FUSE_MOUNT="curlftpfs"
917 url="$(dirname ${url})"
922 $FUSE_MOUNT "${url}" "${dest}"
923 ROOT_PID="$(minips h -C "$FUSE_MOUNT" | { read x y ; echo "$x" ; } )"
925 [ ${?} -eq 0 ] && rc=0
926 [ "${extension}" = "tgz" ] && live_dest="ram"
927 if [ "${extension}" = "iso" ]
929 isoloop=$(setup_loop "${dest}/$(basename "${url}")" "loop" "/sys/block/loop*" "" '')
930 mount -t iso9660 "${isoloop}" "${mountpoint}"
937 log_begin_msg "Unrecognized archive extension for ${url}"
945 if [ -d "${alt_mountpoint}" ]
947 umount "${alt_mountpoint}"
948 rmdir "${alt_mountpoint}"
950 umount "${mountpoint}"
951 elif [ "${webfile}" != "FETCH" ] ; then
965 if [ -z "${NFSOPTS}" ]
970 log_begin_msg "Trying nfsmount -o nolock -o ro ${NFSOPTS} ${NFSROOT} ${mountpoint}"
972 # FIXME: This while loop is an ugly HACK round an nfs bug
974 while [ "$i" -lt 60 ]
976 nfsmount -o nolock -o ro ${NFSOPTS} "${NFSROOT}" "${mountpoint}" && rc=0 && break
988 if [ -x "/sbin/mount.cifs" ]
990 if [ -z "${NFSOPTS}" ]
992 CIFSOPTS="-ouser=root,password="
994 CIFSOPTS="${NFSOPTS}"
997 log_begin_msg "Trying mount.cifs ${NFSROOT} ${mountpoint} ${CIFSOPTS}"
1000 if mount.cifs "${NFSROOT}" "${mountpoint}" "${CIFSOPTS}"
1014 size=$(fs_size "${fromdev}" "" "used")
1016 if [ -b "${fromdev}" ]
1018 log_success_msg "Copying snapshot ${fromdev} to ${todir}..."
1021 if [ -n "${HOMEMOUNTED}" -a "${snap_type}" = "HOME" ]
1023 todev=$(awk -v pat="$(base_path ${todir})" '$2 == pat { print $1 }' /proc/mounts)
1024 freespace=$(df -k | awk '/'${todev}'/{print $4}')
1026 freespace=$(awk '/^MemFree:/{f=$2} /^Cached:/{c=$2} END{print f+c}' /proc/meminfo)
1029 tomount="/mnt/tmpsnap"
1031 if [ ! -d "${tomount}" ]
1033 mkdir -p "${tomount}"
1036 fstype=$(get_fstype "${fromdev}")
1038 if [ -n "${fstype}" ]
1041 mount -o ro -t "${fstype}" "${fromdev}" "${tomount}" || log_warning_msg "Error in mount -t ${fstype} -o ro ${fromdev} ${tomount}"
1042 cp -a "${tomount}"/* ${todir}
1045 log_warning_msg "Unrecognized fstype: ${fstype} on ${fromdev}:${snap_type}"
1050 if echo ${fromdev} | grep -qs loop
1052 losetup -d "${fromdev}"
1057 log_warning_msg "Unable to find the snapshot ${snap_type} medium"
1064 # Look for ${snap_label}.* in block devices
1066 black_listed_devices="${2}"
1067 white_listed_devices="${3}"
1069 if echo ${PERSISTENT_STORAGE} | grep -qw file
1071 # search for image files
1072 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}")
1075 if echo ${PERSISTENT_STORAGE} | grep -qw filesystem && [ -z "${snapdata}" ]
1077 snapdata=$(find_cow_device "${snap_label}" "${black_listed_devices}" "${white_listed_devices}")
1084 # copy the contents of previously found snapshot to ${snap_mount}
1085 # and remember the device and filename for resync on exit in live-boot.init
1092 if [ -z "${snap_relpath}" ]
1094 # root snapshot, default usage
1097 # relative snapshot (actually used just for "/home" snapshots)
1098 snap_mount="${2}${snap_relpath}"
1101 if [ -n "${snapdata}" ] && [ ! -b "${snapdata}" ]
1103 log_success_msg "found snapshot: ${snapdata}"
1104 snapdev="$(echo ${snapdata} | cut -f1 -d ' ')"
1105 snapback="$(echo ${snapdata} | cut -f2 -d ' ')"
1106 snapfile="$(echo ${snapdata} | cut -f3 -d ' ')"
1108 if ! try_mount "${snapdev}" "${snapback}" "ro"
1115 if echo "${snapfile}" | grep -qs '\(squashfs\|ext2\|ext3\|ext4\|jffs2\)'
1117 # squashfs, jffs2 or ext2/ext3/ext4 snapshot
1118 dev=$(get_backing_device "${snapback}/${snapfile}")
1120 do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
1125 # Unfortunately klibc's cpio is incompatible with the
1126 # rest of the world; everything else requires -u -d,
1127 # while klibc doesn't implement them. Try to detect
1128 # whether it's in use.
1129 cpiopath="$(which cpio)" || true
1130 if [ "$cpiopath" ] && grep -aq /lib/klibc "$cpiopath"
1134 cpioargs='--unconditional --make-directories'
1137 if [ -s "${snapback}/${snapfile}" ]
1140 cd "${snap_mount}" && zcat "${snapback}/${snapfile}" | $cpiopath $cpioargs --extract --preserve-modification-time --no-absolute-filenames --sparse 2>/dev/null
1144 log_warning_msg "${snapback}/${snapfile} is empty, adding it for sync on reboot."
1148 if [ "${RES}" != "0" ]
1150 log_warning_msg "failure to \"zcat ${snapback}/${snapfile} | $cpiopath $cpioargs --extract --preserve-modification-time --no-absolute-filenames --sparse\""
1154 umount "${snapback}" || log_warning_msg "failure to \"umount ${snapback}\""
1156 if [ "${RES}" != "0" ]
1158 log_warning_msg "Impossible to include the ${snapfile} Snapshot file"
1161 elif [ -b "${snapdata}" ]
1163 # Try to find if it could be a snapshot partition
1165 log_success_msg "found snapshot ${snap_type} device on ${dev}"
1166 if echo "${dev}" | grep -qs loop
1168 # strange things happens, user confused?
1169 snaploop=$( losetup ${dev} | awk '{print $3}' | tr -d '()' )
1170 snapfile=$(basename ${snaploop})
1171 snapdev=$(awk -v pat="$( dirname ${snaploop})" '$2 == pat { print $1 }' /proc/mounts)
1176 if ! do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
1178 log_warning_msg "Impossible to include the ${snap_type} Snapshot (i)"
1181 if [ -n "${snapfile}" ]
1183 # it was a loop device, user confused
1188 log_warning_msg "Impossible to include the ${snap_type} Snapshot (o)"
1192 echo "export ${snap_type}SNAP=${snap_relpath}:${snapdev}:${snapfile}" >> snapshot.conf # for resync on reboot/halt
1198 image_directory="${1}"
1200 addimage_directory="${3}"
1202 case ${UNIONTYPE} in
1204 modprobe -q -b ${UNIONTYPE}
1206 if ! cut -f2 /proc/filesystems | grep -q "^${UNIONTYPE}\$" && [ -x /bin/unionfs-fuse ]
1208 echo "${UNIONTYPE} not available, falling back to unionfs-fuse."
1209 echo "This might be really slow."
1211 UNIONTYPE="unionfs-fuse"
1216 if [ "${UNIONTYPE}" = unionfs-fuse ]
1221 # run-init can't deal with images in a subdir, but we're going to
1222 # move all of these away before it runs anyway. No, we're not,
1223 # put them in / since move-mounting them into / breaks mono and
1228 # Let's just mount the read-only file systems first
1231 if [ "${UNIONTYPE}" = "aufs" ]
1234 noxino_opt="noxino,"
1235 elif [ "${UNIONTYPE}" = "unionfs-fuse" ]
1242 if [ -z "${PLAIN_ROOT}" ]
1244 # Read image names from ${MODULE}.module if it exists
1245 if [ -e "${image_directory}/filesystem.${MODULE}.module" ]
1247 for IMAGE in $(cat ${image_directory}/filesystem.${MODULE}.module)
1249 image_string="${image_string} ${image_directory}/${IMAGE}"
1251 elif [ -e "${image_directory}/${MODULE}.module" ]
1253 for IMAGE in $(cat ${image_directory}/${MODULE}.module)
1255 image_string="${image_string} ${image_directory}/${IMAGE}"
1258 # ${MODULE}.module does not exist, create a list of images
1259 for FILESYSTEM in squashfs ext2 ext3 ext4 xfs jffs2 dir
1261 for IMAGE in "${image_directory}"/*."${FILESYSTEM}"
1263 if [ -e "${IMAGE}" ]
1265 image_string="${image_string} ${IMAGE}"
1270 if [ -n "${addimage_directory}" ] && [ -d "${addimage_directory}" ]
1272 for FILESYSTEM in squashfs ext2 ext3 ext4 xfs jffs2 dir
1274 for IMAGE in "${addimage_directory}"/*."${FILESYSTEM}"
1276 if [ -e "${IMAGE}" ]
1278 image_string="${image_string} ${IMAGE}"
1285 image_string="$(echo ${image_string} | sed -e 's/ /\n/g' | sort )"
1288 [ -n "${MODULETORAMFILE}" ] && image_string="${image_directory}/$(basename ${MODULETORAMFILE})"
1292 for image in ${image_string}
1294 imagename=$(basename "${image}")
1296 export image devname
1297 maybe_break live-realpremount
1298 log_begin_msg "Running /scripts/live-realpremount"
1299 run_scripts /scripts/live-realpremount
1302 if [ -d "${image}" ]
1304 # it is a plain directory: do nothing
1305 rofslist="${image} ${rofslist}"
1306 elif [ -f "${image}" ]
1308 if losetup --help 2>&1 | grep -q -- "-r\b"
1310 backdev=$(get_backing_device "${image}" "-r")
1312 backdev=$(get_backing_device "${image}")
1314 fstype=$(get_fstype "${backdev}")
1316 if [ "${fstype}" = "unknown" ]
1318 panic "Unknown file system type on ${backdev} (${image})"
1321 if [ -z "${fstype}" ]
1323 fstype="${imagename##*.}"
1324 log_warning_msg "Unknown file system type on ${backdev} (${image}), assuming ${fstype}."
1327 if [ "${UNIONTYPE}" != "unionmount" ]
1329 mpoint="${croot}/${imagename}"
1330 rofslist="${mpoint} ${rofslist}"
1333 rofslist="${rootmnt} ${rofslist}"
1335 mkdir -p "${mpoint}"
1336 log_begin_msg "Mounting \"${image}\" on \"${mpoint}\" via \"${backdev}\""
1337 mount -t "${fstype}" -o ro,noatime "${backdev}" "${mpoint}" || panic "Can not mount ${backdev} (${image}) on ${mpoint}"
1342 # we have a plain root system
1343 mkdir -p "${croot}/filesystem"
1344 log_begin_msg "Mounting \"${image_directory}\" on \"${croot}/filesystem\""
1345 mount -t $(get_fstype "${image_directory}") -o ro,noatime "${image_directory}" "${croot}/filesystem" || \
1346 panic "Can not mount ${image_directory} on ${croot}/filesystem" && \
1347 rofslist="${croot}/filesystem ${rofslist}"
1349 mount -o bind ${croot}/filesystem $mountpoint
1355 # Looking for "${root_persistence}" device or file
1356 if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
1359 if [ -z "${QUICKUSBMODULES}" ]
1362 num_block=$(ls -l /sys/block | wc -l)
1363 for module in sd_mod uhci-hcd ehci-hcd ohci-hcd usb-storage
1365 modprobe -q -b ${module}
1371 # For some reason, udevsettle does not block in this scenario,
1372 # so we sleep for a little while.
1374 # See https://bugs.launchpad.net/ubuntu/+source/casper/+bug/84591
1375 for timeout in 5 4 3 2 1
1379 if [ $(ls -l /sys/block | wc -l) -gt ${num_block} ]
1386 case "${PERSISTENT_MEDIA}" in
1388 whitelistdev="$(removable_dev)"
1391 whitelistdev="$(removable_usb_dev)"
1398 if echo ${PERSISTENT_METHOD} | grep -qw overlay
1400 # search for label and files (this could be hugely optimized)
1401 cowprobe=$(find_cow_device "${root_persistence}" "${blacklistdev}" "${whitelistdev}")
1402 if [ -b "${cowprobe}" ]
1404 # Blacklist /cow device, to avoid inconsistent setups for overlapping snapshots
1405 # makes sense to have both persistence for /cow and /home mounted, maybe also with
1406 # snapshots to be sure to really store some e.g key config files,
1407 # but not on the same media
1408 blacklistdev="${cowprobe}"
1409 PERSISTENCE_IS_ON="1"
1410 export PERSISTENCE_IS_ON
1412 # homecow just mount something on /home, this should be generalized some way
1413 homecow=$(find_cow_device "${home_persistence}" "${blacklistdev}" "${whitelistdev}")
1414 if [ -b "${homecow}" ]
1416 PERSISTENCE_IS_ON="1"
1417 export PERSISTENCE_IS_ON
1421 if echo ${PERSISTENT_METHOD} | grep -qw snapshot
1423 root_snapdata=$(find_snap "${root_snapshot_label}" "${blacklistdev}" "${whitelistdev}")
1424 # This second type should be removed when snapshot will get smarter,
1425 # hence when "/etc/live-snapshot*list" will be supported also by
1426 # ext2|ext3|ext4|jffs2 snapshot types.
1427 home_snapdata=$(find_snap "${home_snapshot_label}" "${blacklistdev}" "${whitelistdev}")
1430 if [ -b "${cowprobe}" ]
1432 cowdevice=${cowprobe}
1433 cow_fstype=$(get_fstype "${cowprobe}")
1434 cow_mountopt="rw,noatime"
1436 if [ "${FORCEPERSISTENTFSCK}" = "Yes" ]
1438 fsck -y ${cowdevice}
1441 log_warning_msg "Unable to find the persistent medium"
1444 cow_mountopt="rw,noatime,mode=755"
1446 elif [ -n "${NFS_COW}" ] && [ -z "${NOPERSISTENT}" ]
1448 # check if there are any nfs options
1449 if echo ${NFS_COW}|grep -q ','
1451 nfs_cow_opts="-o nolock,$(echo ${NFS_COW}|cut -d, -f2-)"
1452 nfs_cow=$(echo ${NFS_COW}|cut -d, -f1)
1454 nfs_cow_opts="-o nolock"
1460 cowdevice=$(echo ${nfs_cow}|sed "s/client_mac_address/${mac}/")
1463 panic "unable to determine mac address"
1468 cow_mountopt="rw,noatime,mode=755"
1471 if [ "${UNIONTYPE}" != "unionmount" ]
1474 if [ "${cow_fstype}" = "nfs" ]
1477 "Trying nfsmount ${nfs_cow_opts} ${cowdevice} /cow"
1478 nfsmount ${nfs_cow_opts} ${cowdevice} /cow || \
1479 panic "Can not mount ${cowdevice} (n: ${cow_fstype}) on /cow"
1481 mount -t ${cow_fstype} -o ${cow_mountopt} ${cowdevice} /cow || \
1482 panic "Can not mount ${cowdevice} (o: ${cow_fstype}) on /cow"
1486 rofscount=$(echo ${rofslist} |wc -w)
1488 if [ ${rofscount} -ne 1 ]
1490 panic "only one RO file system supported with exposedroot: ${rofslist}"
1494 if [ -n "${EXPOSED_ROOT}" ]
1496 mount --bind ${rofs} ${rootmnt} || \
1497 panic "bind mount of ${rofs} failed"
1499 if [ -z "${SKIP_UNION_MOUNTS}" ]
1501 cow_dirs='/var/tmp /var/lock /var/run /var/log /var/spool /home /var/lib/live'
1509 if [ "${cow_fstype}" != "tmpfs" ] && [ "${cow_dirs}" != "/" ] && [ "${UNIONTYPE}" = "unionmount" ]
1511 true # FIXME: Maybe it does, I don't really know.
1512 #panic "unionmount does not support subunions (${cow_dirs})."
1518 for dir in ${cow_dirs}; do
1521 unionmountpoint="${rootmnt}${dir}"
1522 unionrw="/cow${dir}"
1523 unionro="${rofs}${dir}"
1524 # We don't handle spaces and other junk gracefully here, hopefully not needed.
1525 case "${UNIONTYPE}" in
1527 unionmountopts="-o cow -o noinitgroups -o default_permissions -o allow_other -o use_ino -o suid"
1528 unionmountopts="${unionmountopts} ${unionrw}=RW:${unionro}=RO"
1529 ( sysctl -w fs.file-max=391524 ; ulimit -HSn 16384
1530 unionfs-fuse ${unionmountopts} "${unionmountpoint}" ) && \
1531 ( mkdir -p /run/sendsigs.omit.d
1532 pidof unionfs-fuse >> /run/sendsigs.omit.d/unionfs-fuse || true )
1536 unionmountopts="-t ${cow_fstype} -o noatime,union,${cow_mountopt} ${cowdevice}"
1537 mount_full $unionmountopts "${unionmountpoint}"
1542 unionmountopts="-o noatime,${noxino_opt}dirs=${unionrw}=rw:${unionro}=${roopt}"
1543 mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}"
1546 panic "mount ${UNIONTYPE} on ${unionmountpoint} failed with option ${unionmountopts}"
1549 # Correct the permissions of /:
1550 chmod 0755 "${rootmnt}"
1552 # tmpfs file systems
1554 mkdir -p "${rootmnt}/live"
1555 mount -t tmpfs tmpfs ${rootmnt}/live
1557 # Adding other custom mounts
1558 if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
1560 # directly mount /home
1561 # FIXME: add a custom mounts configurable system
1563 if [ -b "${homecow}" ]
1565 mount -t $(get_fstype "${homecow}") -o rw,noatime "${homecow}" "${rootmnt}/home"
1566 export HOMEMOUNTED=1 # used to proper calculate free space in do_snap_copy()
1568 log_warning_msg "Unable to find the persistent home medium"
1571 # Look for other snapshots to copy in
1572 try_snap "${root_snapdata}" "${rootmnt}" "ROOT"
1573 # This second type should be removed when snapshot grow smarter
1574 try_snap "${home_snapdata}" "${rootmnt}" "HOME" "/home"
1577 if [ -n "${SHOWMOUNTS}" ]
1579 for d in ${rofslist}
1581 mkdir -p "${rootmnt}/live/${d##*/}"
1585 # do nothing # mount -o bind "${d}" "${rootmnt}/live/${d##*/}"
1589 case "${UNIONTYPE}" in
1591 mount -o bind "${d}" "${rootmnt}/live/${d##*/}"
1595 mount -o move "${d}" "${rootmnt}/live/${d##*/}"
1603 # shows cow fs on /cow for use by live-snapshot
1604 mkdir -p "${rootmnt}/live/cow"
1605 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"
1612 skip_uuid_check="${3}"
1614 # support for fromiso=.../isofrom=....
1615 if [ -n "$FROMISO" ]
1617 ISO_DEVICE=$(dirname $FROMISO)
1618 if ! [ -b $ISO_DEVICE ]
1620 # to support unusual device names like /dev/cciss/c0d0p1
1621 # as well we have to identify the block device name, let's
1622 # do that for up to 15 levels
1624 while [ -n "$ISO_DEVICE" ] && [ "$i" -gt 0 ]
1626 ISO_DEVICE=$(dirname ${ISO_DEVICE})
1627 [ -b "$ISO_DEVICE" ] && break
1632 if [ "$ISO_DEVICE" = "/" ]
1634 echo "Warning: device for bootoption isofrom= ($FROMISO) not found.">>/live-boot.log
1636 fs_type=$(get_fstype "${ISO_DEVICE}")
1637 if is_supported_fs ${fs_type}
1640 mount -t $fs_type "$ISO_DEVICE" /isofrom
1641 ISO_NAME="$(echo $FROMISO | sed "s|$ISO_DEVICE||")"
1642 loopdevname=$(setup_loop "/isofrom/${ISO_NAME}" "loop" "/sys/block/loop*" "" '')
1643 devname="${loopdevname}"
1645 echo "Warning: unable to mount $ISO_DEVICE." >>/live-boot.log
1650 if [ -z "${devname}" ]
1652 devname=$(sys2dev "${sysdev}")
1655 if [ -d "${devname}" ]
1657 mount -o bind "${devname}" $mountpoint || continue
1659 if is_live_path $mountpoint
1669 for device in ${devname}
1673 # Adding lvm support
1674 if [ -x /scripts/local-top/lvm2 ]
1676 ROOT="$device" resume="" /scripts/local-top/lvm2
1681 # Adding raid support
1682 if [ -x /scripts/local-top/mdadm ]
1684 cp /conf/conf.d/md /conf/conf.d/md.orig
1685 echo "MD_DEVS=$device " >> /conf/conf.d/md
1686 /scripts/local-top/mdadm
1687 mv /conf/conf.d/md.orig /conf/conf.d/md
1694 [ -n "$device" ] && devname="$device"
1696 [ -e "$devname" ] || continue
1698 if [ -n "${LIVE_MEDIA_OFFSET}" ]
1700 loopdevname=$(setup_loop "${devname}" "loop" "/sys/block/loop*" "${LIVE_MEDIA_OFFSET}" '')
1701 devname="${loopdevname}"
1704 fstype=$(get_fstype "${devname}")
1706 if is_supported_fs ${fstype}
1708 devuid=$(blkid -o value -s UUID "$devname")
1709 [ -n "$devuid" ] && grep -qs "\<$devuid\>" $tried && continue
1710 mount -t ${fstype} -o ro,noatime "${devname}" ${mountpoint} || continue
1711 [ -n "$devuid" ] && echo "$devuid" >> $tried
1713 if is_live_path ${mountpoint} && \
1714 ([ "${skip_uuid_check}" ] || matches_uuid ${mountpoint})
1719 umount ${mountpoint} 2>/dev/null
1723 if [ -n "${LIVE_MEDIA_OFFSET}" ]
1725 losetup -d "${loopdevname}"
1735 # don't start autodetection before timeout has expired
1736 if [ -n "${LIVE_MEDIA_TIMEOUT}" ]
1738 if [ "${timeout}" -lt "${LIVE_MEDIA_TIMEOUT}" ]
1744 # first look at the one specified in the command line
1745 case "${LIVE_MEDIA}" in
1747 for sysblock in $(removable_usb_dev "sys")
1749 for dev in $(subdevices "${sysblock}")
1751 if check_dev "${dev}"
1761 for sysblock in $(removable_dev "sys")
1763 for dev in $(subdevices "${sysblock}")
1765 if check_dev "${dev}"
1775 if [ ! -z "${LIVE_MEDIA}" ]
1777 if check_dev "null" "${LIVE_MEDIA}" "skip_uuid_check"
1785 # or do the scan of block devices
1786 # prefer removable devices over non-removable devices, so scan them first
1787 devices_to_scan="$(removable_dev 'sys') $(non_removable_dev 'sys')"
1789 for sysblock in $devices_to_scan
1791 devname=$(sys2dev "${sysblock}")
1792 [ -e "$devname" ] || continue
1793 fstype=$(get_fstype "${devname}")
1795 if /lib/udev/cdrom_id ${devname} > /dev/null
1797 if check_dev "null" "${devname}"
1801 elif is_nice_device "${sysblock}"
1803 for dev in $(subdevices "${sysblock}")
1805 if check_dev "${dev}"
1810 elif [ "${fstype}" = "squashfs" -o \
1811 "${fstype}" = "btrfs" -o \
1812 "${fstype}" = "ext2" -o \
1813 "${fstype}" = "ext3" -o \
1814 "${fstype}" = "ext4" -o \
1815 "${fstype}" = "jffs2" ]
1817 # This is an ugly hack situation, the block device has
1818 # an image directly on it. It's hopefully
1819 # live-boot, so take it and run with it.
1820 ln -s "${devname}" "${devname}.${fstype}"
1821 echo "${devname}.${fstype}"
1831 media_mountpoint="${1}"
1833 log_begin_msg "Checking media integrity"
1835 cd ${media_mountpoint}
1836 /bin/md5sum -c md5sum.txt < /dev/tty8 > /dev/tty8
1841 if [ "${RC}" -eq 0 ]
1843 log_success_msg "Everything ok, will reboot in 10 seconds."
1846 umount ${media_mountpoint}
1848 echo u > /proc/sysrq-trigger
1849 echo b > /proc/sysrq-trigger
1851 panic "Not ok, a media defect is likely, switch to VT8 for details."
1857 if [ -x /scripts/local-top/cryptroot ]; then
1858 /scripts/local-top/cryptroot
1863 exec > live-boot.log
1865 tail -f live-boot.log >&7 &
1868 # Ensure 'panic' function is overridden
1869 . /scripts/live-functions
1873 maybe_break live-premount
1874 log_begin_msg "Running /scripts/live-premount"
1875 run_scripts /scripts/live-premount
1878 # Needed here too because some things (*cough* udev *cough*)
1879 # changes the timeout
1881 if [ ! -z "${NETBOOT}" ] || [ ! -z "${FETCH}" ] || [ ! -z "${HTTPFS}" ] || [ ! -z "${FTPFS}" ]
1885 livefs_root="${mountpoint}"
1887 panic "Unable to find a live file system on the network"
1890 if [ -n "${ISCSI_PORTAL}" ]
1892 do_iscsi && livefs_root="${mountpoint}"
1893 elif [ -n "${PLAIN_ROOT}" ] && [ -n "${ROOT}" ]
1895 # Do a local boot from hd
1898 if [ -x /usr/bin/memdiskfind ]
1900 MEMDISK=$(/usr/bin/memdiskfind)
1904 # We found a memdisk, set up phram
1905 modprobe phram phram=memdisk,${MEMDISK}
1907 # Load mtdblock, the memdisk will be /dev/mtdblock0
1912 # Scan local devices for the image
1914 while [ "$i" -lt 60 ]
1916 livefs_root=$(find_livefs ${i})
1918 if [ -n "${livefs_root}" ]
1929 if [ -z "${livefs_root}" ]
1931 panic "Unable to find a medium containing a live file system"
1934 if [ "${INTEGRITY_CHECK}" ]
1936 integrity_check "${livefs_root}"
1942 elif [ "${TODISK}" ]
1944 live_dest="${TODISK}"
1947 if [ "${live_dest}" ]
1949 log_begin_msg "Copying live media to ${live_dest}"
1950 copy_live_to "${livefs_root}" "${live_dest}"
1954 # if we do not unmount the ISO we can't run "fsck /dev/ice" later on
1955 # because the mountpoint is left behind in /proc/mounts, so let's get
1956 # rid of it when running from RAM
1957 if [ -n "$FROMISO" ] && [ "${TORAM}" ]
1959 losetup -d /dev/loop0
1960 grep -q /isofrom /proc/mounts && umount /isofrom
1963 if [ -n "${MODULETORAMFILE}" ] || [ -n "${PLAIN_ROOT}" ]
1965 setup_unionfs "${livefs_root}" "${rootmnt}"
1968 mac="$(echo ${mac} | sed 's/-//g')"
1969 mount_images_in_directory "${livefs_root}" "${rootmnt}" "${mac}"
1973 if [ -n "${ROOT_PID}" ] ; then
1974 echo "${ROOT_PID}" > "${rootmnt}"/live/root.pid
1979 # unionfs-fuse needs /dev to be bind-mounted for the duration of
1980 # live-bottom; udev's init script will take care of things after that
1981 if [ "${UNIONTYPE}" = unionfs-fuse ]
1983 mount -n -o bind /dev "${rootmnt}/dev"
1986 # Move to the new root filesystem so that programs there can get at it.
1987 if [ ! -d /root/live/image ]
1989 mkdir -p /root/live/image
1990 mount --move /live/image /root/live/image
1993 # aufs2 in kernel versions around 2.6.33 has a regression:
1994 # directories can't be accessed when read for the first the time,
1995 # causing a failure for example when accessing /var/lib/fai
1996 # when booting FAI, this simple workaround solves it
1997 ls /root/* >/dev/null 2>&1
1999 # copy snapshot configuration if exists
2000 if [ -f snapshot.conf ]
2002 log_begin_msg "Copying snapshot.conf to ${rootmnt}/etc/live/boot.d"
2003 if [ ! -d "${rootmnt}/etc/live/boot.d" ]
2005 mkdir -p "${rootmnt}/etc/live/boot.d"
2007 cp snapshot.conf "${rootmnt}/etc/live/boot.d/"
2011 if [ -f /etc/resolv.conf ] && [ ! -s ${rootmnt}/etc/resolv.conf ]
2013 log_begin_msg "Copying /etc/resolv.conf to ${rootmnt}/etc/resolv.conf"
2014 cp -v /etc/resolv.conf ${rootmnt}/etc/resolv.conf
2018 maybe_break live-bottom
2019 log_begin_msg "Running /scripts/live-bottom\n"
2021 run_scripts /scripts/live-bottom
2024 if [ "${UNIONFS}" = unionfs-fuse ]
2026 umount "${rootmnt}/dev"
2032 [ -w "${rootmnt}/var/log/" ] && cp live-boot.log "${rootmnt}/var/log/" 2>/dev/null