7 if [ -x /scripts/local-top/cryptroot ]
9 /scripts/local-top/cryptroot
16 tail -f boot.log >&7 &
19 LIVE_BOOT_CMDLINE="${LIVE_BOOT_CMDLINE:-$(cat /proc/cmdline)}"
28 if [ -e /conf/param.conf ]
33 # Needed here too because some things (*cough* udev *cough*)
36 if [ ! -z "${NETBOOT}" ] || [ ! -z "${FETCH}" ] || [ ! -z "${HTTPFS}" ] || [ ! -z "${FTPFS}" ]
40 livefs_root="${mountpoint}"
42 panic "Unable to find a live file system on the network"
45 if [ -n "${ISCSI_PORTAL}" ]
47 do_iscsi && livefs_root="${mountpoint}"
48 elif [ -n "${PLAIN_ROOT}" ] && [ -n "${ROOT}" ]
50 # Do a local boot from hd
53 if [ -x /usr/bin/memdiskfind ]
55 MEMDISK=$(/usr/bin/memdiskfind)
59 # We found a memdisk, set up phram
60 modprobe phram phram=memdisk,${MEMDISK}
61 modprobe phram phram=memdisk,${MEMDISK}
63 # Load mtdblock, the memdisk will be /dev/mtdblock0
68 # Scan local devices for the image
72 livefs_root=$(find_livefs ${i})
74 if [ -n "${livefs_root}" ]
85 if [ -z "${livefs_root}" ]
87 panic "Unable to find a medium containing a live file system"
90 Verify_checksums "${livefs_root}"
100 if [ "${live_dest}" ]
102 log_begin_msg "Copying live media to ${live_dest}"
103 copy_live_to "${livefs_root}" "${live_dest}"
107 # if we do not unmount the ISO we can't run "fsck /dev/ice" later on
108 # because the mountpoint is left behind in /proc/mounts, so let's get
109 # rid of it when running from RAM
110 if [ -n "$FROMISO" ] && [ "${TORAM}" ]
112 losetup -d /dev/loop0
114 if is_mountpoint /live/fromiso
117 rmdir --ignore-fail-on-non-empty /live/fromiso \
118 >/dev/null 2>&1 || true
122 if [ -n "${MODULETORAMFILE}" ] || [ -n "${PLAIN_ROOT}" ]
124 setup_unionfs "${livefs_root}" "${rootmnt}"
127 mac="$(echo ${mac} | sed 's/-//g')"
128 mount_images_in_directory "${livefs_root}" "${rootmnt}" "${mac}"
131 # At this point /root should contain the final root filesystem.
132 # Move all mountpoints below /live into /root/lib/live/mount.
133 # This has to be done after mounting the root filesystem to /
134 # otherwise these mount points won't be accessible from the running system.
135 for _MOUNT in $(cat /proc/mounts | cut -f 2 -d " " | grep -e "^/live/")
138 newmount="${rootmnt}/lib/live/mount/${_MOUNT#/live/}"
139 mkdir -p "${newmount}"
140 mount -o move "${_MOUNT}" "${newmount}" > /dev/null 2>&1 || \
141 mount -o bind "${_MOUNT}" "${newmount}" > /dev/null || \
142 log_warning_msg "W: failed to move or bindmount ${_MOUNT} to ${newmount}"
145 if [ -n "${ROOT_PID}" ]
147 echo "${ROOT_PID}" > "${rootmnt}"/lib/live/root.pid
152 # aufs2 in kernel versions around 2.6.33 has a regression:
153 # directories can't be accessed when read for the first the time,
154 # causing a failure for example when accessing /var/lib/fai
155 # when booting FAI, this simple workaround solves it
156 ls /root/* >/dev/null 2>&1
158 # if we do not unmount the ISO we can't run "fsck /dev/ice" later on
159 # because the mountpoint is left behind in /proc/mounts, so let's get
160 # rid of it when running from RAM
161 if [ -n "$FINDISO" ] && [ "${TORAM}" ]
163 losetup -d /dev/loop0
165 if is_mountpoint /root/lib/live/mount/findiso
167 umount /root/lib/live/mount/findiso
168 rmdir --ignore-fail-on-non-empty /root/lib/live/mount/findiso \
169 >/dev/null 2>&1 || true
173 if [ -L /root/etc/resolv.conf ] ; then
174 # assume we have resolvconf
175 DNSFILE="${rootmnt}/etc/resolvconf/resolv.conf.d/base"
177 DNSFILE="${rootmnt}/etc/resolv.conf"
179 if [ -f /etc/resolv.conf ] && [ ! -s ${DNSFILE} ]
181 log_begin_msg "Copying /etc/resolv.conf to ${DNSFILE}"
182 cp -v /etc/resolv.conf ${DNSFILE}
186 if ! [ -d "/lib/live/boot" ]
188 panic "A wrong rootfs was mounted."
199 [ -w "${rootmnt}/var/log/" ] && mkdir -p "${rootmnt}/var/log/live" && cp boot.log "${rootmnt}/var/log/live" 2>/dev/null