-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstalldepends.pl
More file actions
executable file
·74 lines (60 loc) · 1.53 KB
/
installdepends.pl
File metadata and controls
executable file
·74 lines (60 loc) · 1.53 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/perl -w
#
# shadow install script
# Written by Aaron Blakely
#
#
use strict;
use warnings;
use CPAN;
use lib './modules';
my @dependsRaw;
my @depends;
# Core Dependencies
push(@dependsRaw, "JSON");
push(@dependsRaw, "Digest::SHA");
# OS-specific for BotStats
if ($^O eq "msys" || $^O eq "MSWin32") {
push(@dependsRaw, "Win32::OLE");
} elsif ($^O eq "linux") {
push(@dependsRaw, "Proc::ProcessTable");
} else {
print "[Warning] BotStats module only supports Windows or Linux, it will not be available on this install.\n";
}
sub sortArray {
my %seen;
grep !$seen{$_}++, @_;
}
# Get a dir listing
opendir(MODS, "./modules") or die $!;
while (my $file = readdir(MODS)) {
if ($file =~ /\.pm/) {
open(MODFILE, "<./modules/$file") or die $!;
while (my $line = <MODFILE>) {
if ($line =~ /use (.*);/) {
my ($pkg, $arg) = split(/ /, $1);
print " -- Found $pkg in $file, adding to install list.\n";
push(@dependsRaw, $pkg) if $pkg ne "open";
}
}
close(MODFILE);
}
}
closedir(MODS);
@depends = sortArray(@dependsRaw);
foreach my $mod (@depends) {
next if ($mod =~ /Shadow\:\:/);
print "Checking for $mod...";
eval "require $mod";
if ($@) {
print "Not found.\nInstalling...\n";
install($mod);
} else {
print "Excellent!\n";
}
}
print "\nDone. Your environment is now prepared for shadow.\n";
print "Make sure you edit etc/shadow.conf then run ./shadow\n";
my $whome = `whoami`;
chomp $whome;
print "Party on, ".$whome."!\n";