summaryrefslogtreecommitdiff
path: root/archiso
diff options
context:
space:
mode:
Diffstat (limited to 'archiso')
-rw-r--r--archiso/Makefile4
-rw-r--r--archiso/hooks/archiso_pxe_nfs26
-rw-r--r--archiso/install/archiso_pxe_nfs14
3 files changed, 44 insertions, 0 deletions
diff --git a/archiso/Makefile b/archiso/Makefile
index 0dbbbf8..11aff53 100644
--- a/archiso/Makefile
+++ b/archiso/Makefile
@@ -22,6 +22,8 @@ install-hooks:
install -D -m 644 install/archiso_pxe_nbd $(DESTDIR)/lib/initcpio/install/archiso_pxe_nbd
install -D -m 644 hooks/archiso_pxe_curl $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_curl
install -D -m 644 install/archiso_pxe_curl $(DESTDIR)/lib/initcpio/install/archiso_pxe_curl
+ install -D -m 644 hooks/archiso_pxe_nfs $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_nfs
+ install -D -m 644 install/archiso_pxe_nfs $(DESTDIR)/lib/initcpio/install/archiso_pxe_nfs
install -D -m 644 hooks/archiso_loop_mnt $(DESTDIR)/lib/initcpio/hooks/archiso_loop_mnt
install -D -m 644 install/archiso_loop_mnt $(DESTDIR)/lib/initcpio/install/archiso_loop_mnt
@@ -49,6 +51,8 @@ uninstall:
rm -f $(DESTDIR)/lib/initcpio/install/archiso_pxe_nbd
rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_curl
rm -f $(DESTDIR)/lib/initcpio/install/archiso_pxe_curl
+ rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_nfs
+ rm -f $(DESTDIR)/lib/initcpio/install/archiso_pxe_nfs
rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_loop_mnt
rm -f $(DESTDIR)/lib/initcpio/install/archiso_loop_mnt
rm -rf $(DESTDIR)/usr/share/archiso/
diff --git a/archiso/hooks/archiso_pxe_nfs b/archiso/hooks/archiso_pxe_nfs
new file mode 100644
index 0000000..a053672
--- /dev/null
+++ b/archiso/hooks/archiso_pxe_nfs
@@ -0,0 +1,26 @@
+# vim: set ft=sh:
+
+run_hook() {
+ if [[ -n "${ip}" && -n "${archiso_nfs_srv}" ]]; then
+
+ archiso_nfs_srv=$(eval echo ${archiso_nfs_srv})
+ [[ -n "${archiso_nfs_opt}" ]] && archiso_nfs_opt="-o ${archiso_nfs_opt}"
+
+ mount_handler="archiso_nfs_mount_handler"
+ fi
+}
+
+archiso_nfs_mount_handler() {
+ newroot="${1}"
+ mkdir -p "/run/archiso/bootmnt"
+ msg ":: Mounting '${archiso_nfs_srv}'"
+ # Do not put "${archiso_nfs_opt}" nfsmount fails!
+ if ! nfsmount ${archiso_nfs_opt} "${archiso_nfs_srv}" "/run/archiso/bootmnt"; then
+ echo "ERROR: Mounting '${archiso_nfs_srv}'"
+ echo " Falling back to interactive prompt"
+ echo " You can try to fix the problem manually, log out when you are finished"
+ launch_interactive_shell
+ fi
+
+ archiso_mount_handler ${newroot}
+}
diff --git a/archiso/install/archiso_pxe_nfs b/archiso/install/archiso_pxe_nfs
new file mode 100644
index 0000000..52be9f3
--- /dev/null
+++ b/archiso/install/archiso_pxe_nfs
@@ -0,0 +1,14 @@
+# vim: set ft=sh:
+
+build() {
+ MODULES="nfs"
+ SCRIPT="archiso_pxe_nfs"
+
+ add_binary "/lib/initcpio/nfsmount" "/bin/nfsmount"
+}
+
+help() {
+ cat <<HELPEOF
+ This hook loads the necessary modules for boot via PXE and NFS.
+HELPEOF
+}