Add support for Debian 6 and 7 to deb build script

This commit is contained in:
Pavel Odintsov 2015-08-24 10:25:43 +03:00
parent e1bb33e50d
commit 8462dd5fb3

View File

@ -20,6 +20,66 @@ PIDFile=/run/fastnetmon.pid
WantedBy=multi-user.target
DOC
my $fastnetmon_systemv_init = <<'DOC';
#!/bin/sh
### BEGIN INIT INFO
# Provides: fastnetmon
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Fast DDoS detection toolkit.
# Description: Fast DDoS detection toolkit with sFLOW/Netflow/netmap/pf_ring support.
### END INIT INFO
# test -r /etc/default/fastnetmon && . /etc/default/fastnetmon
NAME="fastnetmon"
. /lib/lsb/init-functions
PIDFILE="/var/run/${NAME}.pid"
DAEMON="/opt/fastnetmon/fastnetmon"
DAEMON_OPTS="--daemonize"
START_OPTS="--start --background --exec ${DAEMON} -- ${DAEMON_OPTS}"
STOP_OPTS="--stop --pidfile ${PIDFILE}"
STATUS_OPTS="--status --pidfile ${PIDFILE}"
case "$1" in
start)
echo -n "Starting $NAME: "
start-stop-daemon $START_OPTS
echo "$NAME."
;;
stop)
echo -n "Stopping $NAME: "
start-stop-daemon $STOP_OPTS
rm -f $PIDFILE
echo "$NAME."
;;
restart)
$0 stop
sleep 2
$0 start
;;
force-reload)
$0 restart
;;
# no support of status on Debian squeeze
# status)
# start-stop-daemon $STATUS_OPTS
# ;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart}" >&2
exit 1
;;
esac
exit 0
DOC
my $fastnetmon_control_file = <<'DOC';
Package: fastnetmon
Maintainer: Pavel Odintsov <pavel.odintsov@gmail.com>
@ -55,16 +115,21 @@ sub build_deb {
chdir $folder_for_build;
mkdir "$folder_for_build/DEBIAN";
put_text_to_file("$folder_for_build/DEBIAN/control", $fastnetmon_control_file);
put_text_to_file("$folder_for_build/DEBIAN/control", $fastnetmon_control_file);
# Create init files for different versions of Debian like OS
put_text_to_file("$folder_for_build/DEBIAN/fastnetmon.service", $fastnetmon_systemd_unit);
put_text_to_file("$folder_for_build/DEBIAN/fastnetmon.init", $fastnetmon_systemv_init);
put_text_to_file("$folder_for_build/DEBIAN/conffiles", "etc/fastnetmon.conf\n");
my $archive_path = 'http://178.62.227.110/fastnetmon_binary_repository/test_binary_builds/fastnetmon-binary-git-0cfdfd5e2062ad94de24f2f383576ea48e6f3a07-debian-6.0.10-x86_64.tar.gz';
# Create folder for config
mkdir("$folder_for_build/etc");
print `wget https://raw.githubusercontent.com/FastVPSEestiOu/fastnetmon/master/src/fastnetmon.conf -O$folder_for_build/etc/fastnetmon.conf`;
print `wget http://178.62.227.110/fastnetmon_binary_repository/test_binary_builds/fastnetmon-binary-git-28894964690011c5aa076bb92d8536fa4f641757-debian-8.1-x86_64.tar.gz -O$folder_for_build/archive.tar.gz`;
print `$archive_path -O$folder_for_build/archive.tar.gz`;
print `tar -xf $folder_for_build/archive.tar.gz -C $folder_for_build`;
unlink("$folder_for_build/archive.tar.gz");