7 if [ -x /scripts/local-top/cryptroot ]
9 /scripts/local-top/cryptroot
16 tail -f boot.log >&7 &
21 _CMDLINE="$(cat /proc/cmdline)"
30 if [ -e /conf/param.conf ]
35 # Needed here too because some things (*cough* udev *cough*)
38 if [ ! -z "${NETBOOT}" ] || [ ! -z "${FETCH}" ] || [ ! -z "${HTTPFS}" ] || [ ! -z "${FTPFS}" ]
42 livefs_root="${mountpoint}"
44 panic "Unable to find a live file system on the network"
47 if [ -n "${ISCSI_PORTAL}" ]
49 do_iscsi && livefs_root="${mountpoint}"
50 elif [ -n "${PLAIN_ROOT}" ] && [ -n "${ROOT}" ]
52 # Do a local boot from hd
55 if [ -x /usr/bin/memdiskfind ]
57 MEMDISK=$(/usr/bin/memdiskfind)
61 # We found a memdisk, set up phram
62 modprobe phram phram=memdisk,${MEMDISK}
64 # Load mtdblock, the memdisk will be /dev/mtdblock0
69 # Scan local devices for the image
73 livefs_root=$(find_livefs ${i})
75 if [ -n "${livefs_root}" ]
86 if [ -z "${livefs_root}" ]
88 panic "Unable to find a medium containing a live file system"
91 Verify_checksums "${livefs_root}"
101 if [ "${live_dest}" ]
103 log_begin_msg "Copying live media to ${live_dest}"
104 copy_live_to "${livefs_root}" "${live_dest}"
108 # if we do not unmount the ISO we can't run "fsck /dev/ice" later on
109 # because the mountpoint is left behind in /proc/mounts, so let's get
110 # rid of it when running from RAM
111 if [ -n "$FROMISO" ] && [ "${TORAM}" ]
113 losetup -d /dev/loop0
115 if is_mountpoint /live/fromiso
118 rmdir --ignore-fail-on-non-empty /live/fromiso \
119 >/dev/null 2>&1 || true
123 if [ -n "${MODULETORAMFILE}" ] || [ -n "${PLAIN_ROOT}" ]
125 setup_unionfs "${livefs_root}" "${rootmnt}"
128 mac="$(echo ${mac} | sed 's/-//g')"
129 mount_images_in_directory "${livefs_root}" "${rootmnt}" "${mac}"
133 if [ -n "${ROOT_PID}" ]
135 echo "${ROOT_PID}" > "${rootmnt}"/lib/live/root.pid
140 # unionfs-fuse needs /dev to be bind-mounted for the duration of
141 # live-bottom; udev's init script will take care of things after that
142 case "${UNIONTYPE}" in
144 mount -n -o bind /dev "${rootmnt}/dev"
148 # Move to the new root filesystem so that programs there can get at it.
149 mkdir -p /root/lib/live/mount/medium
150 mount --move /live/medium /root/lib/live/mount/medium
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 # Move findiso directory to the new root filesystem so that programs there can get at it.
159 if [ -d /live/findiso ]
161 mkdir -p /root/lib/live/mount/findiso
162 mount -n --move /live/findiso /root/lib/live/mount/findiso
165 # if we do not unmount the ISO we can't run "fsck /dev/ice" later on
166 # because the mountpoint is left behind in /proc/mounts, so let's get
167 # rid of it when running from RAM
168 if [ -n "$FINDISO" ] && [ "${TORAM}" ]
170 losetup -d /dev/loop0
172 if is_mountpoint /root/lib/live/mount/findiso
174 umount /root/lib/live/mount/findiso
175 rmdir --ignore-fail-on-non-empty /root/lib/live/mount/findiso \
176 >/dev/null 2>&1 || true
180 if [ -f /etc/resolv.conf ] && [ ! -s ${rootmnt}/etc/resolv.conf ]
182 log_begin_msg "Copying /etc/resolv.conf to ${rootmnt}/etc/resolv.conf"
183 cp -v /etc/resolv.conf ${rootmnt}/etc/resolv.conf
187 if ! [ -d "/lib/live/boot" ]
189 panic "A wrong rootfs was mounted."
199 umount "${rootmnt}/dev"
206 [ -w "${rootmnt}/var/log/" ] && mkdir -p "${rootmnt}/var/log/live" && cp boot.log "${rootmnt}/var/log/live" 2>/dev/null