summaryrefslogtreecommitdiffstats
path: root/deployd.sh
diff options
context:
space:
mode:
Diffstat (limited to 'deployd.sh')
-rwxr-xr-xdeployd.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/deployd.sh b/deployd.sh
new file mode 100755
index 0000000..692196a
--- /dev/null
+++ b/deployd.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+PXE_ROOT=/var/lib/tftpboot/X86PC/linux/pxelinux.cfg
+
+log() {
+ logger -t deployd $@
+}
+
+read MAC_ADDR
+PXE_ADDR=01-${MAC_ADDR//:/-}
+PXE_FILE=${PXE_ROOT}/${PXE_ADDR}
+
+if [ -L ${PXE_FILE} ]; then
+ INST_LINK=`readlink ${PXE_FILE}`
+ BOOT_LINK=${INST_LINK/install/boot}
+ if [ ${INST_LINK} = ${BOOT_LINK} ]; then
+ log "${MAC_ADDR} was already installed"
+ elif ln -sf ${BOOT_LINK} ${PXE_FILE}; then
+ log "${MAC_ADDR} successfully installed"
+ else
+ log "unable to switch ${MAC_ADDR} to boot profile"
+ fi
+else
+ log "failed to locate configuration for ${MAC_ADDR}"
+fi