More work on debian package generation
authorHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Thu, 11 Feb 2016 09:25:54 +0000 (10:25 +0100)
committerHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Thu, 11 Feb 2016 09:25:54 +0000 (10:25 +0100)
13 files changed:
cmake/link_app.cmake
files/create_debian_package.sh
src/olsrd2/debian/changelog [moved from src/olsrd2/debian_changelog with 100% similarity]
src/olsrd2/debian/compat [moved from debian/compat with 100% similarity]
src/olsrd2/debian/control [moved from src/olsrd2/debian_control with 81% similarity]
src/olsrd2/debian/docs/olsrd2_static.1 [new file with mode: 0644]
src/olsrd2/debian/olsrd2.conf [new file with mode: 0644]
src/olsrd2/debian/olsrd2.dirs [new file with mode: 0644]
src/olsrd2/debian/olsrd2.init [new file with mode: 0644]
src/olsrd2/debian/olsrd2.manpages [new file with mode: 0644]
src/olsrd2/debian/olsrd2.service [new file with mode: 0644]
src/olsrd2/debian/rules [moved from debian/rules with 75% similarity]
src/olsrd2/debian/source/format [moved from debian/source/format with 100% similarity]

index 32196b4..1aaf236 100644 (file)
@@ -24,6 +24,12 @@ function (oonf_create_app executable static_plugins optional_static_plugins)
         message (STATUS "Static plugins for ${executable} app:")
     ENDIF(VERBOSE)
 
+    IF(OONF_NEED_ROOT)
+        SET(DESTINATION sbin)
+    ELSE(OONF_NEED_ROOT)
+        SET(DESTINATION bin)
+    ENDIF(OONF_NEED_ROOT)
+
     # standard static linked targets
     SET(OBJECT_TARGETS )
     SET(EXTERNAL_LIBRARIES )
@@ -97,10 +103,10 @@ function (oonf_create_app executable static_plugins optional_static_plugins)
     
     # create install targets
     INSTALL (TARGETS ${executable}_dynamic RUNTIME 
-                                           DESTINATION bin 
+                                           DESTINATION ${DESTINATION}
                                            COMPONENT component_${executable}_dynamic)
     INSTALL (TARGETS ${executable}_static  RUNTIME
-                                           DESTINATION bin 
+                                           DESTINATION ${DESTINATION}
                                            COMPONENT component_${executable}_static)
 
     # add custom install targets
index 12634ad..e4c1526 100755 (executable)
@@ -41,12 +41,18 @@ then
     exit 1
 fi
 
-if [ ! -f ${SOURCE}/src/${TARGET}/debian_changelog ]
+if [ ! -f ${SOURCE}/src/${TARGET}/debian/changelog ]
 then
     echo "Could not find target '${TARGET}' debian changelog"
     exit 1
 fi
 
+if [ ! -f ${SOURCE}/src/${TARGET}/debian/control ]
+then
+    echo "Could not find target '${TARGET}' debian control file"
+    exit 1
+fi
+
 # create clean build directory
 if [ -d ${BUILDDIR} ]
 then
@@ -74,8 +80,7 @@ tar xf ${TARBALL}
 # build debian directory from template
 cd ${TARPREFIX}
 
-cp ${SOURCE}/src/${TARGET}/debian_changelog ./debian/changelog
-cp ${SOURCE}/src/${TARGET}/debian_control ./debian/control
+cp -r ${SOURCE}/src/${TARGET}/debian ./
 cp ${SOURCE}/files/default_licence.txt ./debian/copyright
 
 # adapt changelog template
similarity index 100%
rename from debian/compat
rename to src/olsrd2/debian/compat
similarity index 81%
rename from src/olsrd2/debian_control
rename to src/olsrd2/debian/control
index 0e93020..acbdbf8 100644 (file)
@@ -1,9 +1,9 @@
 Source: olsrd2
 Maintainer: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
-Section: misc
+Section: net
 Priority: optional
 Standards-Version: 3.9.6
-Build-Depends: debhelper (>= 9)
+Build-Depends: debhelper (>= 9), dh-systemd (>= 1.5)
 
 Package: olsrd2
 Architecture: any
