#!/bin/bash
# $Id$
#
# Thomas Dreibholz's PlanetLab/NorNet Script Collection
# Copyright (C) 2005-2019 by Thomas Dreibholz
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Contact: dreibh@iem.uni-due.de


PLANETLAB_KEY=~/.ssh/nornet
PLANETLAB_USER=srl_rserpool
PLANETLAB_COMPILEHOST="akerbrygge.simula.nornet"
PLANETLAB_YUMOPTS=""   # e.g. "--disablerepo=ThirdParty"
PLANETLAB_COMPILEPKGS="autoconf automake libtool gcc gcc-c++ gdb automake autoconf joe libstdc++-devel boost-devel gcc gcc-c++ glib-devel glib2-devel make subversion libpcap bzip2-devel findutils valgrind strace lksctp-tools-devel ImageMagick-devel GeoIP-devel libcurl-devel openssl-devel bison flex subversion git mlocate htop"

DISTDIRNAME="rsplib"
DISTCONFOPT="--disable-kernel-sctp --enable-csp --disable-qt"
DISTPRGS="rootshell rspregistrar rspserver rspterminal calcappclient hsdump attacker cspmonitor"
KILLALLMISC="perftool bzip2 gzip tar yum /usr/bin/python /usr/bin/yum"
DISTSTRIP=0
DISTMISC=""
SUIDPRGS="rootshell rspregistrar rspserver rspterminal calcappclient attacker hsdump"

export OPT_CSP="-cspserver=10.1.1.6:2960 -cspinterval=2500"


# ------ Automatically find out DISTNAME from debian/changelog --------------
CHANGELOG_HEADER="`head -n1 ../../debian/changelog`"
PACKAGE=`echo $CHANGELOG_HEADER | sed -e "s/(.*//" -e "s/ //g"`
PACKAGE_VERSION=`echo $CHANGELOG_HEADER | sed -e "s/[a-Z0-9 ]*(//" -e "s/).*//" -e "s/ //g" -e "s/^[0-9]*://"`
INPUT_DISTRIBUTION=`echo $CHANGELOG_HEADER | sed -e "s/[^)]*)//" -e "s/;.*//g" -e "s/ //g"`
UPSTREAM_VERSION=`echo $CHANGELOG_HEADER | sed -e "s/[a-Z0-9 ]*(//" -e "s/).*//" -e "s/[0-9]*$//" -e "s/ //g" -e "s/^[0-9]*://" -e "s/-[^ ]*$//g"`

DISTNAME="$PACKAGE-$UPSTREAM_VERSION"
# echo "===> DISTNAME=$DISTNAME"
# ---------------------------------------------------------------------------


# ###########################################################################
# ACHTUNG: Der SCTP-über-UDP-Port wird auf $SCTP_OVER_UDP_PORT gesetzt!
# ###########################################################################

SCTP_OVER_UDP_PORT=9899   # 22222   # Default: 9899
SCTPLIB_DIRECTORY="/home/dreibh/src/sctplib1"
SCTPLIB_OPT="--enable-sctp-over-udp --enable-static --disable-shared --enable-maintainer-mode --with-sctp-over-udp-port=$SCTP_OVER_UDP_PORT"
SOCKETAPI_DIRECTORY="/home/dreibh/src/socketapi"
SOCKETAPI_OPT="--enable-sctp-over-udp --enable-static --disable-shared --enable-maintainer-mode"


# Auf dem Server zum Test ausführen
# Ping + 16 MBytes /dev/urandom + SHA1 => 9s auf Athlon 1.3GHz
SERVER_TEST_TIMEOUT=36
SERVER_TEST="ping -W5 -c1 www.planet-lab.org && dd if=/dev/urandom of=test.data count=16000 bs=1000 && sha1sum test.data && rm -f test.data"
