Build scripts for debian packages added
authorAlex Kirhenshtein <alk@netxms.org>
Wed, 29 Apr 2015 13:15:06 +0000 (16:15 +0300)
committerAlex Kirhenshtein <alk@netxms.org>
Wed, 29 Apr 2015 13:15:06 +0000 (16:15 +0300)
35 files changed:
Makefile.am
configure.ac
debian/Makefile.am [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/docs [new file with mode: 0644]
debian/netxms-agent.install [new file with mode: 0644]
debian/netxms-agent.nxagentd.init [new file with mode: 0644]
debian/netxms-agent.postinst [new file with mode: 0644]
debian/netxms-agent.postrm [new file with mode: 0644]
debian/netxms-base.dirs [new file with mode: 0644]
debian/netxms-base.install [new file with mode: 0644]
debian/netxms-base.postrm [new file with mode: 0644]
debian/netxms-base.symbols [new file with mode: 0644]
debian/netxms-client.install [new file with mode: 0644]
debian/netxms-dbdrv-mysql.install [new file with mode: 0644]
debian/netxms-dbdrv-odbc.install [new file with mode: 0644]
debian/netxms-dbdrv-oracle.install [new file with mode: 0644]
debian/netxms-dbdrv-pgsql.install [new file with mode: 0644]
debian/netxms-dbdrv-sqlite3.install [new file with mode: 0644]
debian/netxms-server.install [new file with mode: 0644]
debian/netxms-server.netxmsd.init [new file with mode: 0644]
debian/netxms-server.postinst [new file with mode: 0644]
debian/netxms-server.postrm [new file with mode: 0644]
debian/patches/01_fix-agent-data-dir.diff [new file with mode: 0644]
debian/patches/02_fix-server-data-dir.diff [new file with mode: 0644]
debian/patches/03_fix-server-data-install-dir.diff [new file with mode: 0644]
debian/patches/Makefile.am [new file with mode: 0644]
debian/patches/series [new file with mode: 0644]
debian/rules [new file with mode: 0755]
debian/source/Makefile.am [new file with mode: 0644]
debian/source/format [new file with mode: 0644]
debian/source/options [new file with mode: 0644]

index 0f26d05..d43a3bc 100644 (file)
@@ -10,7 +10,7 @@
 
 ACLOCAL_AMFLAGS = -I m4
 EXTRA_DIST = reconf configure netxms.sln README.HPUX
-SUBDIRS = m4 contrib src doc tools
+SUBDIRS = m4 contrib src doc tools debian
 SUBDIRS += @TOP_LEVEL_MODULES@
 
 install-exec-hook:
index 206be06..bfce4f3 100644 (file)
@@ -2747,6 +2747,9 @@ AC_CONFIG_FILES([
        contrib/startup/suse/Makefile
        contrib/startup/ubuntu/Makefile
        contrib/startup/solaris/Makefile
+       debian/Makefile
+       debian/patches/Makefile
+       debian/source/Makefile
        doc/Makefile
        doc/internal/Makefile
        doc/manuals/Makefile
diff --git a/debian/Makefile.am b/debian/Makefile.am
new file mode 100644 (file)
index 0000000..e645ba9
--- /dev/null
@@ -0,0 +1,37 @@
+# Copyright (C) 2004 NetXMS Team <bugs@netxms.org>
+#  
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without 
+# modifications, as long as this notice is preserved.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+SUBDIRS = patches source
+
+EXTRA_DIST=changelog \
+           compat \
+           control \
+           copyright \
+           docs \
+           Makefile.am \
+           netxms-agent.install \
+           netxms-agent.nxagentd.init \
+           netxms-agent.postinst \
+           netxms-agent.postrm \
+           netxms-base.dirs \
+           netxms-base.install \
+           netxms-base.postrm \
+           netxms-base.symbols \
+           netxms-client.install \
+           netxms-dbdrv-mysql.install \
+           netxms-dbdrv-odbc.install \
+           netxms-dbdrv-oracle.install \
+           netxms-dbdrv-pgsql.install \
+           netxms-dbdrv-sqlite3.install \
+           netxms-server.install \
+           netxms-server.netxmsd.init \
+           netxms-server.postinst \
+           netxms-server.postrm \
+           rules
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..60eb7df
--- /dev/null
@@ -0,0 +1,18 @@
+netxms (2.0-M4-1) unstable; urgency=low
+
+  * MEGATEC protocol support in UPS subagent
+  * Template hierarchy preserved during export/import
+  * Script export/import
+  * Fixed broken WoL functionality
+  * Fixed broken PING subagent
+  * Fixed database upgrade issues on MS SQL
+  * IPv6 support in PING subagent
+  * Fixed issues: #655, #657, #804
+
+ -- Alex Kirhenshtein <alk@netxms.org>  Wed, 29 Apr 2015 16:12:46 +0300
+
+netxms (2.0-M3-1) unstable; urgency=low
+
+  * Initial release
+
+ -- Alex Kirhenshtein <alk@netxms.org>  Mon, 15 Apr 2015 02:43:51 +0300
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..ec63514
--- /dev/null
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..08a915c
--- /dev/null
@@ -0,0 +1,102 @@
+Source: netxms
+Priority: extra
+Maintainer: Alex Kirhenshtein <alk@netxms.org>
+Build-Depends:
+ debhelper (>= 9.0.0),
+ dh-autoreconf,
+ debconf,
+ libssl-dev,
+ zlib1g-dev,
+ libexpat1-dev,
+ libsensors4-dev,
+ libjansson-dev,
+ libreadline-dev,
+ libsqlite3-dev,
+ libmysqlclient-dev,
+ libcurl4-openssl-dev,
+ libpq-dev (>= 9.1),
+ libldap2-dev,
+ libaio1,
+ unixodbc-dev
+Standards-Version: 4.9.3
+Section: admin
+Homepage: http://www.netxms.org/
+
+Package: netxms-base
+Architecture: any
+Multi-Arch: same
+Pre-Depends: ${misc:Pre-Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: NetXMS core libraries
+ <insert long description, indented with spaces>
+
+Package: netxms-agent
+Architecture: any
+Multi-Arch: same
+Depends: netxms-base (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Description: NetXMS agent
+ <insert long description, indented with spaces>
+
+Package: netxms-client
+Architecture: any
+Multi-Arch: same
+Depends: netxms-base (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Description: NetXMS command line client tools
+ <insert long description, indented with spaces>
+
+Package: netxms-server
+Architecture: any
+Multi-Arch: same
+Depends:
+ netxms-base (= ${binary:Version}),
+ netxms-dbdrv-sqlite3 (= ${binary:Version}) |
+ netxms-dbdrv-pgsql (= ${binary:Version}) |
+ netxms-dbdrv-mysql (= ${binary:Version}),
+ ${shlibs:Depends}, ${misc:Depends}
+Suggests: netxms-dbdrv-pgsql, netxms-dbdrv-mysql, netxms-dbdrv-oracle
+Description: meta package
+ <insert long description, indented with spaces>
+
+Package: netxms-dbdrv-sqlite3
+Architecture: any
+Multi-Arch: same
+Pre-Depends: ${misc:Pre-Depends}
+Depends: netxms-base (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Description: SQLite3 driver for netxms-server
+ <insert long description, indented with spaces>
+
+Package: netxms-dbdrv-pgsql
+Architecture: any
+Multi-Arch: same
+Pre-Depends: ${misc:Pre-Depends}
+Depends: netxms-base (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Suggests: postgresql-9.1
+Description: PostgreSQL driver for netxms-server
+ <insert long description, indented with spaces>
+
+Package: netxms-dbdrv-mysql
+Architecture: any
+Multi-Arch: same
+Pre-Depends: ${misc:Pre-Depends}
+Depends: netxms-base (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Suggests: mysql-server
+Description: MySQL driver for netxms-server
+ <insert long description, indented with spaces>
+
+Package: netxms-dbdrv-odbc
+Architecture: any
+Multi-Arch: same
+Pre-Depends: ${misc:Pre-Depends}
+Depends: netxms-base (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Suggests: mysql-server
+Description: unixODBC driver for netxms-server
+ <insert long description, indented with spaces>
+
+Package: netxms-dbdrv-oracle
+Architecture: any
+Multi-Arch: same
+Pre-Depends: ${misc:Pre-Depends}
+Depends: netxms-base (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Suggests: mysql-server
+Description: Oracle driver for netxms-server
+ <insert long description, indented with spaces>
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..8308edd
--- /dev/null
@@ -0,0 +1,22 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: netxms
+Source: http://www.netxms.org/
+
+Files: *
+Copyright: 2015 Alex Kirhenshtein <alk@netxms.org>
+License: GPL-2+
+ This package 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 2 of the License, or
+ (at your option) any later version.
+ .
+ This package 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/>
+ .
+ On Debian systems, the complete text of the GNU General
+ Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
diff --git a/debian/docs b/debian/docs
new file mode 100644 (file)
index 0000000..50bd824
--- /dev/null
@@ -0,0 +1,2 @@
+NEWS
+README
diff --git a/debian/netxms-agent.install b/debian/netxms-agent.install
new file mode 100644 (file)
index 0000000..3f217c8
--- /dev/null
@@ -0,0 +1,6 @@
+usr/bin/nxagentd
+usr/bin/nxappget
+usr/bin/nxapush
+usr/lib/*/libappagent.so.*
+usr/lib/*/libnxlp.so.*
+usr/lib/*/netxms/*.nsm
diff --git a/debian/netxms-agent.nxagentd.init b/debian/netxms-agent.nxagentd.init
new file mode 100644 (file)
index 0000000..1181f29
--- /dev/null
@@ -0,0 +1,150 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          nxagentd
+# Required-Start:    $network $local_fs 
+# Required-Stop:
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: NetXMS agent
+# Description:       NetXMS native agent which provide system information to NetXMS server
+### END INIT INFO
+
+# Author: Alex Kirhenshtein <alk@netxms.org>
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="NetXMS agent"
+NAME=nxagentd
+DAEMON=/usr/bin/nxagentd
+DAEMON_ARGS="-d"
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Exit if the package is not installed
+[ -x $DAEMON ] || exit 0
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+       # Return
+       #   0 if daemon has been started
+       #   1 if daemon was already running
+       #   2 if daemon could not be started
+       start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
+               || return 1
+       start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
+               $DAEMON_ARGS \
+               || return 2
+       # Add code here, if necessary, that waits for the process to be ready
+       # to handle requests from services started subsequently which depend
+       # on this one.  As a last resort, sleep for some time.
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+       # Return
+       #   0 if daemon has been stopped
+       #   1 if daemon was already stopped
+       #   2 if daemon could not be stopped
+       #   other if a failure occurred
+       start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
+       RETVAL="$?"
+       [ "$RETVAL" = 2 ] && return 2
+       # Wait for children to finish too if this is a daemon that forks
+       # and if the daemon is only ever run from this initscript.
+       # If the above conditions are not satisfied then add some other code
+       # that waits for the process to drop all resources that could be
+       # needed by services started subsequently.  A last resort is to
+       # sleep for some time.
+       start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
+       [ "$?" = 2 ] && return 2
+       # Many daemons don't delete their pidfiles when they exit.
+       rm -f $PIDFILE
+       return "$RETVAL"
+}
+
+#
+# Function that sends a SIGHUP to the daemon/service
+#
+do_reload() {
+       #
+       # If the daemon can reload its configuration without
+       # restarting (for example, when it is sent a SIGHUP),
+       # then implement that here.
+       #
+       start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
+       return 0
+}
+
+case "$1" in
+  start)
+    [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME"
+    do_start
+    case "$?" in
+               0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+               2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+       esac
+  ;;
+  stop)
+       [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+       do_stop
+       case "$?" in
+               0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+               2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+       esac
+       ;;
+  status)
+       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+       ;;
+  #reload|force-reload)
+       #
+       # If do_reload() is not implemented then leave this commented out
+       # and leave 'force-reload' as an alias for 'restart'.
+       #
+       #log_daemon_msg "Reloading $DESC" "$NAME"
+       #do_reload
+       #log_end_msg $?
+       #;;
+  restart|force-reload)
+       #
+       # If the "reload" option is implemented then remove the
+       # 'force-reload' alias
+       #
+       log_daemon_msg "Restarting $DESC" "$NAME"
+       do_stop
+       case "$?" in
+         0|1)
+               do_start
+               case "$?" in
+                       0) log_end_msg 0 ;;
+                       1) log_end_msg 1 ;; # Old process is still running
+                       *) log_end_msg 1 ;; # Failed to start
+               esac
+               ;;
+         *)
+               # Failed to stop
+               log_end_msg 1
+               ;;
+       esac
+       ;;
+  *)
+       echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+       exit 3
+       ;;
+esac
+
+:
diff --git a/debian/netxms-agent.postinst b/debian/netxms-agent.postinst
new file mode 100644 (file)
index 0000000..5e4f7d6
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+set -e
+
+CONFIG="/etc/nxagentd.conf"
+
+case "$1" in
+    configure)
+        if [ ! -f $CONFIG ]; then
+            TARGET=$CONFIG
+        else
+            TARGET=${CONFIG}.dist
+        fi
+
+        cat > $TARGET <<__END
+# Log File
+LogFile=/var/log/nxagentd
+
+# IP white list, can contain multiple records separated by comma.
+# CIDR notation supported for subnets.
+MasterServers=127.0.0.0/8
+__END
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/netxms-agent.postrm b/debian/netxms-agent.postrm
new file mode 100644 (file)
index 0000000..1596497
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+    purge)
+        rm -rf /etc/nxagentd.conf /etc/nxagentd.conf.dist /etc/nxagentd.conf.d
+    ;;
+
+    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/netxms-base.dirs b/debian/netxms-base.dirs
new file mode 100644 (file)
index 0000000..daebc1b
--- /dev/null
@@ -0,0 +1 @@
+var/lib/netxms
diff --git a/debian/netxms-base.install b/debian/netxms-base.install
new file mode 100644 (file)
index 0000000..19e6194
--- /dev/null
@@ -0,0 +1,7 @@
+usr/bin/nxencpasswd
+usr/lib/*/libnetxms.so.*
+usr/lib/*/libnxclient.so.*
+usr/lib/*/libnxdb.so.*
+usr/lib/*/libnxsnmp.so.*
+usr/lib/*/libnxsqlite.so.*
+usr/lib/*/libnxtre.so.*
diff --git a/debian/netxms-base.postrm b/debian/netxms-base.postrm
new file mode 100644 (file)
index 0000000..2c2df03
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+    purge)
+        rm -f /var/lib/netxms/registry.dat
+    ;;
+
+    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/netxms-base.symbols b/debian/netxms-base.symbols
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/debian/netxms-client.install b/debian/netxms-client.install
new file mode 100644 (file)
index 0000000..7d02182
--- /dev/null
@@ -0,0 +1,4 @@
+usr/bin/nxpush
+usr/bin/nxevent
+usr/bin/nxalarm
+usr/bin/nxsms
diff --git a/debian/netxms-dbdrv-mysql.install b/debian/netxms-dbdrv-mysql.install
new file mode 100644 (file)
index 0000000..ce68ff5
--- /dev/null
@@ -0,0 +1 @@
+usr/lib/*/netxms/dbdrv/mysql.ddr
diff --git a/debian/netxms-dbdrv-odbc.install b/debian/netxms-dbdrv-odbc.install
new file mode 100644 (file)
index 0000000..ae7430c
--- /dev/null
@@ -0,0 +1 @@
+usr/lib/*/netxms/dbdrv/odbc.ddr
diff --git a/debian/netxms-dbdrv-oracle.install b/debian/netxms-dbdrv-oracle.install
new file mode 100644 (file)
index 0000000..59df5fe
--- /dev/null
@@ -0,0 +1 @@
+usr/lib/*/netxms/dbdrv/oracle.ddr
diff --git a/debian/netxms-dbdrv-pgsql.install b/debian/netxms-dbdrv-pgsql.install
new file mode 100644 (file)
index 0000000..c151abe
--- /dev/null
@@ -0,0 +1 @@
+usr/lib/*/netxms/dbdrv/pgsql.ddr
diff --git a/debian/netxms-dbdrv-sqlite3.install b/debian/netxms-dbdrv-sqlite3.install
new file mode 100644 (file)
index 0000000..36006c5
--- /dev/null
@@ -0,0 +1 @@
+usr/lib/*/netxms/dbdrv/sqlite.ddr
diff --git a/debian/netxms-server.install b/debian/netxms-server.install
new file mode 100644 (file)
index 0000000..859b9d2
--- /dev/null
@@ -0,0 +1,22 @@
+usr/bin/netxmsd
+usr/bin/nxadm
+usr/bin/nxap
+usr/bin/nxdbmgr
+usr/bin/nxget
+usr/bin/nxmibc
+usr/bin/nxscript
+usr/bin/nxsnmp*
+usr/bin/nxupload
+usr/lib/*/netxms/jira.hdlink
+usr/lib/*/libavaya-ers.so
+usr/lib/*/libcisco.so
+usr/lib/*/libnxcore.so*
+usr/lib/*/libnxmap.so*
+usr/lib/*/libnxsd.so*
+usr/lib/*/libnxsl.so*
+usr/lib/*/libnxsms_*.so*
+usr/lib/*/libnxsrv.so*
+usr/lib/*/libstrophe.so*
+usr/lib/*/netxms/ndd/*
+usr/share/netxms/*
+var/lib/netxms/*
diff --git a/debian/netxms-server.netxmsd.init b/debian/netxms-server.netxmsd.init
new file mode 100644 (file)
index 0000000..783a456
--- /dev/null
@@ -0,0 +1,152 @@
+#!/bin/sh
+# vim: syntax=sh
+### BEGIN INIT INFO
+# Provides:          netxms-server
+# Required-Start:    $network $local_fs nxagentd
+# Required-Stop:
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: NetXMS server
+# Description:       Network monitoring daemon, which collect and process metrics
+#                    from native and SNMP agents.
+### END INIT INFO
+
+# Author: Alex Kirhenshtein <alk@netxms.org>
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="NetXMS server"
+NAME=netxmsd
+DAEMON=/usr/bin/netxmsd
+DAEMON_ARGS="-d"
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Exit if the package is not installed
+[ -x $DAEMON ] || exit 0
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+       # Return
+       #   0 if daemon has been started
+       #   1 if daemon was already running
+       #   2 if daemon could not be started
+       start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
+               || return 1
+       start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
+               $DAEMON_ARGS \
+               || return 2
+       # Add code here, if necessary, that waits for the process to be ready
+       # to handle requests from services started subsequently which depend
+       # on this one.  As a last resort, sleep for some time.
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+       # Return
+       #   0 if daemon has been stopped
+       #   1 if daemon was already stopped
+       #   2 if daemon could not be stopped
+       #   other if a failure occurred
+       start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
+       RETVAL="$?"
+       [ "$RETVAL" = 2 ] && return 2
+       # Wait for children to finish too if this is a daemon that forks
+       # and if the daemon is only ever run from this initscript.
+       # If the above conditions are not satisfied then add some other code
+       # that waits for the process to drop all resources that could be
+       # needed by services started subsequently.  A last resort is to
+       # sleep for some time.
+       start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
+       [ "$?" = 2 ] && return 2
+       # Many daemons don't delete their pidfiles when they exit.
+       rm -f $PIDFILE
+       return "$RETVAL"
+}
+
+#
+# Function that sends a SIGHUP to the daemon/service
+#
+do_reload() {
+       #
+       # If the daemon can reload its configuration without
+       # restarting (for example, when it is sent a SIGHUP),
+       # then implement that here.
+       #
+       start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
+       return 0
+}
+
+case "$1" in
+  start)
+    [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME"
+    do_start
+    case "$?" in
+               0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+               2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+       esac
+  ;;
+  stop)
+       [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+       do_stop
+       case "$?" in
+               0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+               2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+       esac
+       ;;
+  status)
+       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+       ;;
+  #reload|force-reload)
+       #
+       # If do_reload() is not implemented then leave this commented out
+       # and leave 'force-reload' as an alias for 'restart'.
+       #
+       #log_daemon_msg "Reloading $DESC" "$NAME"
+       #do_reload
+       #log_end_msg $?
+       #;;
+  restart|force-reload)
+       #
+       # If the "reload" option is implemented then remove the
+       # 'force-reload' alias
+       #
+       log_daemon_msg "Restarting $DESC" "$NAME"
+       do_stop
+       case "$?" in
+         0|1)
+               do_start
+               case "$?" in
+                       0) log_end_msg 0 ;;
+                       1) log_end_msg 1 ;; # Old process is still running
+                       *) log_end_msg 1 ;; # Failed to start
+               esac
+               ;;
+         *)
+               # Failed to stop
+               log_end_msg 1
+               ;;
+       esac
+       ;;
+  *)
+       echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+       exit 3
+       ;;
+esac
+
+:
diff --git a/debian/netxms-server.postinst b/debian/netxms-server.postinst
new file mode 100644 (file)
index 0000000..5ed762b
--- /dev/null
@@ -0,0 +1,102 @@
+#!/bin/sh
+
+set -e
+
+CONFIG="/etc/netxmsd.conf"
+
+case "$1" in
+    configure)
+        if [ ! -f $CONFIG ]; then
+            TARGET=$CONFIG
+
+        cat <<__END
+NetXMS server is installed but currently stopped.
+
+Additional steps required:
+
+1. Edit default configuration file ($CONFIG)
+
+2. Load database schema (replace DBTYPE with proper name):
+
+   nxdbmgr init /usr/share/netxms/sql/dbinit_DBTYPE.sql
+
+   Example:
+
+      SQLite:
+        nxdbmgr init /usr/share/netxms/sql/dbinit_sqlite.sql
+
+      PostgreSQL:
+        nxdbmgr init /usr/share/netxms/sql/dbinit_pgsql.sql
+
+      MySQL:
+        nxdbmgr init /usr/share/netxms/sql/dbinit_pgsql.sql
+
+      Oracle:
+        nxdbmgr init /usr/share/netxms/sql/dbinit_oracle.sql
+
+then start daemon with command:
+
+   service netxmsd start
+__END
+        else
+            TARGET=${CONFIG}.dist
+        fi
+
+        cat > $TARGET <<__END
+## Logging
+# Log file name
+LogFile=/var/log/netxmsd
+
+# Increase logging verbosity, 0 (only errors) to 9 (verbose debug)
+#DebugLevel=3
+
+## Database configuration.
+## Uncomment and setup ONE section.
+
+## Option #1 - SQLite (for test installations only):
+#DBDriver=sqlite.ddr
+#DBName=/var/lib/netxms/netxms.db
+
+## Option #2 - PostgreSQL (recommended):
+#DBDriver=pgsql.ddr
+#DBServer=127.0.0.1
+#DBName=netxms
+#DBLogin=netxms
+#DBPassword=netxms
+
+## Option #3 - MySQL:
+#DBDriver=mysql.ddr
+#DBServer=127.0.0.1
+#DBName=netxms
+#DBLogin=netxms
+#DBPassword=netxms
+
+## Option #4 - Oracle:
+#DBDriver=oracle.ddr
+#DBServer=//127.0.0.1:1521/ORCL # Instant Client connection string or SID
+#DBLogin=netxms
+#DBPassword=netxms
+
+## Option #5 - unixODBC/FreeTDS:
+#DBDriver=odbc.ddr
+#DBServer=NETXMS_DSN
+#DBLogin=netxms
+#DBPassword=netxms
+__END
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/netxms-server.postrm b/debian/netxms-server.postrm
new file mode 100644 (file)
index 0000000..e333e66
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+    purge)
+        rm -f /etc/netxmsd.conf /etc/netxmsd.conf.dist
+    ;;
+
+    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/patches/01_fix-agent-data-dir.diff b/debian/patches/01_fix-agent-data-dir.diff
new file mode 100644 (file)
index 0000000..a34c6b3
--- /dev/null
@@ -0,0 +1,12 @@
+Default data directory changed to /var/lib/netxms
+--- a/src/agent/core/nxagentd.h
++++ b/src/agent/core/nxagentd.h
+@@ -80,7 +80,7 @@
+ #define AGENT_DEFAULT_CONFIG_D   _T("{search}")
+ #define AGENT_DEFAULT_LOG        _T("/var/log/nxagentd")
+ #define AGENT_DEFAULT_FILE_STORE _T("/tmp")
+-#define AGENT_DEFAULT_DATA_DIR   _T("{default}")
++#define AGENT_DEFAULT_DATA_DIR   _T("/var/lib/netxms")
+ #endif
+ #define REGISTRY_FILE_NAME       _T("registry.dat")
diff --git a/debian/patches/02_fix-server-data-dir.diff b/debian/patches/02_fix-server-data-dir.diff
new file mode 100644 (file)
index 0000000..249187d
--- /dev/null
@@ -0,0 +1,12 @@
+Default data directory changed to /var/lib/netxms
+--- a/src/server/include/nxsrvapi.h
++++ b/src/server/include/nxsrvapi.h
+@@ -90,7 +90,7 @@
+ #endif
+ #define DEFAULT_LOG_FILE      DATADIR _T("/log/netxmsd.log")
+-#define DEFAULT_DATA_DIR      DATADIR
++#define DEFAULT_DATA_DIR      _T("/var/lib/netxms")
+ #define DEFAULT_LIBDIR        PKGLIBDIR
+ #define DEFAULT_DUMP_DIR      _T("/")
diff --git a/debian/patches/03_fix-server-data-install-dir.diff b/debian/patches/03_fix-server-data-install-dir.diff
new file mode 100644 (file)
index 0000000..cc92255
--- /dev/null
@@ -0,0 +1,42 @@
+User data moved from /usr/share/netxms to /var/lib/netxms
+--- a/contrib/backgrounds/Makefile.am
++++ b/contrib/backgrounds/Makefile.am
+@@ -8,7 +8,7 @@
+ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+-bkdir=$(pkgdatadir)/backgrounds
++bkdir=$(localstatedir)/lib/netxms/backgrounds
+ bk_DATA = .keep
+--- a/contrib/mibs/Makefile.am
++++ b/contrib/mibs/Makefile.am
+@@ -8,7 +8,7 @@
+ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+-mibsdir=$(pkgdatadir)/mibs
++mibsdir=$(localstatedir)/lib/netxms/mibs
+ mibs_DATA = \
+       A3COM-HUAWEI-COMMON-MIB.txt \
+--- a/images/Makefile.am
++++ b/images/Makefile.am
+@@ -8,7 +8,7 @@
+ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+-imagesdir=$(pkgdatadir)/images
++imagesdir=$(localstatedir)/lib/netxms/images
+ images_DATA = \
+       092e4b35-4e7c-42df-b9b7-d5805bfac64e \
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -15,4 +15,4 @@
+ install-exec-hook:
+       if test "x@BUILD_SDK@" = "xyes"; then cp config.h $(DESTDIR)$(includedir); mkdir -p $(DESTDIR)$(pkgdatadir)/sdk; cp libtool $(DESTDIR)$(pkgdatadir)/sdk; cp config/install-sh $(DESTDIR)$(pkgdatadir)/sdk; fi
+-      if test "x@BUILD_SERVER@" = "xyes"; then LD_LIBRARY_PATH="$(DESTDIR)$(libdir):${LD_LIBRARY_PATH}" $(DESTDIR)$(bindir)/nxmibc -d $(DESTDIR)$(pkgdatadir)/mibs -o $(DESTDIR)$(pkgdatadir)/mibs/netxms.mib; fi
++      if test "x@BUILD_SERVER@" = "xyes"; then LD_LIBRARY_PATH="$(DESTDIR)$(libdir):${LD_LIBRARY_PATH}" $(DESTDIR)$(bindir)/nxmibc -d $(DESTDIR)$(localstatedir)/lib/netxms/mibs -o $(DESTDIR)$(localstatedir)/lib/netxms/mibs/netxms.mib; fi
diff --git a/debian/patches/Makefile.am b/debian/patches/Makefile.am
new file mode 100644 (file)
index 0000000..31a0831
--- /dev/null
@@ -0,0 +1,14 @@
+# Copyright (C) 2004 NetXMS Team <bugs@netxms.org>
+#  
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without 
+# modifications, as long as this notice is preserved.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+EXTRA_DIST=01_fix-agent-data-dir.diff \
+           02_fix-server-data-dir.diff \
+           03_fix-server-data-install-dir.diff \
+           series
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644 (file)
index 0000000..56a7098
--- /dev/null
@@ -0,0 +1,3 @@
+01_fix-agent-data-dir.diff
+02_fix-server-data-dir.diff
+03_fix-server-data-install-dir.diff
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..b18bce2
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/make -f
+
+export DH_VERBOSE=1
+
+DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+
+override_dh_installinit:
+       dh_installinit -pnetxms-agent --name=nxagentd
+       dh_installinit -pnetxms-server --name=netxmsd
+
+override_dh_shlibdeps:
+       dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
+
+override_dh_auto_configure:
+       dh_auto_configure -- --with-server --with-agent --with-client \
+               --with-sqlite --with-mysql --with-pgsql --with-odbc --with-oracle=/opt/instantclient_11_2 \
+               --enable-unicode
+
+%:
+       LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):/opt/instantclient_11_2 dh $@ --with autoreconf
diff --git a/debian/source/Makefile.am b/debian/source/Makefile.am
new file mode 100644 (file)
index 0000000..6c84a7f
--- /dev/null
@@ -0,0 +1,12 @@
+# Copyright (C) 2004 NetXMS Team <bugs@netxms.org>
+#  
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without 
+# modifications, as long as this notice is preserved.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+EXTRA_DIST=format \
+           options
diff --git a/debian/source/format b/debian/source/format
new file mode 100644 (file)
index 0000000..163aaf8
--- /dev/null
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/source/options b/debian/source/options
new file mode 100644 (file)
index 0000000..3333084
--- /dev/null
@@ -0,0 +1 @@
+#extend-diff-ignore = "(^|/)(config\.sub.*|config\.guess|Makefile|src/tools/nxdevcfg/flags.cpp)$"