diff --git a/debian/changelog b/debian/changelog index 1f738b9a6faf550a8fd3123b125d77303a8e4166..a3f969166d2c23a5325988d3d6a05fd8aacc46e4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +liber (0.1p6) unstable; urgency=medium + + * Fixed issues with user input. + * Init script for the HTTP daemon. + + -- ale <ale@incal.net> Sat, 07 Feb 2015 09:47:16 +0000 + liber (0.1p5) unstable; urgency=low * Built with updated Bleve and Go. diff --git a/debian/liber.default b/debian/liber.default new file mode 100644 index 0000000000000000000000000000000000000000..2b126d44b59e1e81f854df93b9f0fa93887a69f1 --- /dev/null +++ b/debian/liber.default @@ -0,0 +1,9 @@ + +# Uncomment this line to start the HTTP interface daemon. +#ENABLE_SERVER=true + +# Set the address (host:port) to listen on. +#ADDR=:4040 + +# Directory where books are stored. +#BOOK_DIR=/var/lib/liber/books diff --git a/debian/liber.init b/debian/liber.init new file mode 100755 index 0000000000000000000000000000000000000000..08ac6769b34538531199e36f338973bca47af025 --- /dev/null +++ b/debian/liber.init @@ -0,0 +1,70 @@ +#!/bin/sh +# +### BEGIN INIT INFO +# Provides: liber +# Required-Start: $remote_fs $time +# Required-Stop: $remote_fs $time +# Should-Start: $network +# Should-Stop: $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: ebook collection server +# Description: Ebook collection server. +### END INIT INFO + +NAME=liber +DESC="Liber" +DAEMON=/usr/bin/liber +PIDFILE=/var/run/liber.pid +ENABLE_SERVER=false +USER=liber +ADDR=:4040 +BOOK_DIR=/var/lib/liber/books +DAEMON_OPTS= + +[ -r /etc/default/$NAME ] && . /etc/default/$NAME +[ -x "$DAEMON" ] || exit 0 +if [ "$ENABLE_SERVER" != "true" ]; then + echo "$NAME disabled, set ENABLE_SERVER=true in /etc/default/$NAME to enable it" >&2 + exit 0 +fi + +. /lib/lsb/init-functions + +do_start() { + DAEMON_OPTS="--http-server=$ADDR --book-dir=$BOOK_DIR $DAEMON_OPTS" + + log_daemon_msg "Starting $DESC" "$NAME" + start-stop-daemon --start --quiet --background \ + --pidfile $PIDFILE --make-pidfile --chuid $USER \ + --exec /bin/sh -- -c \ + "$DAEMON $DAEMON_OPTS 2>&1 | logger -t liber" + log_end_msg $? +} + +do_stop() { + log_daemon_msg "Stopping $DESC" "$NAME" + start_stop_daemon --stop --quiet --oknodo \ + --pidfile $PIDFILE --user $USER + log_end_msg $? +} + +case "$1" in + start) + do_start + ;; + stop) + do_stop + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "Usage: $0 {start|stop|restart}" >&2 + exit 3 + ;; +esac + +exit 0 diff --git a/debian/liber.postinst b/debian/liber.postinst new file mode 100755 index 0000000000000000000000000000000000000000..510181207b4edbd7ef66c1b24f61a16f37444a2f --- /dev/null +++ b/debian/liber.postinst @@ -0,0 +1,31 @@ +#!/bin/sh + +case "$1" in + configure) + OLDVERSION="$2" + # see below + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + exit 0 + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +adduser --quiet --system --home /var/lib/liber --no-create-home --ingroup nogroup liber + +for dir in /var/lib/liber /var/lib/liber/books; do + test -d $dir || mkdir $dir + chmod 700 $dir + chown liber:nogroup $dir +done + +update-rc.d liber defaults >/dev/null + +exit 0