181 |
{ |
{ |
182 |
install -d ${CDISOROOT}/netboot |
install -d ${CDISOROOT}/netboot |
183 |
install -d ${LIVECDROOT}/netboot-chroot |
install -d ${LIVECDROOT}/netboot-chroot |
184 |
install -d ${LIVECDROOT}/network-squashfs-temp |
install -d ${LIVECDROOT}/netboot-squashfs |
185 |
|
|
186 |
# use all settings from the global config, but use netbootsysten as basesystem |
# use all settings from the global config, but use netbootsysten as basesystem |
187 |
mage-bootstrap \ |
mage-bootstrap \ |
196 |
prepare_custom_baseconfig "${LIVECDROOT}/netboot-chroot" "alx-${CDOSARCH}" "magellan-linux.de" |
prepare_custom_baseconfig "${LIVECDROOT}/netboot-chroot" "alx-${CDOSARCH}" "magellan-linux.de" |
197 |
|
|
198 |
# creating netboot image from here on |
# creating netboot image from here on |
199 |
install -d ${LIVECDROOT}/network-squashfs-temp/{LiveOS,mnt} || die |
install -d ${LIVECDROOT}/netboot-squashfs/{LiveOS,mnt} || die |
200 |
|
|
201 |
# fix fstab, use the livecd fstab without rootfs and swap |
# fix fstab, use the livecd fstab without rootfs and swap |
202 |
install -m 0644 $(get_profile fstab) ${LIVECDROOT}/netboot-chroot/etc/fstab || die |
install -m 0644 $(get_profile fstab) ${LIVECDROOT}/netboot-chroot/etc/fstab || die |
205 |
size=$(du -s ${LIVECDROOT}/netboot-chroot | sed 's:^\(.*\)[[:space:]].*:\1:') |
size=$(du -s ${LIVECDROOT}/netboot-chroot | sed 's:^\(.*\)[[:space:]].*:\1:') |
206 |
|
|
207 |
# generate a ext3fs file for devicemapper |
# generate a ext3fs file for devicemapper |
208 |
dd if=/dev/zero of=${LIVECDROOT}/network-squashfs-temp/LiveOS/ext3fs.img bs=1024 count=$(( ${size} + 20000 )) || die |
dd if=/dev/zero of=${LIVECDROOT}/netboot-squashfs/LiveOS/ext3fs.img bs=1024 count=$(( ${size} + 20000 )) || die |
209 |
# create a filesystem |
# create a filesystem |
210 |
mkfs.ext3 -L "_${CDID}_EXT3" -m 1 -b 1024 -F ${LIVECDROOT}/network-squashfs-temp/LiveOS/ext3fs.img || die |
mkfs.ext3 -L "_${CDID}_EXT3" -m 1 -b 1024 -F ${LIVECDROOT}/netboot-squashfs/LiveOS/ext3fs.img || die |
211 |
# set mount_counts and check_intervals to 0 |
# set mount_counts and check_intervals to 0 |
212 |
# set dir_index top, to speed up things with hashed b-trees |
# set dir_index top, to speed up things with hashed b-trees |
213 |
# allow acls too |
# allow acls too |
214 |
tune2fs -c0 -i0 -Odir_index -ouser_xattr,acl ${LIVECDROOT}/network-squashfs-temp/LiveOS/ext3fs.img || die |
tune2fs -c0 -i0 -Odir_index -ouser_xattr,acl ${LIVECDROOT}/netboot-squashfs/LiveOS/ext3fs.img || die |
215 |
# strip the journal |
# strip the journal |
216 |
# tune2fs -O^has_journal ${LIVECDROOT}/network-squashfs-temp/LiveOS/ext3fs.img || die |
# tune2fs -O^has_journal ${LIVECDROOT}/netboot-squashfs/LiveOS/ext3fs.img || die |
217 |
# fsck after journal removal |
# fsck after journal removal |
218 |
# fsck ${LIVECDROOT}/network-squashfs-temp/LiveOS/ext3fs.img || die |
# fsck ${LIVECDROOT}/netboot-squashfs/LiveOS/ext3fs.img || die |
219 |
|
|
220 |
# losetup the device |
# losetup the device |
221 |
loopdev=$(losetup -f) |
loopdev=$(losetup -f) |
222 |
[[ -z ${loopdev} ]] && die "No unused loopdev found. Maybe you want 'modprobe loop'?" |
[[ -z ${loopdev} ]] && die "No unused loopdev found. Maybe you want 'modprobe loop'?" |
223 |
|
|
224 |
# mount the image |
# mount the image |
225 |
losetup ${loopdev} ${LIVECDROOT}/network-squashfs-temp/LiveOS/ext3fs.img || die |
losetup ${loopdev} ${LIVECDROOT}/netboot-squashfs/LiveOS/ext3fs.img || die |
226 |
mount ${loopdev} ${LIVECDROOT}/network-squashfs-temp/mnt || die |
mount ${loopdev} ${LIVECDROOT}/netboot-squashfs/mnt || die |
227 |
|
|
228 |
# copy everything to the image file and preserve permissions |
# copy everything to the image file and preserve permissions |
229 |
( cd ${LIVECDROOT}/netboot-chroot && tar cpf - . ) | ( cd ${LIVECDROOT}/network-squashfs-temp/mnt && tar xvpf - ) |
( cd ${LIVECDROOT}/netboot-chroot && tar cpf - . ) | ( cd ${LIVECDROOT}/netboot-squashfs/mnt && tar xvpf - ) |
230 |
sleep 3 |
sleep 3 |
231 |
|
|
232 |
# now umount everything and create the squashfs image |
# now umount everything and create the squashfs image |
233 |
umount ${LIVECDROOT}/network-squashfs-temp/mnt || die |
umount ${LIVECDROOT}/netboot-squashfs/mnt || die |
234 |
losetup -d ${loopdev} || die |
losetup -d ${loopdev} || die |
235 |
# remove mount to not ending up in the squashfs image |
# remove mount to not ending up in the squashfs image |
236 |
if [[ -d ${LIVECDROOT}/network-squashfs-temp/mnt ]] |
if [[ -d ${LIVECDROOT}/netboot-squashfs/mnt ]] |
237 |
then |
then |
238 |
rm -r ${LIVECDROOT}/network-squashfs-temp/mnt || die |
rm -r ${LIVECDROOT}/netboot-squashfs/mnt || die |
239 |
fi |
fi |
240 |
mksquashfs ${LIVECDROOT}/network-squashfs-temp ${CDISOROOT}/netboot/squashfs.img || die |
mksquashfs ${LIVECDROOT}/netboot-squashfs ${CDISOROOT}/netboot/squashfs.img || die |
241 |
|
|
242 |
# copy kernel, bootloader and create initramfs to isoroot/netboot |
# copy kernel, bootloader and create initramfs to isoroot/netboot |
243 |
install -d ${CDISOROOT}/netboot || die |
install -d ${CDISOROOT}/netboot || die |
285 |
# final cleanup |
# final cleanup |
286 |
if [[ -z ${SKIP_REMOVE_INSTALLROOT} ]] |
if [[ -z ${SKIP_REMOVE_INSTALLROOT} ]] |
287 |
then |
then |
288 |
if [[ -d ${LIVECDROOT}/network-squasfs-temp ]] |
if [[ -d ${LIVECDROOT}/netboot-squashfs ]] |
289 |
then |
then |
290 |
rm -r ${LIVECDROOT}/network-squasfs-temp || die |
rm -r ${LIVECDROOT}/netboot-squashfs || die |
291 |
fi |
fi |
292 |
if [[ -d ${LIVECDROOT}/netboot-chroot ]] |
if [[ -d ${LIVECDROOT}/netboot-chroot ]] |
293 |
then |
then |