summaryrefslogtreecommitdiffstats
path: root/build_tools/archiso-19/archiso/initcpio/hooks/archiso_pxe_nbd
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2014-10-13 17:03:13 (GMT)
committerJames Meyer <james.meyer@operamail.com>2014-10-13 17:03:13 (GMT)
commit2e7abbab92370a4a99ad68e460c476d02296e665 (patch)
tree1d6273195dd2c4f2e22d71d26a486cbfaa77052c /build_tools/archiso-19/archiso/initcpio/hooks/archiso_pxe_nbd
parent8bef8020a022c52a8d1d4bb373b5c8cdc256284f (diff)
downloadlinhes_dev-2e7abbab92370a4a99ad68e460c476d02296e665.zip
archiso-19 + configs for linhes iso.
This provides archiso-19 but doesn't install it inside the dev env.
Diffstat (limited to 'build_tools/archiso-19/archiso/initcpio/hooks/archiso_pxe_nbd')
-rw-r--r--build_tools/archiso-19/archiso/initcpio/hooks/archiso_pxe_nbd40
1 files changed, 40 insertions, 0 deletions
diff --git a/build_tools/archiso-19/archiso/initcpio/hooks/archiso_pxe_nbd b/build_tools/archiso-19/archiso/initcpio/hooks/archiso_pxe_nbd
new file mode 100644
index 0000000..d9bc6d8
--- /dev/null
+++ b/build_tools/archiso-19/archiso/initcpio/hooks/archiso_pxe_nbd
@@ -0,0 +1,40 @@
+# 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
+
+ if [[ "${copytoram}" != "n" ]]; then
+ copytoram="y"
+ fi
+
+ archisodevice=/dev/nbd0
+
+ archiso_mount_handler ${newroot}
+
+ msg ":: Disconnect NBD from ${archiso_nbd_srv} at /dev/nbd0"
+ nbd-client -d /dev/nbd0
+}