tftp 1.16 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
#
# The template
#
use strict;
use libinstall;
use installvars;

sub Install($$$)
{
    my ($server, $isupdate, $impotent) = @_;

    # Replace if this script does an update for ip/domain.
    return 0
	if ($isupdate);

    Phase "tftp", "Setting up directories for tftp", sub {
	Phase "tftpoff", "Disabling BSD tftpd", sub {
	    PhaseSkip("No inetd.conf!?") unless (-e $INETD_CONF);
	    PhaseSkip("Already disabled") unless `grep '^tftp' $INETD_CONF`;
	    ExecQuietFatal("sed -i .orig -e '/^tftp/s/^/#/' $INETD_CONF");
	    HUPDaemon("inetd");
	};
	Phase "tftpboot", "Creating $TFTP_DIR", sub {
	    DoneIfExists($TFTP_DIR);
	    mkdir $TFTP_DIR,0775 or
		PhaseFail("Unable to create $TFTP_DIR : $!");
	    ExecQuietFatal("$CHGRP tbadmin $TFTP_DIR");
	};
	Phase "tftpproj", "Creating $TFTP_PROJ_DIR", sub {
	    DoneIfExists($TFTP_PROJ_DIR);
	    mkdir $TFTP_PROJ_DIR,0775 or
		PhaseFail("Unable to create $TFTP_PROJ_DIR : $!");
	    ExecQuietFatal("$CHGRP tbadmin $TFTP_PROJ_DIR");
	};
	Phase "tftplink", "Linking /tftpboot", sub {
	    DoneIfExists("/tftpboot");
	    ExecQuietFatal("ln -s $TFTP_DIR /tftpboot");
	};
    };
    return 0;
}

# Local Variables:
# mode:perl
# End: