Sophie

Sophie

distrib > Mandriva > 2007.1 > x86_64 > media > contrib-release > by-pkgid > 4afdb4ad448b6c7fdfe526dd9cc116af > scriptlet

bacula-dir-common-2.0.2-2mdv2007.1.x86_64.rpm

PREIN

/bin/sh
/usr/bin/perl -e '
$confdir="/etc/bacula";
$conffile="$confdir/.pw.sed";
if ( -f "$conffile") {
	open(IN, "<$conffile") or die "$!";
	while (<IN>) {
		/#YOU MUST SET THE (.*) PASSWORD#/ && $already{$1}++;
	}
	close(IN);
}
mkdir("$confdir");
umask(0077);
open(IN, "/dev/random") or die "$!";
open(OUT, ">>$conffile") or die "$!";
foreach $c ("DIR","SD","FD","MONITOR DIR","MONITOR SD","MONITOR FD") {
next if ($already{$c});
read(IN, $buf, 32);
my $res = pack("u", $buf);
$res =~ s/^.//mg;
$res =~ s/\n//g;
$res =~ tr|` -_|AA-Za-z0-9+/|;
	print OUT "s!#YOU MUST SET THE $c PASSWORD#!\"$res\"!\n";
}
close (IN);
close (OUT);
'

PREUN

/bin/sh
/usr/share/rpm-helper/del-service bacula $1 bacula-dir

POSTIN

/bin/sh
umask 0037; if [ -s /etc/bacula/.pw.sed ]; then for i in /etc/bacula/*.conf /etc/bacula/*.conf.rpmnew; do if [ -s $i ]; then sed -f /etc/bacula/.pw.sed $i > $i.tmp; sed -e '/SubSys[[:space:]]*Directory/I d' $i.tmp > $i; rm -f $i.tmp; fi; done; fi;/usr/share/rpm-helper/add-service bacula $1 bacula-dir