diff --git a/initramfs/scripts/netboot b/initramfs/scripts/netboot index 517e14b..12ba559 100755 --- a/initramfs/scripts/netboot +++ b/initramfs/scripts/netboot @@ -7,6 +7,38 @@ export PATH=/usr/bin:/usr/sbin:/bin:/sbin MOUNTPOINT=/root TMPFS_MOUNT=/mnt +# Hook functions for initramfs-tools boot script integration +netboot_top() +{ + if [ "${netboot_top_used}" != "yes" ]; then + [ "${quiet?}" != "y" ] && log_begin_msg "Running /scripts/netboot-top" + run_scripts /scripts/netboot-top + [ "$quiet" != "y" ] && log_end_msg + fi + netboot_top_used=yes +} + +netboot_premount() +{ + if [ "${netboot_premount_used}" != "yes" ]; then + [ "${quiet?}" != "y" ] && log_begin_msg "Running /scripts/netboot-premount" + run_scripts /scripts/netboot-premount + [ "$quiet" != "y" ] && log_end_msg + fi + netboot_premount_used=yes +} + +netboot_bottom() +{ + if [ "${netboot_premount_used}" = "yes" ] || [ "${netboot_top_used}" = "yes" ]; then + [ "${quiet?}" != "y" ] && log_begin_msg "Running /scripts/netboot-bottom" + run_scripts /scripts/netboot-bottom + [ "$quiet" != "y" ] && log_end_msg + fi + netboot_premount_used=no + netboot_top_used=no +} + # Parse kernel command line for HTTP root parse_cmdline() { for x in $(cat /proc/cmdline); do @@ -27,6 +59,11 @@ parse_cmdline() { mountroot() { rc=1 + + # Run hook scripts + netboot_top + netboot_premount + parse_cmdline if test -z "${ROOT_URL}"; then @@ -145,3 +182,19 @@ mountroot() { return ${rc} } + +# Standard mount hook wrappers expected by initramfs init +mount_top() +{ + netboot_top +} + +mount_premount() +{ + netboot_premount +} + +mount_bottom() +{ + netboot_bottom +}