summaryrefslogtreecommitdiffstats
path: root/deployd.sh
diff options
context:
space:
mode:
Diffstat (limited to 'deployd.sh')
-rwxr-xr-xdeployd.sh11
1 files changed, 7 insertions, 4 deletions
diff --git a/deployd.sh b/deployd.sh
index 692196a..84f7bcc 100755
--- a/deployd.sh
+++ b/deployd.sh
@@ -1,6 +1,7 @@
#!/bin/sh
PXE_ROOT=/var/lib/tftpboot/X86PC/linux/pxelinux.cfg
+MAC_TABLE=/var/lib/tftpboot/X86PC/conf_mac_profiles
log() {
logger -t deployd $@
@@ -10,12 +11,14 @@ read MAC_ADDR
PXE_ADDR=01-${MAC_ADDR//:/-}
PXE_FILE=${PXE_ROOT}/${PXE_ADDR}
-if [ -L ${PXE_FILE} ]; then
+NEW_PROFILE=`awk --field-separator \| "!/^#/ { if (\\$1 == \"$MAC_ADDR\") print \\$3}" /var/lib/tftpboot/X86PC/conf_mac_profiles`
+
+if [ -n "${NEW_PROFILE}" ]; then
INST_LINK=`readlink ${PXE_FILE}`
- BOOT_LINK=${INST_LINK/install/boot}
- if [ ${INST_LINK} = ${BOOT_LINK} ]; then
+ NEW_LINK=profiles/boot/${NEW_PROFILE}
+ if [ ${INST_LINK} = ${NEW_LINK} ]; then
log "${MAC_ADDR} was already installed"
- elif ln -sf ${BOOT_LINK} ${PXE_FILE}; then
+ elif ln -sf ${NEW_LINK} ${PXE_FILE}; then
log "${MAC_ADDR} successfully installed"
else
log "unable to switch ${MAC_ADDR} to boot profile"