Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>2010-03-18 11:20:05 -0300
committerGerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>2010-03-18 12:03:59 -0300
commit7483cffb30bcc1910cfd1ffb14c2ac9ef94ba319 (patch)
tree38ee5c2d752a080ef1d646ec0f9eee500061b5ba
parent556515885d931aa0f802fffff8f56d27c1a780af (diff)
[archiso] Use a mount handler in archiso_pxe_nbd hook
* Register a mount_hook if booted via PXE. This allows to do all needed steps before and after calling archiso_mount_handler. * umount and disconnect network device if copytoram=y Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
-rw-r--r--README2
-rw-r--r--archiso/hooks/archiso_pxe_nbd42
-rw-r--r--configs/syslinux-iso/mkinitcpio.conf2
3 files changed, 31 insertions, 15 deletions
diff --git a/README b/README
index 7241321..e3001be 100644
--- a/README
+++ b/README
@@ -40,7 +40,7 @@ to create a mkinitcpio config file that suits your needs. Typically this
means modifying whatever hooks you want. A typical set of hooks for
archiso looks something like this:
-HOOKS="base archiso_early udev archiso pata scsi sata usb fw pcmcia filesystems usbinput"
+HOOKS="base udev archiso archiso_pxe_nbd pata scsi sata usb fw pcmcia filesystems usbinput"
It's probably worth mentioning that hardware autodetection and things
of that nature do not belong here. Only what's necessary to get the system
diff --git a/archiso/hooks/archiso_pxe_nbd b/archiso/hooks/archiso_pxe_nbd
index 9df5a95..2d4163e 100644
--- a/archiso/hooks/archiso_pxe_nbd
+++ b/archiso/hooks/archiso_pxe_nbd
@@ -1,6 +1,5 @@
# vim: set ft=sh:
-run_hook ()
-{
+run_hook () {
local line i address netmask gateway dns0 dns1 rootserver rootpath filename
: > /ip_opts
@@ -45,19 +44,36 @@ run_hook ()
echo "IP-Config: ${address}/${netmask}"
echo "IP-Config: gw: ${gateway} dns0: ${dns0} dns1: ${dns1}"
- modprobe nbd 2> /dev/null
+ nbdserver=${rootserver}
- msg ":: Waiting for boot device..."
- while ! poll_device /dev/nbd0 10; do
- echo "ERROR: boot device didn't show up after 10 seconds..."
- echo " Falling back to interactive prompt"
- echo " You can try to fix the problem manually, log out when you are finished"
- launch_interactive_shell
- done
+ mount_handler="archiso_pxe_nbd_mount_handler"
+ fi
+}
+
+archiso_pxe_nbd_mount_handler () {
+ newroot="${1}"
+
+ # Module autoloading like with loop devices does not work, doing manually...
+ modprobe nbd 2> /dev/null
+ while [ ! -b /dev/nbd0 ]; do
+ sleep 1
+ done
+
+ msg "::: Setup NBD from ${nbdserver}:9040 at /dev/nbd0"
+ if [ "${copytoram}" = "y" ]; then
+ nbd-client ${nbdserver} 9040 /dev/nbd0
+ else
+ nbd-client ${nbdserver} 9040 /dev/nbd0 -persist
+ fi
+
+ archisodevice=/dev/nbd0
- msg "::: Setup NBD from ${rootserver}:9040 at /dev/nbd0 ..."
- nbd-client ${rootserver} 9040 /dev/nbd0 -persist
+ archiso_mount_handler ${newroot}
- archisodevice=/dev/nbd0
+ if [ "${copytoram}" = "y" ]; then
+ umount ${newroot}/bootmnt
+ umount /bootmnt
+ msg "::: Disconnect NBD from ${nbdserver}:9040 at /dev/nbd0"
+ nbd-client -d /dev/nbd0
fi
}
diff --git a/configs/syslinux-iso/mkinitcpio.conf b/configs/syslinux-iso/mkinitcpio.conf
index 1f61638..e041ad2 100644
--- a/configs/syslinux-iso/mkinitcpio.conf
+++ b/configs/syslinux-iso/mkinitcpio.conf
@@ -2,5 +2,5 @@
MODULES=""
BINARIES=""
FILES=""
-HOOKS="base udev archiso_pxe_nbd archiso pata scsi sata usb fw pcmcia filesystems usbinput"
+HOOKS="base udev archiso archiso_pxe_nbd pata scsi sata usb fw pcmcia filesystems usbinput"
COMPRESSION="lzma"