mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-14 03:10:47 +00:00
3fe92c0644
PR: 32471 Submitted by: Martijn Lina <martijn@ietsvaags.xs4all.nl>, TAKEMURA Masahiro <mastake@msel.t.u-tokyo.ac.jp> Tested by: TERAMOTO Masahiro <teramoto@comm.eng.osaka-u.ac.jp>, "Julian C. Dunn" <jdunn@aquezada.com> Approved by: maintainer timeout (1 month since I mailed him)
32 lines
711 B
Perl
32 lines
711 B
Perl
#!/usr/bin/perl
|
|
|
|
$user=vscan;
|
|
$group=nogroup;
|
|
|
|
if (`grep ^vscan: /etc/passwd` eq "") {
|
|
print "You need a user \"${user}\".\n";
|
|
if (yesno("Would you like me to create it", "y")) {
|
|
system ("/usr/sbin/pw useradd ${user} -g ${group} -h - -d /nonexistent -s /nonexistent -c \"AMaViS Virus Scanner\" || exit");
|
|
print "Done.\n";
|
|
} else {
|
|
print "Please create it, and try again.\n";
|
|
exit 1;
|
|
};
|
|
} else {
|
|
print "You already have a user \"${user}\", so I will use it.\n";
|
|
};
|
|
|
|
sub yesno() {
|
|
my ($mes, $def) = @_;
|
|
print "$mes [$def]? ";
|
|
$answer = <STDIN>;
|
|
chomp($answer);
|
|
if ($answer eq "") {
|
|
$answer = "y";
|
|
};
|
|
if ($answer=~/^y/i) {
|
|
return 1;
|
|
};
|
|
return 0;
|
|
};
|