7 if [ -x /scripts/local-top/cryptroot ]; then
8 /scripts/local-top/cryptroot
15 tail -f boot.log >&7 &
20 _CMDLINE="$(cat /proc/cmdline)"
23 case "${LIVE_DEBUG}" in
29 case "${LIVE_READ_ONLY}" in
37 # Needed here too because some things (*cough* udev *cough*)
40 if [ ! -z "${NETBOOT}" ] || [ ! -z "${FETCH}" ] || [ ! -z "${HTTPFS}" ] || [ ! -z "${FTPFS}" ]
44 livefs_root="${mountpoint}"
46 panic "Unable to find a live file system on the network"
49 if [ -n "${ISCSI_PORTAL}" ]
51 do_iscsi && livefs_root="${mountpoint}"
52 elif [ -n "${PLAIN_ROOT}" ] && [ -n "${ROOT}" ]
54 # Do a local boot from hd
57 if [ -x /usr/bin/memdiskfind ]
59 MEMDISK=$(/usr/bin/memdiskfind)
63 # We found a memdisk, set up phram
64 modprobe phram phram=memdisk,${MEMDISK}
66 # Load mtdblock, the memdisk will be /dev/mtdblock0
71 # Scan local devices for the image
75 livefs_root=$(find_livefs ${i})
77 if [ -n "${livefs_root}" ]
88 if [ -z "${livefs_root}" ]
90 panic "Unable to find a medium containing a live file system"
93 case "${LIVE_VERIFY_CHECKSUMS}" in
95 Verify_checksums "${livefs_root}"
104 live_dest="${TODISK}"
107 if [ "${live_dest}" ]
109 log_begin_msg "Copying live media to ${live_dest}"
110 copy_live_to "${livefs_root}" "${live_dest}"
114 # if we do not unmount the ISO we can't run "fsck /dev/ice" later on
115 # because the mountpoint is left behind in /proc/mounts, so let's get
116 # rid of it when running from RAM
117 if [ -n "$FROMISO" ] && [ "${TORAM}" ]
119 losetup -d /dev/loop0
121 if is_mountpoint /live/fromiso
124 rmdir --ignore-fail-on-non-empty /live/fromiso \
125 >/dev/null 2>&1 || true
129 if [ -n "${MODULETORAMFILE}" ] || [ -n "${PLAIN_ROOT}" ]
131 setup_unionfs "${livefs_root}" "${rootmnt}"
134 mac="$(echo ${mac} | sed 's/-//g')"
135 mount_images_in_directory "${livefs_root}" "${rootmnt}" "${mac}"
139 if [ -n "${ROOT_PID}" ] ; then
140 echo "${ROOT_PID}" > "${rootmnt}"/live/root.pid
145 # unionfs-fuse needs /dev to be bind-mounted for the duration of
146 # live-bottom; udev's init script will take care of things after that
147 if [ "${UNIONTYPE}" = unionfs-fuse ]
149 mount -n -o bind /dev "${rootmnt}/dev"
152 # Move to the new root filesystem so that programs there can get at it.
153 if [ ! -d /root/live/image ]
155 mkdir -p /root/live/image
156 mount --move /live/image /root/live/image
159 # aufs2 in kernel versions around 2.6.33 has a regression:
160 # directories can't be accessed when read for the first the time,
161 # causing a failure for example when accessing /var/lib/fai
162 # when booting FAI, this simple workaround solves it
163 ls /root/* >/dev/null 2>&1
165 # Move findiso directory to the new root filesystem so that programs there can get at it.
166 if [ -d /live/findiso ] && [ ! -d /root/live/findiso ]
168 mkdir -p /root/live/findiso
169 mount -n --move /live/findiso /root/live/findiso
172 # if we do not unmount the ISO we can't run "fsck /dev/ice" later on
173 # because the mountpoint is left behind in /proc/mounts, so let's get
174 # rid of it when running from RAM
175 if [ -n "$FINDISO" ] && [ "${TORAM}" ]
177 losetup -d /dev/loop0
179 if is_mountpoint /root/live/findiso
181 umount /root/live/findiso
182 rmdir --ignore-fail-on-non-empty /root/live/findiso \
183 >/dev/null 2>&1 || true
187 # copy snapshot configuration if exists
188 if [ -f snapshot.conf ]
190 log_begin_msg "Copying snapshot.conf to ${rootmnt}/etc/live/boot.d"
191 if [ ! -d "${rootmnt}/etc/live/boot.d" ]
193 mkdir -p "${rootmnt}/etc/live/boot.d"
195 cp snapshot.conf "${rootmnt}/etc/live/boot.d/"
199 if [ -f /etc/resolv.conf ] && [ ! -s ${rootmnt}/etc/resolv.conf ]
201 log_begin_msg "Copying /etc/resolv.conf to ${rootmnt}/etc/resolv.conf"
202 cp -v /etc/resolv.conf ${rootmnt}/etc/resolv.conf
206 if ! [ -d "/lib/live/boot" ]
208 panic "A wrong rootfs was mounted."
215 case "${LIVE_SWAPON}" in
221 if [ "${UNIONFS}" = unionfs-fuse ]
223 umount "${rootmnt}/dev"
229 [ -w "${rootmnt}/var/log/" ] && mkdir -p /var/log/live && cp boot.log "${rootmnt}/var/log/live" 2>/dev/null