1
0
mirror of https://github.com/pavel-odintsov/fastnetmon synced 2024-09-28 15:41:45 +02:00

Add gentoo support. Huge thanks to mdpuma

This commit is contained in:
Pavel Odintsov 2015-07-17 10:19:21 +03:00
parent bcd510da81
commit 0a4757e503
5 changed files with 78 additions and 2 deletions

@ -17,7 +17,7 @@ What can we do? We can detect hosts in our own network with a large amount of pa
- We are part of [CloudRouter](https://cloudrouter.org/cloudrouter/2015/07/09/fastnetmon.html) distribution
- [VyOS based iso image with bundled FastNetMon](docs/VYOS_BINARY_ISO_IMAGE.md)
- [Binary rpm packages for CentOS 6/7 and Fedora 21](docs/INSTALL_RPM_PACKAGES.md)
- [Automatic install script for Debian/Ubuntu/CentOS/Fedora](docs/INSTALL.md)
- [Automatic install script for Debian/Ubuntu/CentOS/Fedora/Gentoo](docs/INSTALL.md)
- [Manual install on FreeBSD and Dragonfly BSD](docs/FreeBSD_INSTALL.md)
- [Manual install on Mac OS X](docs/MAC_OS_INSTALL.md)
- [Manual install on Slackware](docs/SLACKWARE_INSTALL.md)

@ -1,4 +1,4 @@
For Debian 6, 7, 8 and CentOS 6 and 7 you should use the automatic installer:
For Debian 6, 7, 8 and CentOS 6, 7 and Fedora and Gentoo you should use the automatic installer:
```bash
wget https://raw.githubusercontent.com/FastVPSEestiOu/fastnetmon/master/src/fastnetmon_install.pl -Ofastnetmon_install.pl
sudo perl fastnetmon_install.pl

@ -16,3 +16,4 @@ Thanks file! For all peoples which helped this project :)
- Ben Agricola for fixed CentOS 6 init script without daemonize option
- Dmitry Marakasov for FreeBSD port
- Dmitry Baturin for huge help with building iso image with VyOS
- mdpuma for help with Gentoo installer

@ -0,0 +1,32 @@
#!/sbin/runscript
FASTNETMON="/opt/fastnetmon/fastnetmon"
PIDFILE="/var/run/fastnetmon.pid"
ARGS="--daemonize"
depend() {
need net
}
start() {
ebegin "Starting fastnetmon"
if [ -f "${PIDFILE}" ]; then
einfo " Removing stale pidfile ${PIDFILE}"
rm -f "${PIDFILE}" 1>/dev/null
fi
$FASTNETMON $ARGS
eend $?
}
stop() {
ebegin "Stopping fastnetmon"
kill -9 `cat $PIDFILE`
RETVAL=$?
pidof fastnetmon | xargs kill -9
rm -f "${PIDFILE}"
eend $RETVAL
}

@ -92,6 +92,13 @@ if (-e "/etc/redhat-release") {
}
}
if (-e "/etc/gentoo-release") {
$distro_type = 'gentoo';
my $distro_version_raw = `cat /etc/gentoo-release`;
chomp $distro_version_raw;
}
unless ($distro_type) {
die "This distro is unsupported, please do manual install";
}
@ -157,6 +164,15 @@ sub install {
}
`yum install -y make bison flex $kernel_package_name gcc gcc-c++ dkms numactl-devel subversion`;
} elsif ($distro_type eq 'gentoo') {
my @gentoo_packages_for_pfring = ('subversion', 'sys-process/numactl', 'wget', 'tar');
my $gentoo_packages_for_pfring_as_string = join " ", @gentoo_packages_for_pfring;
`emerge -avu $gentoo_packages_for_pfring_as_string`;
if ($? != 0) {
print "Emerge fail with code $?\n";
}
}
if ($we_could_install_kernel_modules) {
@ -256,6 +272,17 @@ sub install {
print "Your distro haven't log4cpp in stable EPEL packages and we install log4cpp from testing of EPEL\n";
`yum install -y https://kojipkgs.fedoraproject.org//packages/log4cpp/1.1.1/1.el7/x86_64/log4cpp-devel-1.1.1-1.el7.x86_64.rpm https://kojipkgs.fedoraproject.org//packages/log4cpp/1.1.1/1.el7/x86_64/log4cpp-1.1.1-1.el7.x86_64.rpm`;
}
} elsif ($distro_type eq 'gentoo') {
my @fastnetmon_deps = ("dev-vcs/git", "gcc", "sys-libs/gpm", "sys-libs/ncurses", "dev-libs/log4cpp", "dev-libs/geoip",
"net-libs/libpcap", "dev-util/cmake", "pkg-config", "dev-libs/hiredis", "dev-libs/boost"
);
my $fastnetmon_deps_as_string = join " ", @fastnetmon_deps;
`emerge -avu $fastnetmon_deps_as_string`;
if ($? != 0) {
print "Emerge fail with code $?\n";
}
}
print "Clone FastNetMon repo\n";
@ -351,6 +378,22 @@ sub install {
$we_have_init_script_for_this_machine = 1;
}
# For Gentoo
if ( $distro_type eq 'gentoo' ) {
my $init_path_in_src = "$fastnetmon_code_dir/fastnetmon_init_script_gentoo";
my $system_init_path = '/etc/init.d/fastnetmon';
# Checker for source code version, will work only for 1.1.3+ versions
if (-e $init_path_in_src) {
`cp $init_path_in_src $system_init_path`;
print "We created service fastnetmon for you\n";
print "You could run it with command: /etc/init.d/fastnetmon start\n";
$we_have_init_script_for_this_machine = 1;
}
}
# For Debian Squeeze and Wheezy
# And any stable Ubuntu version
if ( ($distro_type eq 'debian' && ($distro_version == 6 or $distro_version == 7)) or $distro_type eq 'ubuntu') {