index : archiso32 | |
Archlinux32 iso tools | gitolite user |
summaryrefslogtreecommitdiff |
author | Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> | 2012-08-25 15:14:51 -0300 |
---|---|---|
committer | Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> | 2012-08-25 15:14:51 -0300 |
commit | 5df61f0c9e89725b59d0e975d6e320fa0ea579ba (patch) | |
tree | c29627857c9ae5243cf27547f80edcf24e35f78d /archiso/initcpio/hooks/archiso_pxe_nbd | |
parent | b629c4a4adb67f76f78bed00bcdf7ebcf36f813b (diff) |
-rw-r--r-- | archiso/initcpio/hooks/archiso_pxe_nbd | 37 |
diff --git a/archiso/initcpio/hooks/archiso_pxe_nbd b/archiso/initcpio/hooks/archiso_pxe_nbd new file mode 100644 index 0000000..a9f84d5 --- /dev/null +++ b/archiso/initcpio/hooks/archiso_pxe_nbd @@ -0,0 +1,37 @@ +# vim: set ft=sh: + +run_hook() { + if [[ -n "${ip}" && -n "${archiso_nbd_srv}" ]]; then + + archiso_nbd_srv=$(eval echo ${archiso_nbd_srv}) + [[ -z "${archiso_nbd_name}" ]] && archiso_nbd_name="archiso" + + 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 + + msg ":: Waiting for boot device..." + while ! poll_device /dev/nbd0 30; do + echo "ERROR: boot device didn't show up after 30 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 + + msg ":: Setup NBD from ${archiso_nbd_srv} at /dev/nbd0" + nbd-client ${archiso_nbd_srv} -N ${archiso_nbd_name} /dev/nbd0 + + copytoram="y" + archisodevice=/dev/nbd0 + + archiso_mount_handler ${newroot} + + msg ":: Disconnect NBD from ${archiso_nbd_srv} at /dev/nbd0" + nbd-client -d /dev/nbd0 +} |