summaryrefslogtreecommitdiffstats
path: root/deploy_get_autoinst.pl
blob: dba06e50f7728a08c9e5ac021c7ffd6c4d032986 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/perl

use IO::Socket;
use MDK::Common;

my $root = "/var/lib/tftpboot/X86PC/linux/pxelinux.cfg/profiles";
my $file = scalar <> =~ m!^GET (.*?) HTTP/[0-9.]+! && "$root/$1";

sub output_http {
    my ($code, @msg) = @_;
    print join("\015\012" => "HTTP/1.0 $code", "", "");
    print  @msg;
}

if (defined $file && -r $file) {
    output_http("200 OK", cat_($file));
} else {
    output_http("404 Not Found");
}