blob: ec1f8247c75e43174065245f4807a7300310185a (
plain) (
blame)
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
|
#!/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;
};
|