index : mkinitcpio-archiso32 | |
Archlinux32 initcpio scripts used by archiso | gitolite user |
summaryrefslogtreecommitdiff |
author | Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> | 2010-03-18 11:20:05 -0300 |
---|---|---|
committer | Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> | 2010-03-18 12:03:59 -0300 |
commit | 0ff0101c9df8ce64e47024305be06c9bb7c58e87 (patch) | |
tree | a932655d990ccfac281f97600ec0e41b6d7bf069 /archiso/hooks | |
parent | b3f657b54fbcc050552431d911e304fae17cc21e (diff) |
-rw-r--r-- | archiso/hooks/archiso_pxe_nbd | 42 |
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 } |