-
Notifications
You must be signed in to change notification settings - Fork 1
/
install-deps
executable file
·151 lines (137 loc) · 3.87 KB
/
install-deps
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/sh
set -e
cpan_install() {
local perlmod="$1"
perl -M"$perlmod" -e '1;' > /dev/null 2>&1 && echo "$perlmod already installed"
perl -M"$perlmod" -e '1;' > /dev/null 2>&1 || cpan install "$perlmod"
}
yum_install() {
for package in "$@"
do
rpm --quiet -q --whatprovides "$package" || yum install -y "$package"
done
}
apt_install() {
apt-get install -y "$@"
}
pkg_install() {
if [ -f /etc/debian_version ]
then
apt_install "$@"
elif [ -f /etc/redhat-release ] && which yum > /dev/null 2>&1
then
yum_install "$@"
fi
}
running_on_Tails() {
[ -f /etc/dpkg/origins/Tails ]
}
perlmodules='
Cwd Data::Dump Digest::SHA File::Path File::Slurp File::Spec File::Temp
FindBin Getopt::Long IO::CaptureOutput IO::Socket::INET Image::Magick
JSON LWP::UserAgent LWP::Protocol::https Template YAML::Syck DateTime
Email::Simple Email::Sender File::Type IPC::Run XML::LibXML Storable
'
if [ -f /etc/debian_version ]
then
running_on_Tails || apt-get install -y ntp
apt-get install -y python-virtualenv
apt-get install -y strace
# - Cwd : in core since perl 5
# - Digest::SHA : in core since perl v5.9.3
# - File::Path : in core since perl 5.001
# - File::Spec : in core since perl 5.00405
# - File::Temp : in core since perl v5.6.1
# - Getopt::Long : in core since perl 5
# - FindBin : in core since perl 5.00307
# - IO::Socket::INET in core since perl v5.6.0
# - Storable : in core since perl v5.7.3
apt-get install -y libdata-dump-perl libfile-slurp-perl \
libio-captureoutput-perl perlmagick libjson-perl \
libwww-perl liblwp-protocol-https-perl libtemplate-perl \
libyaml-syck-perl libdatetime-perl \
libemail-sender-perl libemail-simple-perl libfile-type-perl \
libipc-run-perl libxml-libxml-perl
apt-get install -y nmap curl
fi
if [ -f /etc/redhat-release ] && which yum > /dev/null 2>&1
then
yum_install ntp redhat-lsb-core python-virtualenv strace
if lsb_release -i | grep -q Fedora
then
yum_install nmap-ncat
else
yum_install nmap
fi
yum_install curl
for perlmodule in $perlmodules
do
yum_install "perl($perlmodule)"
done
if which systemctl > /dev/null 2>&1
then
systemctl enable ntpd.service
systemctl is-active -q ntpd.service || systemctl start ntpd.service
else
chkconfig ntpd on
service ntpd status > /dev/null 2>&1 || service ntpd start
fi
fi
if [ a$(uname -s) = aDarwin ] || [ a$(uname -o) = aCygwin ]
then
for perlmod in $perlmodules
do
cpan_install $perlmod
done
fi
if [ a$(uname -s) = aDarwin ]
then
brew install python
brew install p7zip
brew install imagemagick
fi
install_X() {
packages="fluxbox"
if [ -f /etc/debian_version ]
then
packages="$packages xserver-xorg-video-dummy xserver-xorg-input-void"
packages="$packages libgtk2.0-0"
pkg_install lsb-release
if lsb_release -i | grep -q Debian && ! running_on_Tails
then
packages="$packages iceweasel"
fi
elif [ -f /etc/redhat-release ]
then
packages="$packages xorg-x11-drv-dummy xorg-x11-drv-void.x86_64"
if [ "$(uname -m)" == "x86_64" ]
then
packages="$packages libgtk-x11-2.0.so.0()(64bit)"
else
packages="$packages libgtk-x11-2.0.so.0"
fi
fi
pkg_install $packages
}
install_win() {
[ -f /etc/debian_version ] && packages="p7zip-full"
[ -f /etc/redhat-release ] && packages="p7zip-plugins"
pkg_install $packages
}
install_hardening() {
pkg_install python-pefile binutils
}
while test $# != 0
do
case "$1" in
X)
install_X ;;
win)
install_win ;;
hardening)
install_hardening ;;
*)
echo "Unknown option $1" >&2 ;;
esac
shift
done