packages-deb/netxms-server.postinst
2024-05-03 15:30:09 +03:00

99 lines
1.9 KiB
Bash

#!/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. Create database schema:
nxdbmgr init
3. Start daemon and enable autostart:
systemctl start netxms-server
systemctl enable netxms-server
__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
if [ ! -z $2 ]; then
# previous version is set, it's upgrade
/usr/bin/nxdbmgr upgrade
/usr/bin/nxdbmgr online-upgrade >/dev/null 2>/dev/null &
fi
# compile MIBs
/usr/bin/nxmibc -o /var/lib/netxms/netxms.cmib -d /usr/share/netxms/mibs -d /var/lib/netxms/mibs -z || true
;;
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