35 1022 Bytes
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
#
# Create and maintain stated mail log.
#
use strict;
use libinstall;

my $NEWSYSLOG_CONF  = "/etc/newsyslog.conf";
my $STATEDMAILLOG   = "$LOGDIR/stated-mail.log";

sub InstallUpdate($$)
{
    my ($version, $phase) = @_;

    #
    # If something should run in the pre-install phase.
    #
    if ($phase eq "pre") {
	Phase "stated-mail", "Creating stated-mail.log", sub {
	    DoneIfExists($STATEDMAILLOG);
	    CreateFileFatal($STATEDMAILLOG);
	    ExecQuietFatal("$CHMOD 640 $STATEDMAILLOG");
	};
	Phase "newsyslog", "Updating $NEWSYSLOG_CONF", sub {
	    DoneIfEdited($NEWSYSLOG_CONF);
	    BackUpFileFatal($NEWSYSLOG_CONF);
	    AppendToFileFatal($NEWSYSLOG_CONF,
			      "$STATEDMAILLOG  640  9  1000 *  Z ".
			      "/var/run/stated.pid 31");
	};
    }
    
    #
    # If something should run in the post-install phase.
    #
    if ($phase eq "post") {
	Phase "stated", "Restarting stated", sub {
	    DoneIfDoesntExist("$VARRUN/stated.pid");
	    SignalDaemon("stated", 'USR1');
	};
    }
    return 0;
}
1;