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=}"
248 PERSISTENT="${ARGUMENT#persistent=}"
249 if [ -z "${PERSISTENT}" ]
256 persistent-encryption=*)
257 PERSISTENT_ENCRYPTION="${ARGUMENT#*=}"
258 export PERSISTENT_ENCRYPTION
262 PERSISTENT_MEDIA="${ARGUMENT#*=}"
263 export PERSISTENT_MEDIA
267 PERSISTENT_PATH="${ARGUMENT#persistent-path=}"
268 export PERSISTENT_PATH
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}" ]
399 if [ -d "${DIRECTORY}"/"${LIVE_MEDIA_PATH}" ]
401 for FILESYSTEM in squashfs ext2 ext3 ext4 xfs dir jffs2
403 if [ "$(echo ${DIRECTORY}/${LIVE_MEDIA_PATH}/*.${FILESYSTEM})" != "${DIRECTORY}/${LIVE_MEDIA_PATH}/*.${FILESYSTEM}" ]
415 if [ "${IGNORE_UUID}" ] || [ ! -e /conf/uuid.conf ]
421 uuid="$(cat /conf/uuid.conf)"
423 for try_uuid_file in "${path}/.disk/live-uuid"*
425 [ -e "${try_uuid_file}" ] || continue
427 try_uuid="$(cat "${try_uuid_file}")"
429 if [ "${uuid}" = "${try_uuid}" ]
438 get_backing_device ()
441 *.squashfs|*.ext2|*.ext3|*.ext4|*.jffs2)
442 echo $(setup_loop "${1}" "loop" "/sys/block/loop*" '0' "${LIVE_MEDIA_ENCRYPTION}" "${2}")
450 panic "Unrecognized live filesystem: ${1}"
455 match_files_in_dir ()
457 # Does any files match pattern ${1} ?
460 if [ "$(echo ${pattern})" != "${pattern}" ]
468 mount_images_in_directory ()
475 if match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.squashfs" ||
476 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext2" ||
477 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext3" ||
478 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext4" ||
479 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.jffs2" ||
480 match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.dir"
482 [ -n "${mac}" ] && adddirectory="${directory}/${LIVE_MEDIA_PATH}/${mac}"
483 setup_unionfs "${directory}/${LIVE_MEDIA_PATH}" "${rootmnt}" "${adddirectory}"
485 panic "No supported filesystem images found at /${LIVE_MEDIA_PATH}."
491 sysfs_path="${1#/sys}"
493 if [ -e /lib/udev/path_id ]
496 PATH_ID="/lib/udev/path_id"
498 # wheezy/sid (udev >= 174)
499 PATH_ID="/sbin/udevadm test-builtin path_id"
502 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)"
505 elif echo "${sysfs_path}" | grep -q '^/block/vd[a-z]$'
508 elif echo ${sysfs_path} | grep -q "^/block/dm-"
511 elif echo ${sysfs_path} | grep -q "^/block/mtdblock"
523 copyto="${copyfrom}_swap"
525 if [ -z "${MODULETORAM}" ]
527 size=$(fs_size "" ${copyfrom}/${LIVE_MEDIA_PATH} "used")
529 MODULETORAMFILE="${copyfrom}/${LIVE_MEDIA_PATH}/${MODULETORAM}"
531 if [ -f "${MODULETORAMFILE}" ]
533 size=$( expr $(ls -la ${MODULETORAMFILE} | awk '{print $5}') / 1024 + 5000 )
535 log_warning_msg "Error: toram-module ${MODULETORAM} (${MODULETORAMFILE}) could not be read."
540 if [ "${copytodev}" = "ram" ]
543 freespace=$(awk '/^MemFree:/{f=$2} /^Cached:/{c=$2} END{print f+c}' /proc/meminfo)
544 mount_options="-o size=${size}k"
549 # it should be a writable block device
550 if [ -b "${copytodev}" ]
554 fstype=$(get_fstype "${dev}")
555 freespace=$(fs_size "${dev}")
557 log_warning_msg "${copytodev} is not a block device."
562 if [ "${freespace}" -lt "${size}" ]
564 log_warning_msg "Not enough free ${free_string} (${freespace}k free, ${size}k needed) to copy live media in ${copytodev}."
568 # Custom ramdisk size
569 if [ -z "${mount_options}" ] && [ -n "${ramdisk_size}" ]
571 # FIXME: should check for wrong values
572 mount_options="-o size=${ramdisk_size}"
575 # begin copying (or uncompressing)
577 log_begin_msg "mount -t ${fstype} ${mount_options} ${dev} ${copyto}"
578 mount -t "${fstype}" ${mount_options} "${dev}" "${copyto}"
580 if [ "${extension}" = "tgz" ]
583 tar zxf "${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
584 rm -f "${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
585 mount -r -o move "${copyto}" "${rootmnt}"
588 if [ -n "${MODULETORAMFILE}" ]
592 echo " * Copying $MODULETORAMFILE to RAM" 1>/dev/console
593 rsync -a --progress ${MODULETORAMFILE} ${copyto} 1>/dev/console # copy only the filesystem module
595 cp ${MODULETORAMFILE} ${copyto} # copy only the filesystem module
600 echo " * Copying whole medium to RAM" 1>/dev/console
601 rsync -a --progress ${copyfrom}/* ${copyto} 1>/dev/console # "cp -a" from busybox also copies hidden files
603 mkdir -p ${copyto}/${LIVE_MEDIA_PATH}
604 cp -a ${copyfrom}/${LIVE_MEDIA_PATH}/* ${copyto}/${LIVE_MEDIA_PATH}
605 if [ -e ${copyfrom}/${LIVE_MEDIA_PATH}/.disk ]
607 cp -a ${copyfrom}/${LIVE_MEDIA_PATH}/.disk ${copyto}
613 mount -r -o move ${copyto} ${copyfrom}
622 modprobe -q af_packet # For DHCP
627 [ -n "$ETHDEV_TIMEOUT" ] || ETHDEV_TIMEOUT=15
628 echo "Using timeout of $ETHDEV_TIMEOUT seconds for network configuration."
630 if [ -z "${NETBOOT}" ] && [ -z "${FETCH}" ] && \
631 [ -z "${HTTPFS}" ] && [ -z "${FTPFS}" ]
635 # support for Syslinux IPAPPEND parameter
636 # it sets the BOOTIF variable on the kernel parameter
638 if [ -n "${BOOTIF}" ]
640 # pxelinux sets BOOTIF to a value based on the mac address of the
641 # network card used to PXE boot, so use this value for DEVICE rather
642 # than a hard-coded device name from initramfs.conf. this facilitates
643 # network booting when machines may have multiple network cards.
644 # pxelinux sets BOOTIF to 01-$mac_address
646 # strip off the leading "01-", which isn't part of the mac
648 temp_mac=${BOOTIF#*-}
650 # convert to typical mac address format by replacing "-" with ":"
655 if [ -z "$bootif_mac" ]
659 bootif_mac="$bootif_mac:$x"
664 # look for devices with matching mac address, and set DEVICE to
665 # appropriate value if match is found.
667 for device in /sys/class/net/*
669 if [ -f "$device/address" ]
671 current_mac=$(cat "$device/address")
673 if [ "$bootif_mac" = "$current_mac" ]
682 # if ethdevice was not specified on the kernel command line
683 # make sure we try to get a working network configuration
684 # for *every* present network device (except for loopback of course)
685 if [ -z "$ETHDEVICE" ] ; then
686 echo "If you want to boot from a specific device use bootoption ethdevice=..."
687 for device in /sys/class/net/*; do
689 if [ "$dev" != "lo" ] ; then
690 ETHDEVICE="$ETHDEVICE $dev"
695 # split args of ethdevice=eth0,eth1 into "eth0 eth1"
696 for device in $(echo $ETHDEVICE | sed 's/,/ /g') ; do
697 devlist="$devlist $device"
700 # this is tricky (and ugly) because ipconfig sometimes just hangs/runs into
701 # an endless loop; iff execution fails give it two further tries, that's
702 # why we use '$devlist $devlist $devlist' for the other for loop
703 for dev in $devlist $devlist $devlist ; do
704 echo "Executing ipconfig -t $ETHDEV_TIMEOUT $dev"
705 ipconfig -t "$ETHDEV_TIMEOUT" $dev | tee -a /netboot.config &
707 sleep "$ETHDEV_TIMEOUT" ; sleep 1
708 if [ -r /proc/"$jobid"/status ] ; then
709 echo "Killing job $jobid for device $dev as ipconfig ran into recursion..."
713 # if configuration of device worked we should have an assigned
714 # IP address, iff so let's use the according as $DEVICE for later usage
715 # simple and primitive approach which seems to work fine
716 if ifconfig $dev | grep -q 'inet.*addr:' ; then
723 for interface in ${DEVICE}; do
724 ipconfig -t "$ETHDEV_TIMEOUT" ${interface} | tee /netboot-${interface}.config
725 [ -e /tmp/net-${interface}.conf ] && . /tmp/net-${interface}.conf
726 if [ "$IPV4ADDR" != "0.0.0.0" ]
733 for interface in ${DEVICE}; do
734 # source relevant ipconfig output
735 OLDHOSTNAME=${HOSTNAME}
736 [ -e /tmp/net-${interface}.conf ] && . /tmp/net-${interface}.conf
737 [ -z ${HOSTNAME} ] && HOSTNAME=${OLDHOSTNAME}
740 if [ -n "${interface}" ]
742 HWADDR="$(cat /sys/class/net/${interface}/address)"
745 if [ ! -e "/etc/resolv.conf" ]
747 echo "Creating /etc/resolv.conf"
749 if [ -n "${DNSDOMAIN}" ]
751 echo "domain ${DNSDOMAIN}" > /etc/resolv.conf
752 echo "search ${DNSDOMAIN}" >> /etc/resolv.conf
755 for i in ${IPV4DNS0} ${IPV4DNS1} ${IPV4DNS1}
757 if [ -n "$i" ] && [ "$i" != 0.0.0.0 ]
759 echo "nameserver $i" >> /etc/resolv.conf
764 # Check if we have a network device at all
765 if ! ls /sys/class/net/"$interface" > /dev/null 2>&1 && \
766 ! ls /sys/class/net/eth0 > /dev/null 2>&1 && \
767 ! ls /sys/class/net/wlan0 > /dev/null 2>&1 && \
768 ! ls /sys/class/net/ath0 > /dev/null 2>&1 && \
769 ! ls /sys/class/net/ra0 > /dev/null 2>&1
771 panic "No supported network device found, maybe a non-mainline driver is required."
780 if [ "${NFSROOT}" = "auto" ]
782 NFSROOT=${ROOTSERVER}:${ROOTPATH}
787 if ( [ -n "${FETCH}" ] || [ -n "${HTTPFS}" ] || [ -n "${FTPFS}" ] )
793 if [ "${NFSROOT#*:}" = "${NFSROOT}" ] && [ "$NETBOOT" != "cifs" ]
795 NFSROOT=${ROOTSERVER}:${NFSROOT}
798 log_begin_msg "Trying netboot from ${NFSROOT}"
800 if [ "${NETBOOT}" != "nfs" ] && do_cifsmount
820 [ "${DEBUG}" == "Yes" ] && debugopt="-d 8"
821 #FIXME this name is supposed to be unique - some date + ifconfig hash?
822 ISCSI_INITIATORNAME="iqn.1993-08.org.debian.live:01:$(echo "${HWADDR}" | sed -e s/://g)"
823 export ISCSI_INITIATORNAME
824 if [ -n "${ISCSI_SERVER}" ] ; then
825 iscsistart $debugopt -i "${ISCSI_INITIATORNAME}" -t "${ISCSI_TARGET}" -g 1 -a "${ISCSI_SERVER}" -p "${ISCSI_PORT}"
827 iscsistart $debugopt -i "${ISCSI_INITIATORNAME}" -t "${ISCSI_TARGET}" -g 1 -a "${ISCSI_PORTAL}" -p 3260
831 panic "Failed to log into iscsi target"
833 local host="$(ls -d /sys/class/scsi_host/host*/device/iscsi_host:host* \
834 /sys/class/scsi_host/host*/device/iscsi_host/host* | sed -e 's:/device.*::' -e 's:.*host::')"
839 while [ -z "${devices}" -a $i -lt 60 ]
842 devices="$(ls -d /sys/class/scsi_device/${host}*/device/block:* \
843 /sys/class/scsi_device/${host}*/device/block/* | sed -e 's!.*[:/]!!')"
849 if check_dev "null" "/dev/$dev"
856 panic "Failed to locate a live device on iSCSI devices (tried: $devices)."
858 panic "Failed to locate iSCSI host in /sys"
866 for webfile in HTTPFS FTPFS FETCH
868 local url="$(eval echo \"\$\{${webfile}\}\")"
869 local extension="$(echo "${url}" | sed 's/\(.*\)\.\(.*\)/\2/')"
873 case "${extension}" in
874 iso|squashfs|tgz|tar)
875 if [ "${extension}" = "iso" ]
877 mkdir -p "${alt_mountpoint}"
878 dest="${alt_mountpoint}"
880 local dest="${mountpoint}/${LIVE_MEDIA_PATH}"
881 mount -t ramfs ram "${mountpoint}"
884 if [ "${webfile}" = "FETCH" ]
888 ip="$(dirname $url | sed -e 's|tftp://||g' -e 's|/.*$||g')"
889 rfile="$(echo $url | sed -e "s|tftp://$ip||g")"
890 lfile="$(basename $url)"
891 log_begin_msg "Trying tftp -g -b 10240 -r $rfile -l ${dest}/$lfile $ip"
892 tftp -g -b 10240 -r $rfile -l ${dest}/$lfile $ip
896 log_begin_msg "Trying wget ${url} -O ${dest}/$(basename ${url})"
897 wget "${url}" -O "${dest}/$(basename ${url})"
901 log_begin_msg "Trying to mount ${url} on ${dest}/$(basename ${url})"
902 if [ "${webfile}" = "FTPFS" ]
904 FUSE_MOUNT="curlftpfs"
905 url="$(dirname ${url})"
910 $FUSE_MOUNT "${url}" "${dest}"
911 ROOT_PID="$(minips h -C "$FUSE_MOUNT" | { read x y ; echo "$x" ; } )"
913 [ ${?} -eq 0 ] && rc=0
914 [ "${extension}" = "tgz" ] && live_dest="ram"
915 if [ "${extension}" = "iso" ]
917 isoloop=$(setup_loop "${dest}/$(basename "${url}")" "loop" "/sys/block/loop*" "" '')
918 mount -t iso9660 "${isoloop}" "${mountpoint}"
925 log_begin_msg "Unrecognized archive extension for ${url}"
933 if [ -d "${alt_mountpoint}" ]
935 umount "${alt_mountpoint}"
936 rmdir "${alt_mountpoint}"
938 umount "${mountpoint}"
939 elif [ "${webfile}" != "FETCH" ] ; then
953 if [ -z "${NFSOPTS}" ]
958 log_begin_msg "Trying nfsmount -o nolock -o ro ${NFSOPTS} ${NFSROOT} ${mountpoint}"
960 # FIXME: This while loop is an ugly HACK round an nfs bug
962 while [ "$i" -lt 60 ]
964 nfsmount -o nolock -o ro ${NFSOPTS} "${NFSROOT}" "${mountpoint}" && rc=0 && break
976 if [ -x "/sbin/mount.cifs" ]
978 if [ -z "${NFSOPTS}" ]
980 CIFSOPTS="-ouser=root,password="
982 CIFSOPTS="${NFSOPTS}"
985 log_begin_msg "Trying mount.cifs ${NFSROOT} ${mountpoint} ${CIFSOPTS}"
988 if mount.cifs "${NFSROOT}" "${mountpoint}" "${CIFSOPTS}"
1002 size=$(fs_size "${fromdev}" "" "used")
1004 if [ -b "${fromdev}" ]
1006 log_success_msg "Copying snapshot ${fromdev} to ${todir}..."
1009 if [ -n "${HOMEMOUNTED}" -a "${snap_type}" = "HOME" ]
1011 todev=$(awk -v pat="$(base_path ${todir})" '$2 == pat { print $1 }' /proc/mounts)
1012 freespace=$(df -k | awk '/'${todev}'/{print $4}')
1014 freespace=$(awk '/^MemFree:/{f=$2} /^Cached:/{c=$2} END{print f+c}' /proc/meminfo)
1017 tomount="/mnt/tmpsnap"
1019 if [ ! -d "${tomount}" ]
1021 mkdir -p "${tomount}"
1024 fstype=$(get_fstype "${fromdev}")
1026 if [ -n "${fstype}" ]
1029 mount -o ro -t "${fstype}" "${fromdev}" "${tomount}" || log_warning_msg "Error in mount -t ${fstype} -o ro ${fromdev} ${tomount}"
1030 cp -a "${tomount}"/* ${todir}
1033 log_warning_msg "Unrecognized fstype: ${fstype} on ${fromdev}:${snap_type}"
1038 if echo ${fromdev} | grep -qs loop
1040 losetup -d "${fromdev}"
1045 log_warning_msg "Unable to find the snapshot ${snap_type} medium"
1052 # Look for ${snap_label}.* in block devices
1054 black_listed_devices="${2}"
1055 white_listed_devices="${3}"
1057 if [ "${PERSISTENT}" != "nofiles" ]
1059 # search for image files
1060 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}")
1063 if [ -z "${snapdata}" ]
1065 snapdata=$(find_cow_device "${snap_label}" "${black_listed_devices}" "${white_listed_devices}")
1072 # copy the contents of previously found snapshot to ${snap_mount}
1073 # and remember the device and filename for resync on exit in live-boot.init
1080 if [ -z "${snap_relpath}" ]
1082 # root snapshot, default usage
1085 # relative snapshot (actually used just for "/home" snapshots)
1086 snap_mount="${2}${snap_relpath}"
1089 if [ -n "${snapdata}" ] && [ ! -b "${snapdata}" ]
1091 log_success_msg "found snapshot: ${snapdata}"
1092 snapdev="$(echo ${snapdata} | cut -f1 -d ' ')"
1093 snapback="$(echo ${snapdata} | cut -f2 -d ' ')"
1094 snapfile="$(echo ${snapdata} | cut -f3 -d ' ')"
1096 if ! try_mount "${snapdev}" "${snapback}" "ro"
1103 if echo "${snapfile}" | grep -qs '\(squashfs\|ext2\|ext3\|ext4\|jffs2\)'
1105 # squashfs, jffs2 or ext2/ext3/ext4 snapshot
1106 dev=$(get_backing_device "${snapback}/${snapfile}")
1108 do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
1113 # Unfortunately klibc's cpio is incompatible with the
1114 # rest of the world; everything else requires -u -d,
1115 # while klibc doesn't implement them. Try to detect
1116 # whether it's in use.
1117 cpiopath="$(which cpio)" || true
1118 if [ "$cpiopath" ] && grep -aq /lib/klibc "$cpiopath"
1122 cpioargs='--unconditional --make-directories'
1125 if [ -s "${snapback}/${snapfile}" ]
1128 cd "${snap_mount}" && zcat "${snapback}/${snapfile}" | $cpiopath $cpioargs --extract --preserve-modification-time --no-absolute-filenames --sparse 2>/dev/null
1132 log_warning_msg "${snapback}/${snapfile} is empty, adding it for sync on reboot."
1136 if [ "${RES}" != "0" ]
1138 log_warning_msg "failure to \"zcat ${snapback}/${snapfile} | $cpiopath $cpioargs --extract --preserve-modification-time --no-absolute-filenames --sparse\""
1142 umount "${snapback}" || log_warning_msg "failure to \"umount ${snapback}\""
1144 if [ "${RES}" != "0" ]
1146 log_warning_msg "Impossible to include the ${snapfile} Snapshot file"
1149 elif [ -b "${snapdata}" ]
1151 # Try to find if it could be a snapshot partition
1153 log_success_msg "found snapshot ${snap_type} device on ${dev}"
1154 if echo "${dev}" | grep -qs loop
1156 # strange things happens, user confused?
1157 snaploop=$( losetup ${dev} | awk '{print $3}' | tr -d '()' )
1158 snapfile=$(basename ${snaploop})
1159 snapdev=$(awk -v pat="$( dirname ${snaploop})" '$2 == pat { print $1 }' /proc/mounts)
1164 if ! do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
1166 log_warning_msg "Impossible to include the ${snap_type} Snapshot (i)"
1169 if [ -n "${snapfile}" ]
1171 # it was a loop device, user confused
1176 log_warning_msg "Impossible to include the ${snap_type} Snapshot (o)"
1180 echo "export ${snap_type}SNAP=${snap_relpath}:${snapdev}:${snapfile}" >> snapshot.conf # for resync on reboot/halt
1186 image_directory="${1}"
1188 addimage_directory="${3}"
1190 case ${UNIONTYPE} in
1192 modprobe -q -b ${UNIONTYPE}
1194 if ! cut -f2 /proc/filesystems | grep -q "^${UNIONTYPE}\$" && [ -x /bin/unionfs-fuse ]
1196 echo "${UNIONTYPE} not available, falling back to unionfs-fuse."
1197 echo "This might be really slow."
1199 UNIONTYPE="unionfs-fuse"
1204 if [ "${UNIONTYPE}" = unionfs-fuse ]
1209 # run-init can't deal with images in a subdir, but we're going to
1210 # move all of these away before it runs anyway. No, we're not,
1211 # put them in / since move-mounting them into / breaks mono and
1216 # Let's just mount the read-only file systems first
1219 if [ "${UNIONTYPE}" = "aufs" ]
1222 noxino_opt="noxino,"
1223 elif [ "${UNIONTYPE}" = "unionfs-fuse" ]
1230 if [ -z "${PLAIN_ROOT}" ]
1232 # Read image names from ${MODULE}.module if it exists
1233 if [ -e "${image_directory}/filesystem.${MODULE}.module" ]
1235 for IMAGE in $(cat ${image_directory}/filesystem.${MODULE}.module)
1237 image_string="${image_string} ${image_directory}/${IMAGE}"
1239 elif [ -e "${image_directory}/${MODULE}.module" ]
1241 for IMAGE in $(cat ${image_directory}/${MODULE}.module)
1243 image_string="${image_string} ${image_directory}/${IMAGE}"
1246 # ${MODULE}.module does not exist, create a list of images
1247 for FILESYSTEM in squashfs ext2 ext3 ext4 xfs jffs2 dir
1249 for IMAGE in "${image_directory}"/*."${FILESYSTEM}"
1251 if [ -e "${IMAGE}" ]
1253 image_string="${image_string} ${IMAGE}"
1258 if [ -n "${addimage_directory}" ] && [ -d "${addimage_directory}" ]
1260 for FILESYSTEM in squashfs ext2 ext3 ext4 xfs jffs2 dir
1262 for IMAGE in "${addimage_directory}"/*."${FILESYSTEM}"
1264 if [ -e "${IMAGE}" ]
1266 image_string="${image_string} ${IMAGE}"
1273 image_string="$(echo ${image_string} | sed -e 's/ /\n/g' | sort )"
1276 [ -n "${MODULETORAMFILE}" ] && image_string="${image_directory}/$(basename ${MODULETORAMFILE})"
1280 for image in ${image_string}
1282 imagename=$(basename "${image}")
1284 export image devname
1285 maybe_break live-realpremount
1286 log_begin_msg "Running /scripts/live-realpremount"
1287 run_scripts /scripts/live-realpremount
1290 if [ -d "${image}" ]
1292 # it is a plain directory: do nothing
1293 rofslist="${image} ${rofslist}"
1294 elif [ -f "${image}" ]
1296 if losetup --help 2>&1 | grep -q -- "-r\b"
1298 backdev=$(get_backing_device "${image}" "-r")
1300 backdev=$(get_backing_device "${image}")
1302 fstype=$(get_fstype "${backdev}")
1304 if [ "${fstype}" = "unknown" ]
1306 panic "Unknown file system type on ${backdev} (${image})"
1309 if [ -z "${fstype}" ]
1311 fstype="${imagename##*.}"
1312 log_warning_msg "Unknown file system type on ${backdev} (${image}), assuming ${fstype}."
1315 if [ "${UNIONTYPE}" != "unionmount" ]
1317 mpoint="${croot}/${imagename}"
1318 rofslist="${mpoint} ${rofslist}"
1321 rofslist="${rootmnt} ${rofslist}"
1323 mkdir -p "${mpoint}"
1324 log_begin_msg "Mounting \"${image}\" on \"${mpoint}\" via \"${backdev}\""
1325 mount -t "${fstype}" -o ro,noatime "${backdev}" "${mpoint}" || panic "Can not mount ${backdev} (${image}) on ${mpoint}"
1330 # we have a plain root system
1331 mkdir -p "${croot}/filesystem"
1332 log_begin_msg "Mounting \"${image_directory}\" on \"${croot}/filesystem\""
1333 mount -t $(get_fstype "${image_directory}") -o ro,noatime "${image_directory}" "${croot}/filesystem" || \
1334 panic "Can not mount ${image_directory} on ${croot}/filesystem" && \
1335 rofslist="${croot}/filesystem ${rofslist}"
1337 mount -o bind ${croot}/filesystem $mountpoint
1343 # Looking for "${root_persistence}" device or file
1344 if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
1347 if [ -z "${QUICKUSBMODULES}" ]
1350 num_block=$(ls -l /sys/block | wc -l)
1351 for module in sd_mod uhci-hcd ehci-hcd ohci-hcd usb-storage
1353 modprobe -q -b ${module}
1359 # For some reason, udevsettle does not block in this scenario,
1360 # so we sleep for a little while.
1362 # See https://bugs.launchpad.net/ubuntu/+source/casper/+bug/84591
1363 for timeout in 5 4 3 2 1
1367 if [ $(ls -l /sys/block | wc -l) -gt ${num_block} ]
1374 case "${PERSISTENT_MEDIA}" in
1376 whitelistdev="$(removable_dev)"
1379 whitelistdev="$(removable_usb_dev)"
1386 # search for label and files (this could be hugely optimized)
1387 cowprobe=$(find_cow_device "${root_persistence}" "${blacklistdev}" "${whitelistdev}")
1388 if [ -b "${cowprobe}" ]
1390 # Blacklist /cow device, to avoid inconsistent setups for overlapping snapshots
1391 # makes sense to have both persistence for /cow and /home mounted, maybe also with
1392 # snapshots to be sure to really store some e.g key config files,
1393 # but not on the same media
1394 blacklistdev="${cowprobe}"
1395 PERSISTENCE_IS_ON="1"
1396 export PERSISTENCE_IS_ON
1398 # homecow just mount something on /home, this should be generalized some way
1399 homecow=$(find_cow_device "${home_persistence}" "${blacklistdev}" "${whitelistdev}")
1400 if [ -b "${homecow}" ]
1402 PERSISTENCE_IS_ON="1"
1403 export PERSISTENCE_IS_ON
1405 root_snapdata=$(find_snap "${root_snapshot_label}" "${blacklistdev}" "${whitelistdev}")
1406 # This second type should be removed when snapshot will get smarter,
1407 # hence when "/etc/live-snapshot*list" will be supported also by
1408 # ext2|ext3|ext4|jffs2 snapshot types.
1409 home_snapdata=$(find_snap "${home_snapshot_label}" "${blacklistdev}" "${whitelistdev}")
1411 if [ -b "${cowprobe}" ]
1413 cowdevice=${cowprobe}
1414 cow_fstype=$(get_fstype "${cowprobe}")
1415 cow_mountopt="rw,noatime"
1417 if [ "${FORCEPERSISTENTFSCK}" = "Yes" ]
1419 fsck -y ${cowdevice}
1422 log_warning_msg "Unable to find the persistent medium"
1425 cow_mountopt="rw,noatime,mode=755"
1427 elif [ -n "${NFS_COW}" ] && [ -z "${NOPERSISTENT}" ]
1429 # check if there are any nfs options
1430 if echo ${NFS_COW}|grep -q ','
1432 nfs_cow_opts="-o nolock,$(echo ${NFS_COW}|cut -d, -f2-)"
1433 nfs_cow=$(echo ${NFS_COW}|cut -d, -f1)
1435 nfs_cow_opts="-o nolock"
1441 cowdevice=$(echo ${nfs_cow}|sed "s/client_mac_address/${mac}/")
1444 panic "unable to determine mac address"
1449 cow_mountopt="rw,noatime,mode=755"
1452 if [ "${UNIONTYPE}" != "unionmount" ]
1455 if [ "${cow_fstype}" = "nfs" ]
1458 "Trying nfsmount ${nfs_cow_opts} ${cowdevice} /cow"
1459 nfsmount ${nfs_cow_opts} ${cowdevice} /cow || \
1460 panic "Can not mount ${cowdevice} (n: ${cow_fstype}) on /cow"
1462 mount -t ${cow_fstype} -o ${cow_mountopt} ${cowdevice} /cow || \
1463 panic "Can not mount ${cowdevice} (o: ${cow_fstype}) on /cow"
1467 rofscount=$(echo ${rofslist} |wc -w)
1469 if [ ${rofscount} -ne 1 ]
1471 panic "only one RO file system supported with exposedroot: ${rofslist}"
1475 if [ -n "${EXPOSED_ROOT}" ]
1477 mount --bind ${rofs} ${rootmnt} || \
1478 panic "bind mount of ${rofs} failed"
1480 if [ -z "${SKIP_UNION_MOUNTS}" ]
1482 cow_dirs='/var/tmp /var/lock /var/run /var/log /var/spool /home /var/lib/live'
1490 if [ "${cow_fstype}" != "tmpfs" ] && [ "${cow_dirs}" != "/" ] && [ "${UNIONTYPE}" = "unionmount" ]
1492 true # FIXME: Maybe it does, I don't really know.
1493 #panic "unionmount does not support subunions (${cow_dirs})."
1499 for dir in ${cow_dirs}; do
1502 unionmountpoint="${rootmnt}${dir}"
1503 unionrw="/cow${dir}"
1504 unionro="${rofs}${dir}"
1505 # We don't handle spaces and other junk gracefully here, hopefully not needed.
1506 case "${UNIONTYPE}" in
1508 unionmountopts="-o cow -o noinitgroups -o default_permissions -o allow_other -o use_ino -o suid"
1509 unionmountopts="${unionmountopts} ${unionrw}=RW:${unionro}=RO"
1510 ( sysctl -w fs.file-max=391524 ; ulimit -HSn 16384
1511 unionfs-fuse ${unionmountopts} "${unionmountpoint}" ) && \
1512 ( mkdir -p /run/sendsigs.omit.d
1513 pidof unionfs-fuse >> /run/sendsigs.omit.d/unionfs-fuse || true )
1517 unionmountopts="-t ${cow_fstype} -o noatime,union,${cow_mountopt} ${cowdevice}"
1518 mount_full $unionmountopts "${unionmountpoint}"
1523 unionmountopts="-o noatime,${noxino_opt}dirs=${unionrw}=rw:${unionro}=${roopt}"
1524 mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}"
1527 panic "mount ${UNIONTYPE} on ${unionmountpoint} failed with option ${unionmountopts}"
1530 # Correct the permissions of /:
1531 chmod 0755 "${rootmnt}"
1533 # tmpfs file systems
1535 mkdir -p "${rootmnt}/live"
1536 mount -t tmpfs tmpfs ${rootmnt}/live
1538 # Adding other custom mounts
1539 if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
1541 # directly mount /home
1542 # FIXME: add a custom mounts configurable system
1544 if [ -b "${homecow}" ]
1546 mount -t $(get_fstype "${homecow}") -o rw,noatime "${homecow}" "${rootmnt}/home"
1547 export HOMEMOUNTED=1 # used to proper calculate free space in do_snap_copy()
1549 log_warning_msg "Unable to find the persistent home medium"
1552 # Look for other snapshots to copy in
1553 try_snap "${root_snapdata}" "${rootmnt}" "ROOT"
1554 # This second type should be removed when snapshot grow smarter
1555 try_snap "${home_snapdata}" "${rootmnt}" "HOME" "/home"
1558 if [ -n "${SHOWMOUNTS}" ]
1560 for d in ${rofslist}
1562 mkdir -p "${rootmnt}/live/${d##*/}"
1566 # do nothing # mount -o bind "${d}" "${rootmnt}/live/${d##*/}"
1570 case "${UNIONTYPE}" in
1572 mount -o bind "${d}" "${rootmnt}/live/${d##*/}"
1576 mount -o move "${d}" "${rootmnt}/live/${d##*/}"
1584 # shows cow fs on /cow for use by live-snapshot
1585 mkdir -p "${rootmnt}/live/cow"
1586 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"
1593 skip_uuid_check="${3}"
1595 # support for fromiso=.../isofrom=....
1596 if [ -n "$FROMISO" ]
1598 ISO_DEVICE=$(dirname $FROMISO)
1599 if ! [ -b $ISO_DEVICE ]
1601 # to support unusual device names like /dev/cciss/c0d0p1
1602 # as well we have to identify the block device name, let's
1603 # do that for up to 15 levels
1605 while [ -n "$ISO_DEVICE" ] && [ "$i" -gt 0 ]
1607 ISO_DEVICE=$(dirname ${ISO_DEVICE})
1608 [ -b "$ISO_DEVICE" ] && break
1613 if [ "$ISO_DEVICE" = "/" ]
1615 echo "Warning: device for bootoption isofrom= ($FROMISO) not found.">>/live-boot.log
1617 fs_type=$(get_fstype "${ISO_DEVICE}")
1618 if is_supported_fs ${fs_type}
1621 mount -t $fs_type "$ISO_DEVICE" /isofrom
1622 ISO_NAME="$(echo $FROMISO | sed "s|$ISO_DEVICE||")"
1623 loopdevname=$(setup_loop "/isofrom/${ISO_NAME}" "loop" "/sys/block/loop*" "" '')
1624 devname="${loopdevname}"
1626 echo "Warning: unable to mount $ISO_DEVICE." >>/live-boot.log
1631 if [ -z "${devname}" ]
1633 devname=$(sys2dev "${sysdev}")
1636 if [ -d "${devname}" ]
1638 mount -o bind "${devname}" $mountpoint || continue
1640 if is_live_path $mountpoint
1650 for device in ${devname}
1654 # Adding lvm support
1655 if [ -x /scripts/local-top/lvm2 ]
1657 ROOT="$device" resume="" /scripts/local-top/lvm2
1662 # Adding raid support
1663 if [ -x /scripts/local-top/mdadm ]
1665 cp /conf/conf.d/md /conf/conf.d/md.orig
1666 echo "MD_DEVS=$device " >> /conf/conf.d/md
1667 /scripts/local-top/mdadm
1668 mv /conf/conf.d/md.orig /conf/conf.d/md
1675 [ -n "$device" ] && devname="$device"
1677 [ -e "$devname" ] || continue
1679 if [ -n "${LIVE_MEDIA_OFFSET}" ]
1681 loopdevname=$(setup_loop "${devname}" "loop" "/sys/block/loop*" "${LIVE_MEDIA_OFFSET}" '')
1682 devname="${loopdevname}"
1685 fstype=$(get_fstype "${devname}")
1687 if is_supported_fs ${fstype}
1689 devuid=$(blkid -o value -s UUID "$devname")
1690 [ -n "$devuid" ] && grep -qs "\<$devuid\>" $tried && continue
1691 mount -t ${fstype} -o ro,noatime "${devname}" ${mountpoint} || continue
1692 [ -n "$devuid" ] && echo "$devuid" >> $tried
1694 if is_live_path ${mountpoint} && \
1695 ([ "${skip_uuid_check}" ] || matches_uuid ${mountpoint})
1700 umount ${mountpoint} 2>/dev/null
1704 if [ -n "${LIVE_MEDIA_OFFSET}" ]
1706 losetup -d "${loopdevname}"
1716 # don't start autodetection before timeout has expired
1717 if [ -n "${LIVE_MEDIA_TIMEOUT}" ]
1719 if [ "${timeout}" -lt "${LIVE_MEDIA_TIMEOUT}" ]
1725 # first look at the one specified in the command line
1726 case "${LIVE_MEDIA}" in
1728 for sysblock in $(removable_usb_dev "sys")
1730 for dev in $(subdevices "${sysblock}")
1732 if check_dev "${dev}"
1742 for sysblock in $(removable_dev "sys")
1744 for dev in $(subdevices "${sysblock}")
1746 if check_dev "${dev}"
1756 if [ ! -z "${LIVE_MEDIA}" ]
1758 if check_dev "null" "${LIVE_MEDIA}" "skip_uuid_check"
1766 # or do the scan of block devices
1767 # prefer removable devices over non-removable devices, so scan them first
1768 devices_to_scan="$(removable_dev 'sys') $(non_removable_dev 'sys')"
1770 for sysblock in $devices_to_scan
1772 devname=$(sys2dev "${sysblock}")
1773 [ -e "$devname" ] || continue
1774 fstype=$(get_fstype "${devname}")
1776 if /lib/udev/cdrom_id ${devname} > /dev/null
1778 if check_dev "null" "${devname}"
1782 elif is_nice_device "${sysblock}"
1784 for dev in $(subdevices "${sysblock}")
1786 if check_dev "${dev}"
1791 elif [ "${fstype}" = "squashfs" -o \
1792 "${fstype}" = "btrfs" -o \
1793 "${fstype}" = "ext2" -o \
1794 "${fstype}" = "ext3" -o \
1795 "${fstype}" = "ext4" -o \
1796 "${fstype}" = "jffs2" ]
1798 # This is an ugly hack situation, the block device has
1799 # an image directly on it. It's hopefully
1800 # live-boot, so take it and run with it.
1801 ln -s "${devname}" "${devname}.${fstype}"
1802 echo "${devname}.${fstype}"
1812 media_mountpoint="${1}"
1814 log_begin_msg "Checking media integrity"
1816 cd ${media_mountpoint}
1817 /bin/md5sum -c md5sum.txt < /dev/tty8 > /dev/tty8
1822 if [ "${RC}" -eq 0 ]
1824 log_success_msg "Everything ok, will reboot in 10 seconds."
1827 umount ${media_mountpoint}
1829 echo u > /proc/sysrq-trigger
1830 echo b > /proc/sysrq-trigger
1832 panic "Not ok, a media defect is likely, switch to VT8 for details."
1838 if [ -x /scripts/local-top/cryptroot ]; then
1839 /scripts/local-top/cryptroot
1844 exec > live-boot.log
1846 tail -f live-boot.log >&7 &
1849 # Ensure 'panic' function is overridden
1850 . /scripts/live-functions
1854 maybe_break live-premount
1855 log_begin_msg "Running /scripts/live-premount"
1856 run_scripts /scripts/live-premount
1859 # Needed here too because some things (*cough* udev *cough*)
1860 # changes the timeout
1862 if [ ! -z "${NETBOOT}" ] || [ ! -z "${FETCH}" ] || [ ! -z "${HTTPFS}" ] || [ ! -z "${FTPFS}" ]
1866 livefs_root="${mountpoint}"
1868 panic "Unable to find a live file system on the network"
1871 if [ -n "${ISCSI_PORTAL}" ]
1873 do_iscsi && livefs_root="${mountpoint}"
1874 elif [ -n "${PLAIN_ROOT}" ] && [ -n "${ROOT}" ]
1876 # Do a local boot from hd
1879 if [ -x /usr/bin/memdiskfind ]
1881 MEMDISK=$(/usr/bin/memdiskfind)
1885 # We found a memdisk, set up phram
1886 modprobe phram phram=memdisk,${MEMDISK}
1888 # Load mtdblock, the memdisk will be /dev/mtdblock0
1893 # Scan local devices for the image
1895 while [ "$i" -lt 60 ]
1897 livefs_root=$(find_livefs ${i})
1899 if [ -n "${livefs_root}" ]
1910 if [ -z "${livefs_root}" ]
1912 panic "Unable to find a medium containing a live file system"
1915 if [ "${INTEGRITY_CHECK}" ]
1917 integrity_check "${livefs_root}"
1923 elif [ "${TODISK}" ]
1925 live_dest="${TODISK}"
1928 if [ "${live_dest}" ]
1930 log_begin_msg "Copying live media to ${live_dest}"
1931 copy_live_to "${livefs_root}" "${live_dest}"
1935 # if we do not unmount the ISO we can't run "fsck /dev/ice" later on
1936 # because the mountpoint is left behind in /proc/mounts, so let's get
1937 # rid of it when running from RAM
1938 if [ -n "$FROMISO" ] && [ "${TORAM}" ]
1940 losetup -d /dev/loop0
1941 grep -q /isofrom /proc/mounts && umount /isofrom
1944 if [ -n "${MODULETORAMFILE}" ] || [ -n "${PLAIN_ROOT}" ]
1946 setup_unionfs "${livefs_root}" "${rootmnt}"
1949 mac="$(echo ${mac} | sed 's/-//g')"
1950 mount_images_in_directory "${livefs_root}" "${rootmnt}" "${mac}"
1954 if [ -n "${ROOT_PID}" ] ; then
1955 echo "${ROOT_PID}" > "${rootmnt}"/live/root.pid
1960 # unionfs-fuse needs /dev to be bind-mounted for the duration of
1961 # live-bottom; udev's init script will take care of things after that
1962 if [ "${UNIONTYPE}" = unionfs-fuse ]
1964 mount -n -o bind /dev "${rootmnt}/dev"
1967 # Move to the new root filesystem so that programs there can get at it.
1968 if [ ! -d /root/live/image ]
1970 mkdir -p /root/live/image
1971 mount --move /live/image /root/live/image
1974 # aufs2 in kernel versions around 2.6.33 has a regression:
1975 # directories can't be accessed when read for the first the time,
1976 # causing a failure for example when accessing /var/lib/fai
1977 # when booting FAI, this simple workaround solves it
1978 ls /root/* >/dev/null 2>&1
1980 # copy snapshot configuration if exists
1981 if [ -f snapshot.conf ]
1983 log_begin_msg "Copying snapshot.conf to ${rootmnt}/etc/live/boot.d"
1984 if [ ! -d "${rootmnt}/etc/live/boot.d" ]
1986 mkdir -p "${rootmnt}/etc/live/boot.d"
1988 cp snapshot.conf "${rootmnt}/etc/live/boot.d/"
1992 if [ -f /etc/resolv.conf ] && [ ! -s ${rootmnt}/etc/resolv.conf ]
1994 log_begin_msg "Copying /etc/resolv.conf to ${rootmnt}/etc/resolv.conf"
1995 cp -v /etc/resolv.conf ${rootmnt}/etc/resolv.conf
1999 maybe_break live-bottom
2000 log_begin_msg "Running /scripts/live-bottom\n"
2002 run_scripts /scripts/live-bottom
2005 if [ "${UNIONFS}" = unionfs-fuse ]
2007 umount "${rootmnt}/dev"
2013 [ -w "${rootmnt}/var/log/" ] && cp live-boot.log "${rootmnt}/var/log/" 2>/dev/null