Skip to content
This repository has been archived by the owner on May 15, 2019. It is now read-only.

Install dir #5

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 26 additions & 10 deletions install_nfdump.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
#!/bin/bash

dir=$1
install_path=${dir:-/opt/spot}
bin=${install_path}/bin
dependencies=(tar make gcc m4 automake autoconf flex byacc)

log_cmd () {

printf "\n****SPOT.NFDUMP.install_nfdump.sh****\n"
date +"%y-%m-%d %H:%M:%S"
printf "$1\n\n"

}

if [ ! -d ${install_path} ]; then
log_cmd "${install_path} not created, override with 'install_nfdump.sh [optional path]'"
exit 1
fi

# detect distribution
# to add other distribution simply create a test case with installation commands

if [ -f /etc/redhat-release ]; then
install_cmd="yum -y install"
echo "installation command: $install_cmd"
log_cmd "installation command: $install_cmd"
elif [ -f /etc/debian_version ]; then
install_cmd="apt-get install -y"
echo "installation command: $install_cmd"
log_cmd "installation command: $install_cmd"
apt-get update
fi

Expand All @@ -21,9 +37,9 @@ fi

for dep in ${dependencies[@]}; do
if type ${dep} >/dev/null 2>&1; then
echo "${dep} found"
log_cmd "${dep} found"
else
echo "installing ${dep}"
log_cmd "installing ${dep}"
${install_cmd} ${dep}
fi
done
Expand All @@ -33,18 +49,18 @@ done
#########################################################

cd nfdump
./configure --enable-sflow
./configure --prefix=${install_path} --enable-sflow
make
make install

if type nfdump >/dev/null 2>&1; then
echo "nfdump found"
if type ${bin}/nfdump >/dev/null 2>&1; then
log_cmd "nfdump found"
else
echo "ERROR: there was a problem with the nfdump installation"
log_cmd "ERROR: there was a problem with the nfdump installation"
exit 1
fi

cd ..

echo "Done !!!!!!!!!!!!!!!!!!!!!!!!"
nfdump -V
log_cmd "Done !!!!!!!!!!!!!!!!!!!!!!!!"
${bin}/nfdump -V