From 84acc68b5d9d076bb8ff3dce0fd0bf2c25f0b4c1 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 14 Sep 2005 16:08:26 +0000 Subject: update PXE links according to mac table configuration --- deployd.sh | 11 +++++++---- 1 file 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" -- cgit v1.2.1