#!/usr/bin/perl

$t = q%:0
SHELL=/bin/sh

* !? /usr/local/bin/chk_mail-abuse
{
  :0 fhbw
  | formail -A "X-UBE: RBL/RSS/DUL" 
}

:0
* !? /usr/local/bin/chk_orbs
{
  :0 fhbw
  | formail -A "X-UBE: ORBS" 

}
%;

$user = shift @ARGV;

if ($user eq "" && (($user = (getpwuid($<))[0]) eq "root")) {
	die "Usage: $0 username\n";
}

$t =~ s/{user}/$user/g;
	
($login,$pass,$uid,$gid) = getpwnam($user)
    or die "$user not in passwd file";

$rc = "/home/$user/.procmailrc";
die "$rc not a regular file\n" if (-e $rc && ! -f $rc);
warn "$rc exists, check results\n" if (-e $rc);
open (RC, ">>$rc") || die "Cannot open procmairc($rc): $!";
print RC $t;
close RC;

chown $uid, $gid, $rc, $dat; 


