From 72a4f463ce8f21074c70b628bdf7c12fe277b1e2 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Sat, 25 Mar 2017 14:59:36 -0400 Subject: dnsmasq dhcp-script handles missing gnupghome.tar by generating it Previously, this condition would cause the client to poll forever. --- src/dnsmasq-dhcp-script.sh | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/dnsmasq-dhcp-script.sh') diff --git a/src/dnsmasq-dhcp-script.sh b/src/dnsmasq-dhcp-script.sh index 167d229..7469447 100644 --- a/src/dnsmasq-dhcp-script.sh +++ b/src/dnsmasq-dhcp-script.sh @@ -1,8 +1,9 @@ #!/bin/sh +[ "$1" = tftp ] || exit 0 . samizdat-paths.sh TFTP_ROOT=${samizdat_isolinux_dir} -[ "$1 $4" = "tftp ${TFTP_ROOT}/linux/vmlinuz" ] || exit -# $2 is the length of the file +TFTP_FILE=$4 +TFTP_FILE_SIZE=$3 CLIENT_IP=$3 # dnsmasq clears the environment. kiki needs at least $HOME @@ -60,5 +61,22 @@ cleanup_after_fail() rmdir "$child_dir" } +exit_unless_needed() +{ + + case "$TFTP_FILE" in + "${TFTP_ROOT}/linux/vmlinuz") + ;; + "${TFTP_ROOT}/${CLIENT_IP}/linux/vmlinuz") + [ -e "${TFTP_ROOT}/${CLIENT_IP}/gnupghome.tar" ] && exit + ;; + *) exit + ;; + esac +} + +exit_unless_needed + debug + (new_child || cleanup_after_fail) & -- cgit v1.2.3