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 if ! MEMDISK=$(/usr/bin/memdiskfind)
57 # We found a memdisk, set up phram
58 # Sometimes "modprobe phram" can not successfully create /dev/mtd0.
59 # Have to try several times.
61 while [ ! -c /dev/mtd0 ] && [ "$max_try" -gt 0 ]; do
62 modprobe phram "phram=memdisk,${MEMDISK}"
64 if [ -c /dev/mtd0 ]; then
69 max_try=$((max_try - 1))
72 # Load mtdblock, the memdisk will be /dev/mtdblock0
77 # Scan local devices for the image
81 livefs_root=$(find_livefs ${i})
83 if [ -n "${livefs_root}" ]
94 if [ -z "${livefs_root}" ]
96 panic "Unable to find a medium containing a live file system"
99 Verify_checksums "${livefs_root}"
106 live_dest="${TODISK}"
109 if [ "${live_dest}" ]
111 log_begin_msg "Copying live media to ${live_dest}"
112 copy_live_to "${livefs_root}" "${live_dest}"
116 # if we do not unmount the ISO we can't run "fsck /dev/ice" later on
117 # because the mountpoint is left behind in /proc/mounts, so let's get
118 # rid of it when running from RAM
119 if [ -n "$FROMISO" ] && [ "${TORAM}" ]
121 losetup -d /dev/loop0
123 if is_mountpoint /run/live/fromiso
125 umount /run/live/fromiso
126 rmdir --ignore-fail-on-non-empty /run/live/fromiso \
127 >/dev/null 2>&1 || true
131 if [ -n "${MODULETORAMFILE}" ] || [ -n "${PLAIN_ROOT}" ]
133 setup_unionfs "${livefs_root}" "${rootmnt?}"
136 mac="$(echo "${mac}" | sed 's/-//g')"
137 mount_images_in_directory "${livefs_root}" "${rootmnt}" "${mac}"
140 if [ -n "${ROOT_PID}" ]
142 echo "${ROOT_PID}" > "${rootmnt}"/lib/live/root.pid
147 # aufs2 in kernel versions around 2.6.33 has a regression:
148 # directories can't be accessed when read for the first the time,
149 # causing a failure for example when accessing /var/lib/fai
150 # when booting FAI, this simple workaround solves it
151 ls /root/* >/dev/null 2>&1
153 # if we do not unmount the ISO we can't run "fsck /dev/ice" later on
154 # because the mountpoint is left behind in /proc/mounts, so let's get
155 # rid of it when running from RAM
156 if [ -n "$FINDISO" ] && [ "${TORAM}" ]
158 losetup -d /dev/loop0
160 if is_mountpoint /run/live/findiso
162 umount /run/live/findiso
163 rmdir --ignore-fail-on-non-empty /run/live/findiso \
164 >/dev/null 2>&1 || true
168 if [ -L /root/etc/resolv.conf ] ; then
169 # assume we have resolvconf
170 DNSFILE="${rootmnt}/etc/resolvconf/resolv.conf.d/base"
172 DNSFILE="${rootmnt}/etc/resolv.conf"
174 if [ -f /etc/resolv.conf ] && ! grep -E -q -v '^[[:space:]]*(#|$)' "${DNSFILE}"
176 log_begin_msg "Copying /etc/resolv.conf to ${DNSFILE}"
177 cp -v /etc/resolv.conf "${DNSFILE}"
181 if ! [ -d "/lib/live/boot" ]
183 panic "A wrong rootfs was mounted."
186 # avoid breaking existing user scripts that rely on the old path
187 # this includes code that checks what is mounted on /lib/live/mount/*
188 # (eg: grep /lib/live /proc/mount)
189 # XXX: to be removed before the bullseye release
190 mkdir -p "${rootmnt}/lib/live/mount"
191 mount --rbind /run/live "${rootmnt}/lib/live/mount"
201 [ -w "${rootmnt}/var/log/" ] && mkdir -p "${rootmnt}/var/log/live" && ( \
202 cp boot.log "${rootmnt}/var/log/live" 2>/dev/null; \
203 cp fsck.log "${rootmnt}/var/log/live" 2>/dev/null )