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 if [ -n "${FUSE_MOUNT}" ]
37 # fuse does not work with klibc mount
38 ln -f /bin
/mount.util-linux
/bin
/mount
41 # Needed here too because some things (*cough* udev *cough*)
44 if [ ! -z "${NETBOOT}" ] || [ ! -z "${FETCH}" ] || [ ! -z "${HTTPFS}" ] || [ ! -z "${FTPFS}" ]
48 livefs_root
="${mountpoint}"
50 panic
"Unable to find a live file system on the network"
53 if [ -n "${ISCSI_PORTAL}" ]
55 do_iscsi
&& livefs_root
="${mountpoint}"
56 elif [ -n "${PLAIN_ROOT}" ] && [ -n "${ROOT}" ]
58 # Do a local boot from hd
61 if [ -x /usr
/bin
/memdiskfind
]
63 MEMDISK
=$
(/usr
/bin
/memdiskfind
)
67 # We found a memdisk, set up phram
68 modprobe phram phram
=memdisk
,${MEMDISK}
70 # Load mtdblock, the memdisk will be /dev/mtdblock0
75 # Scan local devices for the image
79 livefs_root
=$
(find_livefs
${i})
81 if [ -n "${livefs_root}" ]
92 if [ -z "${livefs_root}" ]
94 panic
"Unable to find a medium containing a live file system"
97 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}"
138 # At this point /root should contain the final root filesystem.
139 # Move all mountpoints below /live into /root/lib/live/mount.
140 # This has to be done after mounting the root filesystem to /
141 # otherwise these mount points won't be accessible from the running system.
142 for _MOUNT
in $
(cat /proc
/mounts | cut
-f 2 -d " " |
grep -e "^/live/")
145 newmount
="${rootmnt}/lib/live/mount/${_MOUNT#/live/}"
146 mkdir
-p "${newmount}"
147 mount
-o move
"${_MOUNT}" "${newmount}" > /dev
/null
2>&1 || \
148 mount
-o bind "${_MOUNT}" "${newmount}" > /dev
/null || \
149 log_warning_msg
"W: failed to move or bindmount ${_MOUNT} to ${newmount}"
152 if [ -n "${ROOT_PID}" ]
154 echo "${ROOT_PID}" > "${rootmnt}"/lib
/live
/root.pid
159 # unionfs-fuse needs /dev to be bind-mounted for the duration of
160 # live-bottom; udev's init script will take care of things after that
161 case "${UNIONTYPE}" in
163 mount
-n -o bind /dev
"${rootmnt}/dev"
168 # aufs2 in kernel versions around 2.6.33 has a regression:
169 # directories can't be accessed when read for the first the time,
170 # causing a failure for example when accessing /var/lib/fai
171 # when booting FAI, this simple workaround solves it
172 ls /root
/* >/dev
/null
2>&1
174 # if we do not unmount the ISO we can't run "fsck /dev/ice" later on
175 # because the mountpoint is left behind in /proc/mounts, so let's get
176 # rid of it when running from RAM
177 if [ -n "$FINDISO" ] && [ "${TORAM}" ]
179 losetup
-d /dev
/loop0
181 if is_mountpoint
/root
/lib
/live
/mount
/findiso
183 umount
/root
/lib
/live
/mount
/findiso
184 rmdir --ignore-fail-on-non-empty /root
/lib
/live
/mount
/findiso \
185 >/dev
/null
2>&1 || true
189 if [ -f /etc
/resolv.conf
] && [ ! -s ${rootmnt}/etc
/resolv.conf
]
191 log_begin_msg
"Copying /etc/resolv.conf to ${rootmnt}/etc/resolv.conf"
192 cp -v /etc
/resolv.conf
${rootmnt}/etc
/resolv.conf
196 if ! [ -d "/lib/live/boot" ]
198 panic
"A wrong rootfs was mounted."
208 umount
"${rootmnt}/dev"
215 [ -w "${rootmnt}/var/log/" ] && mkdir -p "${rootmnt}/var/log/live" && cp boot.log "${rootmnt}/var/log/live" 2>/dev
/null