diff --git a/src/olsrd2/debian/docs/olsrd2_static.1 b/src/olsrd2/debian/docs/olsrd2_static.1
new file mode 100644 (file)
index 0000000..bf7e20f
--- /dev/null
@@ -0,0 +1,88 @@
+.TH olsrd2_static 1
+.SH NAME
+olsrd2_static \- OLSRv2 routing agent of OLSR.org
+.SH SYNOPSIS
+.B olsrd2_static [ -h, --help ] [ -v, --version ] [ -p, --plugin=
+.I shared-library
+.B ] [ -q, --quit ] [ --schema ] [ --schema=
+.I spec
+.B ] [ -L, --load=
+.I SOURCE
+.B ] [ -S, --save=
+.I TARGET
+.B ] [ -s, --set=
+.I spec
+.B ] [ -r, --remove=
+.I spec
+.B ] [ -g, --get=
+.I spec
+.B ] [ --Xearlydebug ] [ --Xignoreunknown ]
+.I interfaces
+.B ...
+.SH DESCRIPTION
+.B olsrd2_static
+runs the OLSRv2 (RFC7181 and RFC6130) routing protocol on one or multiple
+interfaces. It builds up a routing table to make all other OLSRd2 instances
+and their attached networks reachable through IP forwarding.
+.SH OPTIONS
+.IP "-h, --help"
+Display this help file
+.IP "-v, --version"
+Display the version string and the included static plugins
+.IP "-p, --plugin=shared-library"
+Load a shared library as a plugin
+.IP "-q, --quit"
+Load plugins and validate configuration, then end
+.IP "--schema"
+Display all allowed section types of configuration
+.IP "--schema=all"
+Display all allowed entries in all sections
+.IP "--schema=section_type"
+Display all allowed entries of one configuration section
+.IP "--schema=section_type.key"
+Display help text for configuration entry
+.IP "-l, --load=SOURCE"
+Load configuration from a SOURCE
+.IP "-S, --save=TARGET"
+Save configuration to a TARGET
+.IP "-s, --set=section_type."
+Add an unnamed section to the configuration
+.IP "-s, --set=section_type.key=value"
+Add a key/value pair to an unnamed section
+.IP "-s, --set=section_type[name]."
+Add a named section to the configuration
+.IP "-s, --set=section_type[name].key=value"
+Add a key/value pair to a named section
+.IP "-r, --remove=section_type."
+Remove all sections of a certain type
+.IP "-r, --remove=section_type.key"
+Remove a key in an unnamed section
+.IP "-r, --remove=section_type[name]."
+Remove a named section
+.IP "-r, --remove=section_type[name].key"
+Remove a key in a named section
+.IP "-g, --get"
+Show all section types in database
+.IP "-g, --get=section_type."
+Show all named sections of a certain type
+.IP "-g, --get=section_type.key"
+Show the value(s) of a key in an unnamed section
+.IP "-g, --get=section_type[name].key"
+Show the value(s) of a key in a named section
+.IP "--Xearlydebug"
+Activate debugging output before configuration could be parsed
+.IP "--Xignoreunknown"
+Ignore unknown command line arguments
+.SH DESCRIPTION
+See
+.I
+http://www.olsr.org
+for a more detailed description of
+.B olsrd2
+and its components.
+.SH FILES
+.I /etc/olsrd2/olsrd2.conf
+.RS
+The system wide configuration file.
+.SH AUTHOR
+Henning Rogge <henning.rogge@fkie.fraunhofer.de>
diff --git a/src/olsrd2/debian/olsrd2.conf b/src/olsrd2/debian/olsrd2.conf
new file mode 100644 (file)
index 0000000..386b664
--- /dev/null
@@ -0,0 +1,6 @@
+# define the interfaces used for olsrd2 mesh
+#
+# see http://www.olsr.org/mediawiki/index.php/OLSR_network_deployments
+# for help with first deployments
+
+# [interface=<if>]
diff --git a/src/olsrd2/debian/olsrd2.dirs b/src/olsrd2/debian/olsrd2.dirs
new file mode 100644 (file)
index 0000000..8d58f80
--- /dev/null
@@ -0,0 +1,2 @@
+usr/sbin
+etc/olsrd2
diff --git a/src/olsrd2/debian/olsrd2.init b/src/olsrd2/debian/olsrd2.init
new file mode 100644 (file)
index 0000000..dae74aa
--- /dev/null
@@ -0,0 +1,81 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides:          olsrd2
+# Required-Start:    $network $remote_fs $syslog
+# Required-Stop:     $network $remote_fs $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start the OLSRd2 mesh daemon
+# Description:       System mode startup script for
+#                    the olsr.org OLSRv2 mesh daemon.
+### END INIT INFO
+
+#   Based on skeleton script written by Miquel van Smoorenburg <miquels@cistron.nl>.
+#   Modified for Debian
+#   by Ian Murdock <imurdock@gnu.ai.mit.edu>.
+#   Modified for olsrd
+#   by Holger Levsen <debian@layer-acht.org>
+#   Modified for olsrd2
+#   by Henning Rogge <hrogge@gmail.com>
+#
+# Version:  21-Dec-2006
+# modified: 01-Aug-2007
+#           31-Jun-2008
+#           30-May-2009
+#           02-Oct-2012
+#           11-Feb-2016
+
+. /lib/lsb/init-functions
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/sbin/olsrd2_static
+CONFIG=/etc/olsrd2/olsrd2.conf
+NAME=olsrd2
+DESC=olsrd2
+
+PID_FILE=/var/run/$NAME.pid
+
+test -x $DAEMON || exit 0
+
+set -e
+
+case "$1" in
+  start)
+  if [ "$(pidof $NAME)" != "" ] ; then
+    echo "$NAME already running, doing nothing."
+    exit 0
+  fi
+  echo -n "Starting $DESC: "
+  start-stop-daemon --start --quiet --exec $DAEMON --pidfile $PID_FILE -- --load $CONFIG
+  # sleep til olsrd has been started
+  while ! pidof $NAME > /dev/null ; do
+    sleep 1
+  done
+  echo "$NAME."
+  echo $(pidof $NAME) > $PID_FILE
+  ;;
+  stop)
+  pidof $NAME || exit 0
+  echo -n "Stopping $DESC: "
+  start-stop-daemon --stop  --quiet --exec $DAEMON --pidfile $PID_FILE
+  rm -f $PID_FILE
+  echo "$NAME."
+  ;;
+  restart|force-reload)
+  echo -n "Restarting $DESC: "
+  if [ "$(pidof $NAME)" == "" ] ; then
+    echo "$NAME not running, starting service."
+    $0 start
+    exit 0
+  fi
+  echo -n "Restarting $DESC: "
+  kill -HUP `cat $PID_FILE`
+  ;;
+  *)
+  N=/etc/init.d/$NAME
+  echo "Usage: $N {start|stop|restart}" >&2
+  exit 1
+  ;;
+esac
+
+exit 0
diff --git a/src/olsrd2/debian/olsrd2.manpages b/src/olsrd2/debian/olsrd2.manpages
new file mode 100644 (file)
index 0000000..814fcef
--- /dev/null
@@ -0,0 +1 @@
+debian/docs/olsrd2_static.1
diff --git a/src/olsrd2/debian/olsrd2.service b/src/olsrd2/debian/olsrd2.service
new file mode 100644 (file)
index 0000000..6d43f19
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=OLSRd2 Routing agent
+Documentation=http://www.olsr.org/
+Requires=networking.service
+
+[Service]
+ExecStart=/usr/sbin/olsrd2_static --load=/etc/olsrd2/olsrd2.conf
+
+[Install]
+WantedBy=multi-user.target
similarity index 75%
rename from debian/rules
rename to src/olsrd2/debian/rules
index 643487f..a9d5a13 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/make -f
 %:
-       dh $@
+       dh $@ --with=systemd
 
 override_dh_auto_configure:
        cmake   -D CMAKE_INSTALL_PREFIX=/usr \
@@ -13,3 +13,4 @@ override_dh_auto_configure:
 
 override_dh_auto_install:
        make -j1 install_TARGETNAME_static DESTDIR=INSTALLDESTDIR AM_UPDATE_INFO_DIR=no
+       install -p -m0644 $(CURDIR)/debian/olsrd2.conf $(CURDIR)/debian/olsrd2/etc/olsrd2/olsrd2.conf