diff options
-rw-r--r-- | src/dnsmasq-dhcp-script.sh | 22 |
1 files changed, 20 insertions, 2 deletions
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 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | [ "$1" = tftp ] || exit 0 | ||
2 | . samizdat-paths.sh | 3 | . samizdat-paths.sh |
3 | TFTP_ROOT=${samizdat_isolinux_dir} | 4 | TFTP_ROOT=${samizdat_isolinux_dir} |
4 | [ "$1 $4" = "tftp ${TFTP_ROOT}/linux/vmlinuz" ] || exit | 5 | TFTP_FILE=$4 |
5 | # $2 is the length of the file | 6 | TFTP_FILE_SIZE=$3 |
6 | CLIENT_IP=$3 | 7 | CLIENT_IP=$3 |
7 | 8 | ||
8 | # dnsmasq clears the environment. kiki needs at least $HOME | 9 | # dnsmasq clears the environment. kiki needs at least $HOME |
@@ -60,5 +61,22 @@ cleanup_after_fail() | |||
60 | rmdir "$child_dir" | 61 | rmdir "$child_dir" |
61 | } | 62 | } |
62 | 63 | ||
64 | exit_unless_needed() | ||
65 | { | ||
66 | |||
67 | case "$TFTP_FILE" in | ||
68 | "${TFTP_ROOT}/linux/vmlinuz") | ||
69 | ;; | ||
70 | "${TFTP_ROOT}/${CLIENT_IP}/linux/vmlinuz") | ||
71 | [ -e "${TFTP_ROOT}/${CLIENT_IP}/gnupghome.tar" ] && exit | ||
72 | ;; | ||
73 | *) exit | ||
74 | ;; | ||
75 | esac | ||
76 | } | ||
77 | |||
78 | exit_unless_needed | ||
79 | |||
63 | debug | 80 | debug |
81 | |||
64 | (new_child || cleanup_after_fail) & | 82 | (new_child || cleanup_after_fail) & |