summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2014-10-06 13:06:53 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2014-11-14 14:57:19 +0000
commit57a83a083622b7cd4453878dc3b6fba9025f2512 (patch)
tree73e01e4c6ca8a28e7a732b07e92abf42690db291
parent16229d7c01a4c9b6db28e7ad27eed878be66096e (diff)
downloaddefinitions-57a83a083622b7cd4453878dc3b6fba9025f2512.tar.gz
Make nfsboot-server architecture independent
-rwxr-xr-xnfsboot-server.configure23
1 files changed, 16 insertions, 7 deletions
diff --git a/nfsboot-server.configure b/nfsboot-server.configure
index 9779c053..43df0bea 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,30 @@ 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