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 [ -n "${NETBOOT}" ] || [ -n "${FETCH}" ] || [ -n "${HTTPFS}" ] || [ -n "${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 ! dd if=/dev/mem of=/dev/zero bs=1 count=1 >/dev/null 2>&1
57 log_begin_msg "access to /dev/mem is restriced, skipping memdiskfind"
60 if MEMDISK=$(/usr/bin/memdiskfind)
62 # We found a memdisk, set up phram
63 # Sometimes "modprobe phram" can not successfully create /dev/mtd0.
64 # Have to try several times.
66 while [ ! -c /dev/mtd0 ] && [ "$max_try" -gt 0 ]; do
67 modprobe phram "phram=memdisk,${MEMDISK}"
69 if [ -c /dev/mtd0 ]; then
74 max_try=$((max_try - 1))
77 # Load mtdblock, the memdisk will be /dev/mtdblock0
83 # Scan local devices for the image
87 livefs_root=$(find_livefs ${i})
89 if [ -n "${livefs_root}" ]
100 if [ -z "${livefs_root}" ]
102 panic "Unable to find a medium containing a live file system"
105 Verify_checksums "${livefs_root}"
112 live_dest="${TODISK}"
115 if [ "${live_dest}" ]
117 log_begin_msg "Copying live media to ${live_dest}"
118 copy_live_to "${livefs_root}" "${live_dest}"
122 # if we do not unmount the ISO we can't run "fsck /dev/ice" later on
123 # because the mountpoint is left behind in /proc/mounts, so let's get
124 # rid of it when running from RAM
125 if [ -n "$FROMISO" ] && [ "${TORAM}" ]
127 losetup -d /dev/loop0
129 if is_mountpoint /run/live/fromiso
131 umount /run/live/fromiso
132 rmdir --ignore-fail-on-non-empty /run/live/fromiso \
133 >/dev/null 2>&1 || true
137 if [ -n "${MODULETORAMFILE}" ] || [ -n "${PLAIN_ROOT}" ]
139 setup_unionfs "${livefs_root}" "${rootmnt?}"
142 mac="$(echo "${mac}" | sed 's/-//g')"
143 mount_images_in_directory "${livefs_root}" "${rootmnt}" "${mac}"
146 if [ -n "${ROOT_PID}" ]
148 echo "${ROOT_PID}" > "${rootmnt}"/lib/live/root.pid
153 # aufs2 in kernel versions around 2.6.33 has a regression:
154 # directories can't be accessed when read for the first the time,
155 # causing a failure for example when accessing /var/lib/fai
156 # when booting FAI, this simple workaround solves it
157 ls /root/* >/dev/null 2>&1
159 # if we do not unmount the ISO we can't run "fsck /dev/ice" later on
160 # because the mountpoint is left behind in /proc/mounts, so let's get
161 # rid of it when running from RAM
162 if [ -n "$FINDISO" ] && [ "${TORAM}" ]
164 losetup -d /dev/loop0
166 if is_mountpoint /run/live/findiso
168 umount /run/live/findiso
169 rmdir --ignore-fail-on-non-empty /run/live/findiso \
170 >/dev/null 2>&1 || true
174 if [ -f /etc/hostname ] && ! grep -E -q -v '^[[:space:]]*(#|$)' "${rootmnt}/etc/hostname"
176 log_begin_msg "Copying /etc/hostname to ${rootmnt}/etc/hostname"
177 cp -v /etc/hostname "${rootmnt}/etc/hostname"
181 if [ -f /etc/hosts ] && ! grep -E -q -v '^[[:space:]]*(#|$|(127.0.0.1|::1|ff02::[12])[[:space:]])' "${rootmnt}/etc/hosts"
183 log_begin_msg "Copying /etc/hosts to ${rootmnt}/etc/hosts"
184 cp -v /etc/hosts "${rootmnt}/etc/hosts"
188 if [ -L /root/etc/resolv.conf ] ; then
189 # assume we have resolvconf
190 DNSFILE="${rootmnt}/etc/resolvconf/resolv.conf.d/base"
192 DNSFILE="${rootmnt}/etc/resolv.conf"
194 if [ -f /etc/resolv.conf ] && ! grep -E -q -v '^[[:space:]]*(#|$)' "${DNSFILE}"
196 log_begin_msg "Copying /etc/resolv.conf to ${DNSFILE}"
197 cp -v /etc/resolv.conf "${DNSFILE}"
201 if ! [ -d "/lib/live/boot" ]
203 panic "A wrong rootfs was mounted."
206 # avoid breaking existing user scripts that rely on the old path
207 # this includes code that checks what is mounted on /lib/live/mount/*
208 # (eg: grep /lib/live /proc/mount)
209 # XXX: to be removed before the bullseye release
210 mkdir -p "${rootmnt}/lib/live/mount"
211 mount --rbind /run/live "${rootmnt}/lib/live/mount"
217 if grep -q debian_networking /proc/cmdline ; then
226 [ -w "${rootmnt}/var/log/" ] && mkdir -p "${rootmnt}/var/log/live" && ( \
227 cp boot.log "${rootmnt}/var/log/live" 2>/dev/null; \
228 cp fsck.log "${rootmnt}/var/log/live" 2>/dev/null )