summaryrefslogtreecommitdiff
path: root/nfsboot-server.configure
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2014-11-14 15:17:06 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2014-11-14 15:17:06 +0000
commit64b3b934e786a979b37aebdac43ab58852129ba8 (patch)
treeb8574ec68a59e73e60338eac0e9f1a95a977f3b3 /nfsboot-server.configure
parent45da8d54d7597187ba9f73273230eaa3974f7f1f (diff)
parentf9e02689f1d9cdaaa1478187f490ca051a607fe4 (diff)
downloaddefinitions-64b3b934e786a979b37aebdac43ab58852129ba8.tar.gz
Merge branch 'baserock/richardmaw/pxeboot-write'
Reviewed-by: Jim MacArthur Reviewed-by: Sam Thursfield
Diffstat (limited to 'nfsboot-server.configure')
-rwxr-xr-xnfsboot-server.configure28
1 files changed, 21 insertions, 7 deletions
diff --git a/nfsboot-server.configure b/nfsboot-server.configure
index 9779c053..9fb48096 100755
--- a/nfsboot-server.configure
+++ b/nfsboot-server.configure
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2013 Codethink Limited
+# Copyright (C) 2013-2014 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,21 +24,35 @@ ROOT="$1"
##########################################################################
-chroot "$ROOT" systemctl enable nfs-server.service
+nfsboot_root=/srv/nfsboot
+tftp_root="$nfsboot_root"/tftp
+nfs_root="$nfsboot_root"/nfs
+mkdir -p "$ROOT$tftp_root" "$ROOT$nfs_root"
-mkdir -p "$ROOT/srv/nfsboot/tftp" "$ROOT/srv/nfsboot/nfs"
-
-cat >"$ROOT/usr/lib/systemd/system/nfsboot-tftp.service" <<EOF
+install -D /dev/stdin "$ROOT/usr/lib/systemd/system/nfsboot-tftp.service" <<EOF
[Unit]
Description=tftp service for booting kernels
After=network.target
[Service]
Type=simple
-ExecStart=/usr/bin/udpsvd -E 0 69 /usr/sbin/tftpd /srv/nfsboot/tftp/
+ExecStart=/usr/bin/udpsvd -E 0 69 /usr/sbin/tftpd $tftp_root
[Install]
WantedBy=multi-user.target
EOF
-chroot "$ROOT" systemctl enable nfsboot-tftp.service
+for prefix in / /usr; do
+ for unit in nfsboot-tftp.service nfs-server.service; do
+ unit_path="${prefix}/lib/systemd/system/$unit"
+ if [ -e "$ROOT/$unit_path" ]; then
+ ln -s "../../../../$unit_path" \
+ "$ROOT/etc/systemd/system/multi-user.target.wants/$unit"
+ fi
+ done
+done
+
+pxelinux_file="$ROOT/usr/share/syslinux/pxelinux.0"
+if [ -e "$pxelinux_file" ]; then
+ cp "$pxelinux_file" "$ROOT$tftp_root/pxelinux.0"
+fi