You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.1 KiB
45 lines
1.1 KiB
9 years ago
|
#!/usr/bin/perl -w
|
||
|
|
||
|
use strict;
|
||
|
use esmith::AccountsDB;
|
||
|
use esmith::templates;
|
||
|
use User::pwent;
|
||
|
|
||
|
my $a = esmith::AccountsDB->open or
|
||
|
die "Could not open AccountsDB\n";
|
||
|
|
||
|
my $event = shift;
|
||
|
my $userName = shift;
|
||
|
my @users;
|
||
|
|
||
|
if (defined $userName){
|
||
|
my $user = $a->get($userName);
|
||
|
die "Account $userName is not a user account; can't update the auto-reply message.\n"
|
||
|
unless $user && $user->prop('type') eq "user";
|
||
|
@users = ($user);
|
||
|
}
|
||
|
else{
|
||
|
@users = ( $a->users );
|
||
|
}
|
||
|
|
||
|
foreach my $user (@users){
|
||
|
my $userName = $user->key;
|
||
|
|
||
|
my $home = getpwnam($userName)->dir;
|
||
|
mkdir $home . '/.lock-auto-reply' unless -d $home . '/.lock-auto-reply';
|
||
|
|
||
|
esmith::templates::processTemplate ({
|
||
|
MORE_DATA => { USERNAME => $userName },
|
||
|
TEMPLATE_PATH => "/.lock-auto-reply/message.txt",
|
||
|
TEMPLATE_EXPAND_QUEUE =>
|
||
|
[
|
||
|
"/etc/e-smith/templates-user-custom",
|
||
|
"/etc/e-smith/templates-user",
|
||
|
],
|
||
|
OUTPUT_PREFIX => "$home",
|
||
|
PERMS => 0644,
|
||
|
});
|
||
|
}
|
||
|
|
||
|
exit(0);
|