2 ################################################################################
3 # Purpose: hackish script to generate netboot package without booting the system
4 ################################################################################
7 echo "Usage: $0 <chroot> <output_file>" >&2
17 if ! [ -f "${CHROOT}/etc/grml_version" ] ; then
18 echo "Error: could not read ${CHROOT}/etc/grml_version" >&2
22 GRML_VERSION="$(awk '{print $1"_"$2}' ${CHROOT}/etc/grml_version)"
24 if ! [ -r "${CHROOT}/usr/lib/syslinux/pxelinux.0" ] ; then
25 echo "Error: /usr/lib/syslinux/pxelinux.0 not found. Please install syslinux[-common]." >&2
29 OUTPUTDIR="$(mktemp -d)" || exit 1
30 WORKING_DIR="${OUTPUTDIR}/grml_netboot_package_${GRML_VERSION}/tftpboot/"
31 mkdir -p "$WORKING_DIR" || exit 2
33 cp "$CHROOT"/boot/vmlinuz-* "$WORKING_DIR"/vmlinuz
34 cp "$CHROOT"/boot/initrd.img-* "$WORKING_DIR"/initrd.img
35 cp "$CHROOT"/usr/lib/syslinux/pxelinux.0 "${WORKING_DIR}/pxelinux.0"
37 if [ -r "$CHROOT"/usr/lib/syslinux/modules/bios/ldlinux.c32 ] ; then
38 cp "$CHROOT"/usr/lib/syslinux/modules/bios/ldlinux.c32 "${WORKING_DIR}"/
41 mkdir -p "${WORKING_DIR}/pxelinux.cfg"
42 cat > "${WORKING_DIR}/pxelinux.cfg/default" << EOF
46 append initrd=initrd.img root=/dev/nfs rw nfsroot=192.168.0.1:/live/image boot=live apm=power-off quiet nomce noprompt noeject vga=791
49 if tar -C "$OUTPUTDIR" -acf "${OUTPUT_FILE}" "grml_netboot_package_${GRML_VERSION}" ; then
51 echo "Generated ${OUTPUT_FILE}"
54 ## END OF FILE #################################################################