samba 1.31 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 46 47 48 49 50 51 52 53 54 55 56
#
# The template
#
use strict;
use libinstall;
use installvars;

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

    Phase "samba", "Setting up Samba", sub {
	if (!ISFS($server)) {
	    PhaseSkip("Not FS node");
	}
	if (!$WINSUPPORT) {
	    PhaseSkip("Windows support not enabled");
	}
	Phase "smb.conf", "Installing smb.conf[.head]", sub {
	    DoneIfIdentical("$TOP_OBJDIR/install/smb.conf.head", $SMBCONF_HEAD)
		if (-e $SMBCONF_HEAD);
	    BackUpFileFatal($SMBCONF_HEAD)
		if (-e $SMBCONF_HEAD);
	    
	    ExecQuietFatal("$CP -pf $TOP_OBJDIR/install/smb.conf.head $SMBCONF_HEAD");
	    ExecQuietFatal("$CP -pf $SMBCONF_HEAD $SMBCONF_FILE");
	};
	PhaseSucceed("update complete")
	    if ($isupdate);
	
	Phase "samba.sh", "Installing samba.sh", sub {
	    DoneIfExists("$RCDIR/samba.sh");
	    DoneIfDoesntExist("$RCDIR/samba.sh.sample");
	    ExecQuietFatal("$MV -f $RCDIR/samba.sh.sample $RCDIR/samba.sh");
	};
	if ($ELABINELAB) {	
	    Phase "starting", "Starting Samba", sub {
		my $sscript;
		if (-x "$RCDIR/samba.sh") {
		    $sscript = "samba.sh";
		} elsif (-x "$RCDIR/samba") {
		    $sscript = "samba";
		} else {
		    PhaseFail("No samba startup script!?");
		}
		DoneIfExists("$VARRUN/smbd.pid");
		ExecQuietFatal("$RCDIR/$sscript start");
	    };
	}
    };
    return 0;
}

# Local Variables:
# mode:perl
# End: