From dc05441b446aa4cf7e6eaa941c6dd623131bdcff Mon Sep 17 00:00:00 2001 From: LV-426 Date: Sun, 3 May 2015 16:51:39 +0300 Subject: deb-pkg, build.ant: introducing 'single' and 'mux' debian package variants Currently both share the same control script, generating a 'rhizi' named package --- build.ant | 26 ++++- res/debian/README | 6 -- res/debian/README.Debian | 6 -- res/debian/changelog | 5 - res/debian/compat | 1 - res/debian/control | 28 ----- res/debian/copyright | 29 ----- res/debian/dirs | 2 - res/debian/install | 13 --- res/debian/pkg__rhizi-common/README | 6 ++ res/debian/pkg__rhizi-common/README.Debian | 6 ++ res/debian/pkg__rhizi-common/changelog | 5 + res/debian/pkg__rhizi-common/compat | 1 + res/debian/pkg__rhizi-common/control | 28 +++++ res/debian/pkg__rhizi-common/copyright | 29 +++++ res/debian/pkg__rhizi-common/dirs | 2 + res/debian/pkg__rhizi-common/rhizi.cron.hourly | 1 + res/debian/pkg__rhizi-common/rhizi.links | 9 ++ res/debian/pkg__rhizi-common/rules | 25 +++++ res/debian/pkg__rhizi-mux/dirs | 2 + res/debian/pkg__rhizi-mux/install | 13 +++ res/debian/pkg__rhizi-mux/postinst | 52 +++++++++ res/debian/pkg__rhizi-mux/rhizi.init | 144 +++++++++++++++++++++++++ res/debian/pkg__rhizi-single/rhizi.init | 144 +++++++++++++++++++++++++ res/debian/postinst | 52 --------- res/debian/rhizi.cron.hourly | 1 - res/debian/rhizi.init | 144 ------------------------- res/debian/rhizi.links | 9 -- res/debian/rules | 25 ----- 29 files changed, 489 insertions(+), 325 deletions(-) delete mode 100644 res/debian/README delete mode 100644 res/debian/README.Debian delete mode 100644 res/debian/changelog delete mode 100644 res/debian/compat delete mode 100644 res/debian/control delete mode 100644 res/debian/copyright delete mode 100644 res/debian/dirs delete mode 100644 res/debian/install create mode 100644 res/debian/pkg__rhizi-common/README create mode 100644 res/debian/pkg__rhizi-common/README.Debian create mode 100644 res/debian/pkg__rhizi-common/changelog create mode 100644 res/debian/pkg__rhizi-common/compat create mode 100644 res/debian/pkg__rhizi-common/control create mode 100644 res/debian/pkg__rhizi-common/copyright create mode 100644 res/debian/pkg__rhizi-common/dirs create mode 100644 res/debian/pkg__rhizi-common/rhizi.cron.hourly create mode 100644 res/debian/pkg__rhizi-common/rhizi.links create mode 100755 res/debian/pkg__rhizi-common/rules create mode 100644 res/debian/pkg__rhizi-mux/dirs create mode 100644 res/debian/pkg__rhizi-mux/install create mode 100644 res/debian/pkg__rhizi-mux/postinst create mode 100644 res/debian/pkg__rhizi-mux/rhizi.init create mode 100644 res/debian/pkg__rhizi-single/rhizi.init delete mode 100644 res/debian/postinst delete mode 100644 res/debian/rhizi.cron.hourly delete mode 100644 res/debian/rhizi.init delete mode 100644 res/debian/rhizi.links delete mode 100755 res/debian/rules diff --git a/build.ant b/build.ant index 78807c58..e13b620b 100644 --- a/build.ant +++ b/build.ant @@ -195,13 +195,30 @@ - + + + + + + + + + + + + + + + + + + + - - + @@ -215,7 +232,8 @@ - + + diff --git a/res/debian/README b/res/debian/README deleted file mode 100644 index 9df269f5..00000000 --- a/res/debian/README +++ /dev/null @@ -1,6 +0,0 @@ -The Debian Package rhizi ----------------------------- - -Comments regarding the Package - - -- Amir Sagie Sun, 23 Nov 2014 19:09:39 +0200 diff --git a/res/debian/README.Debian b/res/debian/README.Debian deleted file mode 100644 index 91c91086..00000000 --- a/res/debian/README.Debian +++ /dev/null @@ -1,6 +0,0 @@ -rhizi for Debian ------------------------ - -No current notes. - - -- Amir Sagie Sun, 23 Nov 2014 19:09:39 +0200 diff --git a/res/debian/changelog b/res/debian/changelog deleted file mode 100644 index a11dd580..00000000 --- a/res/debian/changelog +++ /dev/null @@ -1,5 +0,0 @@ -rhizi (0.1.0) unstable; urgency=low - - * Initial Release. - - -- Amir Sagie Sun, 23 Nov 2014 19:09:39 +0200 diff --git a/res/debian/compat b/res/debian/compat deleted file mode 100644 index ec635144..00000000 --- a/res/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/res/debian/control b/res/debian/control deleted file mode 100644 index 88a3b56a..00000000 --- a/res/debian/control +++ /dev/null @@ -1,28 +0,0 @@ -Source: rhizi -Section: web -Priority: optional -Maintainer: Amir Sagie -Build-Depends: debhelper (>= 9), - dh-python -Standards-Version: 3.9.5 -Homepage: http://rhizi.net - -Package: rhizi -Architecture: any -Depends: ${python:Depends}, - ${shlibs:Depends}, - ${misc:Depends}, - apache2 (>= 2.4), - neo4j-advanced (>= 2.2), - python2.7, - python-enum, - python-flask, - python-futures, - python-gevent, - python-gevent-websocket, - python-six, - python-socketio -Description: Rhizi document server - Rhizi collaborative web editor - . - This package includes the Rhizi server diff --git a/res/debian/copyright b/res/debian/copyright deleted file mode 100644 index b54b990f..00000000 --- a/res/debian/copyright +++ /dev/null @@ -1,29 +0,0 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: rhizi -Source: http://rhizi.org - -Files: * -Copyright: 2014 Amir Sagie -License: GPL-3.0+ - -Files: debian/* -Copyright: 2014 Amir Sagie -License: GPL-3.0+ - -License: GPL-3.0+ - 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 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 . - . - On Debian systems, the complete text of the GNU General - Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". - diff --git a/res/debian/dirs b/res/debian/dirs deleted file mode 100644 index 41d605ce..00000000 --- a/res/debian/dirs +++ /dev/null @@ -1,2 +0,0 @@ -var/run/rhizi -var/log/rhizi diff --git a/res/debian/install b/res/debian/install deleted file mode 100644 index 8d6b927a..00000000 --- a/res/debian/install +++ /dev/null @@ -1,13 +0,0 @@ -res/client/* usr/share/rhizi/webapp/static/ -res/neo4j/reset-db__clean.cypher usr/lib/rhizi/tools/neo4j -res/templates/* usr/share/rhizi/webapp/templates/ -res/rz-mux/* usr/share/rhizi/rz-mux/ - -src/client/* usr/lib/rhizi/webapp/static/js -src/server/* usr/lib/rhizi/rhizi-server/ -src/local/server-tools/* usr/lib/rhizi/tools/server-tools -src/local/rz-mux/* usr/lib/rhizi/tools/rz-mux - -# Domain specific - install defaults -src/local/domain/default.rhizi.net/domain_types.js usr/lib/rhizi/webapp/static/js/model/ -res/local/template/fragment/by-domain/default.rhizi.net/* usr/share/rhizi/webapp/templates/fragment diff --git a/res/debian/pkg__rhizi-common/README b/res/debian/pkg__rhizi-common/README new file mode 100644 index 00000000..9df269f5 --- /dev/null +++ b/res/debian/pkg__rhizi-common/README @@ -0,0 +1,6 @@ +The Debian Package rhizi +---------------------------- + +Comments regarding the Package + + -- Amir Sagie Sun, 23 Nov 2014 19:09:39 +0200 diff --git a/res/debian/pkg__rhizi-common/README.Debian b/res/debian/pkg__rhizi-common/README.Debian new file mode 100644 index 00000000..91c91086 --- /dev/null +++ b/res/debian/pkg__rhizi-common/README.Debian @@ -0,0 +1,6 @@ +rhizi for Debian +----------------------- + +No current notes. + + -- Amir Sagie Sun, 23 Nov 2014 19:09:39 +0200 diff --git a/res/debian/pkg__rhizi-common/changelog b/res/debian/pkg__rhizi-common/changelog new file mode 100644 index 00000000..a11dd580 --- /dev/null +++ b/res/debian/pkg__rhizi-common/changelog @@ -0,0 +1,5 @@ +rhizi (0.1.0) unstable; urgency=low + + * Initial Release. + + -- Amir Sagie Sun, 23 Nov 2014 19:09:39 +0200 diff --git a/res/debian/pkg__rhizi-common/compat b/res/debian/pkg__rhizi-common/compat new file mode 100644 index 00000000..ec635144 --- /dev/null +++ b/res/debian/pkg__rhizi-common/compat @@ -0,0 +1 @@ +9 diff --git a/res/debian/pkg__rhizi-common/control b/res/debian/pkg__rhizi-common/control new file mode 100644 index 00000000..88a3b56a --- /dev/null +++ b/res/debian/pkg__rhizi-common/control @@ -0,0 +1,28 @@ +Source: rhizi +Section: web +Priority: optional +Maintainer: Amir Sagie +Build-Depends: debhelper (>= 9), + dh-python +Standards-Version: 3.9.5 +Homepage: http://rhizi.net + +Package: rhizi +Architecture: any +Depends: ${python:Depends}, + ${shlibs:Depends}, + ${misc:Depends}, + apache2 (>= 2.4), + neo4j-advanced (>= 2.2), + python2.7, + python-enum, + python-flask, + python-futures, + python-gevent, + python-gevent-websocket, + python-six, + python-socketio +Description: Rhizi document server + Rhizi collaborative web editor + . + This package includes the Rhizi server diff --git a/res/debian/pkg__rhizi-common/copyright b/res/debian/pkg__rhizi-common/copyright new file mode 100644 index 00000000..b54b990f --- /dev/null +++ b/res/debian/pkg__rhizi-common/copyright @@ -0,0 +1,29 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: rhizi +Source: http://rhizi.org + +Files: * +Copyright: 2014 Amir Sagie +License: GPL-3.0+ + +Files: debian/* +Copyright: 2014 Amir Sagie +License: GPL-3.0+ + +License: GPL-3.0+ + 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 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 . + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". + diff --git a/res/debian/pkg__rhizi-common/dirs b/res/debian/pkg__rhizi-common/dirs new file mode 100644 index 00000000..41d605ce --- /dev/null +++ b/res/debian/pkg__rhizi-common/dirs @@ -0,0 +1,2 @@ +var/run/rhizi +var/log/rhizi diff --git a/res/debian/pkg__rhizi-common/rhizi.cron.hourly b/res/debian/pkg__rhizi-common/rhizi.cron.hourly new file mode 100644 index 00000000..274cdd7a --- /dev/null +++ b/res/debian/pkg__rhizi-common/rhizi.cron.hourly @@ -0,0 +1 @@ +/usr/lib/rhizi/server-tools/rz_backup.py \ No newline at end of file diff --git a/res/debian/pkg__rhizi-common/rhizi.links b/res/debian/pkg__rhizi-common/rhizi.links new file mode 100644 index 00000000..58715e62 --- /dev/null +++ b/res/debian/pkg__rhizi-common/rhizi.links @@ -0,0 +1,9 @@ +usr/lib/rhizi-server/rhizi_server.py usr/bin/rhizi-server +srv/www/rhizi/webapp/bin usr/bin/rhizi-server + +# +# JS libs - note: symlink against .min version of libs +# +# +# usr/share/javascript/jquery/jquery.min.js srv/www/rhizi/webapp/static/lib/jquery.js +# usr/share/javascript/underscore/underscore.min.js srv/www/rhizi/webapp/static/lib/underscore.js diff --git a/res/debian/pkg__rhizi-common/rules b/res/debian/pkg__rhizi-common/rules new file mode 100755 index 00000000..e2a59841 --- /dev/null +++ b/res/debian/pkg__rhizi-common/rules @@ -0,0 +1,25 @@ +#!/usr/bin/make -f + +export DH_VERBOSE=1 + +DEB_CONFIGURE_EXTRA_FLAGS := \ + --prefix=/usr \ + --libdir=/usr/lib \ + --enable-python + +%: + dh $@ --with python2 + +override_dh_auto_configure: + dh_auto_configure -- $(DEB_CONFIGURE_EXTRA_FLAGS) + +override_dh_auto_install: + dh_auto_install + + # TODO: support python setup.py install: + # python setup.py install --root=$(CURDIR)/debian/supybot --prefix=/usr $(py_setup_install_args) + +override_dh_python2: + dh_python2 \ + -p rhizi \ + --exclude=rhizi-server.py diff --git a/res/debian/pkg__rhizi-mux/dirs b/res/debian/pkg__rhizi-mux/dirs new file mode 100644 index 00000000..1e1391d3 --- /dev/null +++ b/res/debian/pkg__rhizi-mux/dirs @@ -0,0 +1,2 @@ +etc/rhizi/ +var/run/rhizi diff --git a/res/debian/pkg__rhizi-mux/install b/res/debian/pkg__rhizi-mux/install new file mode 100644 index 00000000..8d6b927a --- /dev/null +++ b/res/debian/pkg__rhizi-mux/install @@ -0,0 +1,13 @@ +res/client/* usr/share/rhizi/webapp/static/ +res/neo4j/reset-db__clean.cypher usr/lib/rhizi/tools/neo4j +res/templates/* usr/share/rhizi/webapp/templates/ +res/rz-mux/* usr/share/rhizi/rz-mux/ + +src/client/* usr/lib/rhizi/webapp/static/js +src/server/* usr/lib/rhizi/rhizi-server/ +src/local/server-tools/* usr/lib/rhizi/tools/server-tools +src/local/rz-mux/* usr/lib/rhizi/tools/rz-mux + +# Domain specific - install defaults +src/local/domain/default.rhizi.net/domain_types.js usr/lib/rhizi/webapp/static/js/model/ +res/local/template/fragment/by-domain/default.rhizi.net/* usr/share/rhizi/webapp/templates/fragment diff --git a/res/debian/pkg__rhizi-mux/postinst b/res/debian/pkg__rhizi-mux/postinst new file mode 100644 index 00000000..44b87c5f --- /dev/null +++ b/res/debian/pkg__rhizi-mux/postinst @@ -0,0 +1,52 @@ +#!/bin/sh +# postinst script for rhizi +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure) + # call chmod, chown, etc. + + chown www-data:www-data /var/run/rhizi + chown www-data:www-data /var/log/rhizi + + # configure apache - FIXME: impl undo + echo 'enabling apache proxy modules - warning: this will not be reverted during package uninstall' + /usr/sbin/a2enmod deflate + /usr/sbin/a2enmod proxy + /usr/sbin/a2enmod proxy_http + /usr/sbin/a2enmod proxy_wstunnel + /usr/sbin/a2enmod rewrite + + ;; + + 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/res/debian/pkg__rhizi-mux/rhizi.init b/res/debian/pkg__rhizi-mux/rhizi.init new file mode 100644 index 00000000..61d9e916 --- /dev/null +++ b/res/debian/pkg__rhizi-mux/rhizi.init @@ -0,0 +1,144 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: rhizi +# Required-Start: $local_fs $network $syslog +# Required-Stop: $local_fs $network $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Rhizi service +# Description: Rhizi kernel & accompanying web-server +### END INIT INFO + +# Do NOT "set -e" + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="rhizi-server" +NAME=rhizi +DAEMON=/usr/bin/python2.7 +PIDFILE=/var/run/$NAME/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME +USERNAME=www-data +GROUPNAME=www-data + +ARGS__DAEMON="/srv/www/rhizi/rhizi.net/bin/rz_server.py --config-dir=/etc/rhizi" +ARGS__START_STOP_DAEMON="--make-pidfile --background --chuid ${USERNAME}:${GROUPNAME}" + +# 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.2-14) to ensure that this file is present +# and status_of_proc is working. +. /lib/lsb/init-functions + +# make sure /var/run/$NAME exists with proper +w mode as the uid:gid used to fork the server +if [ ! -d /var/run/$NAME ]; then + mkdir /var/run/$NAME + chown ${USERNAME}:${GROUPNAME} /var/run/$NAME +fi + +# +# 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 $ARGS__START_STOP_DAEMON --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE $ARGS__START_STOP_DAEMON --exec $DAEMON -- \ + $ARGS__DAEMON \ + || return 2 +} + +# +# 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 + 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" +} + +# +# run command +# +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 $? + ;; + 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|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: diff --git a/res/debian/pkg__rhizi-single/rhizi.init b/res/debian/pkg__rhizi-single/rhizi.init new file mode 100644 index 00000000..758e8625 --- /dev/null +++ b/res/debian/pkg__rhizi-single/rhizi.init @@ -0,0 +1,144 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: rhizi +# Required-Start: $local_fs $network $syslog +# Required-Stop: $local_fs $network $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Rhizi service +# Description: Rhizi kernel & accompanying web-server +### END INIT INFO + +# Do NOT "set -e" + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="rhizi-server" +NAME=rhizi__{{ domain_name }} +DAEMON=/usr/bin/python2.7 +PIDFILE=/var/run/rhizi/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME +USERNAME=www-data +GROUPNAME=www-data + +ARGS__DAEMON="/usr/lib/rhizi/rhizi-server/rz_server.py --config-dir=/etc/rhizi/mux-conf.d/{{ domain_name }}/" +ARGS__START_STOP_DAEMON="--make-pidfile --background --chuid ${USERNAME}:${GROUPNAME}" + +# 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.2-14) to ensure that this file is present +# and status_of_proc is working. +. /lib/lsb/init-functions + +# make sure /var/run/$NAME exists with proper +w mode as the uid:gid used to fork the server +if [ ! -d /var/run/$NAME ]; then + mkdir /var/run/$NAME + chown ${USERNAME}:${GROUPNAME} /var/run/$NAME +fi + +# +# 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 $ARGS__START_STOP_DAEMON --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE $ARGS__START_STOP_DAEMON --exec $DAEMON -- \ + $ARGS__DAEMON \ + || return 2 +} + +# +# 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 + 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" +} + +# +# run command +# +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 $? + ;; + 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|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: diff --git a/res/debian/postinst b/res/debian/postinst deleted file mode 100644 index 44b87c5f..00000000 --- a/res/debian/postinst +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -# postinst script for rhizi -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `configure' -# * `abort-upgrade' -# * `abort-remove' `in-favour' -# -# * `abort-remove' -# * `abort-deconfigure' `in-favour' -# `removing' -# -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - configure) - # call chmod, chown, etc. - - chown www-data:www-data /var/run/rhizi - chown www-data:www-data /var/log/rhizi - - # configure apache - FIXME: impl undo - echo 'enabling apache proxy modules - warning: this will not be reverted during package uninstall' - /usr/sbin/a2enmod deflate - /usr/sbin/a2enmod proxy - /usr/sbin/a2enmod proxy_http - /usr/sbin/a2enmod proxy_wstunnel - /usr/sbin/a2enmod rewrite - - ;; - - 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/res/debian/rhizi.cron.hourly b/res/debian/rhizi.cron.hourly deleted file mode 100644 index 274cdd7a..00000000 --- a/res/debian/rhizi.cron.hourly +++ /dev/null @@ -1 +0,0 @@ -/usr/lib/rhizi/server-tools/rz_backup.py \ No newline at end of file diff --git a/res/debian/rhizi.init b/res/debian/rhizi.init deleted file mode 100644 index 61d9e916..00000000 --- a/res/debian/rhizi.init +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/sh - -### BEGIN INIT INFO -# Provides: rhizi -# Required-Start: $local_fs $network $syslog -# Required-Stop: $local_fs $network $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Rhizi service -# Description: Rhizi kernel & accompanying web-server -### END INIT INFO - -# Do NOT "set -e" - -# PATH should only include /usr/* if it runs after the mountnfs.sh script -PATH=/sbin:/usr/sbin:/bin:/usr/bin -DESC="rhizi-server" -NAME=rhizi -DAEMON=/usr/bin/python2.7 -PIDFILE=/var/run/$NAME/$NAME.pid -SCRIPTNAME=/etc/init.d/$NAME -USERNAME=www-data -GROUPNAME=www-data - -ARGS__DAEMON="/srv/www/rhizi/rhizi.net/bin/rz_server.py --config-dir=/etc/rhizi" -ARGS__START_STOP_DAEMON="--make-pidfile --background --chuid ${USERNAME}:${GROUPNAME}" - -# 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.2-14) to ensure that this file is present -# and status_of_proc is working. -. /lib/lsb/init-functions - -# make sure /var/run/$NAME exists with proper +w mode as the uid:gid used to fork the server -if [ ! -d /var/run/$NAME ]; then - mkdir /var/run/$NAME - chown ${USERNAME}:${GROUPNAME} /var/run/$NAME -fi - -# -# 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 $ARGS__START_STOP_DAEMON --exec $DAEMON --test > /dev/null \ - || return 1 - start-stop-daemon --start --quiet --pidfile $PIDFILE $ARGS__START_STOP_DAEMON --exec $DAEMON -- \ - $ARGS__DAEMON \ - || return 2 -} - -# -# 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 - 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" -} - -# -# run command -# -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 $? - ;; - 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|restart|reload|force-reload}" >&2 - echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 - exit 3 - ;; -esac - -: diff --git a/res/debian/rhizi.links b/res/debian/rhizi.links deleted file mode 100644 index 58715e62..00000000 --- a/res/debian/rhizi.links +++ /dev/null @@ -1,9 +0,0 @@ -usr/lib/rhizi-server/rhizi_server.py usr/bin/rhizi-server -srv/www/rhizi/webapp/bin usr/bin/rhizi-server - -# -# JS libs - note: symlink against .min version of libs -# -# -# usr/share/javascript/jquery/jquery.min.js srv/www/rhizi/webapp/static/lib/jquery.js -# usr/share/javascript/underscore/underscore.min.js srv/www/rhizi/webapp/static/lib/underscore.js diff --git a/res/debian/rules b/res/debian/rules deleted file mode 100755 index e2a59841..00000000 --- a/res/debian/rules +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/make -f - -export DH_VERBOSE=1 - -DEB_CONFIGURE_EXTRA_FLAGS := \ - --prefix=/usr \ - --libdir=/usr/lib \ - --enable-python - -%: - dh $@ --with python2 - -override_dh_auto_configure: - dh_auto_configure -- $(DEB_CONFIGURE_EXTRA_FLAGS) - -override_dh_auto_install: - dh_auto_install - - # TODO: support python setup.py install: - # python setup.py install --root=$(CURDIR)/debian/supybot --prefix=/usr $(py_setup_install_args) - -override_dh_python2: - dh_python2 \ - -p rhizi \ - --exclude=rhizi-server.py -- cgit v1.3.1