aboutsummaryrefslogtreecommitdiffstats
path: root/testing/quassel/quasselcore.initd
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2013-06-07 06:35:13 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2013-06-07 06:37:20 +0000
commit8ed8b68db8951bb319d136b679bd214139db2523 (patch)
tree95b8bc30b6cb4bb5ae5ea700beb7d7bed91e295b /testing/quassel/quasselcore.initd
parent5464baf2f95c314d2f37acd78aa3fdbf126992d4 (diff)
testing/quassel: misc fixes
- use tabs as indent (for consistency with other apkbuilds) - build -common and -client subpackage - build mono - use init.d script from gentoo - use /sbin/nologin as shell instead of /bin/false
Diffstat (limited to 'testing/quassel/quasselcore.initd')
-rw-r--r--testing/quassel/quasselcore.initd63
1 files changed, 63 insertions, 0 deletions
diff --git a/testing/quassel/quasselcore.initd b/testing/quassel/quasselcore.initd
new file mode 100644
index 00000000000..58aedfa5364
--- /dev/null
+++ b/testing/quassel/quasselcore.initd
@@ -0,0 +1,63 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-irc/quassel/files/quasselcore.init,v 1.8 2011/08/19 11:43:49 scarabeus Exp $
+
+depend() {
+ need localmount net
+ after bootmisc postgres
+}
+
+CORE="$(which quasselcore)"
+PID="/var/run/quassel.pid"
+LOGFILE=${LOGFILE:-"/var/log/quassel.log"}
+CONFIGDIR=${CONFIGDIR:-"/var/lib/quassel"}
+QUASSEL_USER=${QUASSEL_USER:-"quassel"}
+
+checkconfig() {
+ # set defaults
+ LOGLEVEL=${LOGLEVEL:-"Info"}
+
+ # check config folder
+ if [ ! -d "${CONFIGDIR}" ]; then
+ mkdir "${CONFIGDIR}" || return 1
+ fi
+ # permissions always changed just to avoid runtime issues
+ chown -R "${QUASSEL_USER}":"${QUASSEL_USER}" "${CONFIGDIR}" || return 1
+
+ # check log file
+ if [ ! -e "${LOGFILE}" ]; then
+ touch "${LOGFILE}" || return 1
+ fi
+ # permissions always changed just to avoid runtime issues
+ chown "${QUASSEL_USER}":"${QUASSEL_USER}" "${LOGFILE}" || return 1
+}
+
+start() {
+ checkconfig || return 1
+
+ ebegin "Starting Quassel Core"
+
+ if [ -n "${RC_UNAME}" ]; then
+ # running on baselayout-2/openrc
+ start-stop-daemon --start --user "${QUASSEL_USER}" --background --make-pidfile \
+ --pidfile "${PID}" \
+ --exec "${CORE}" -- --logfile="${LOGFILE}" --loglevel="${LOGLEVEL}" \
+ ${LISTEN:+--listen="${LISTEN}"} ${PORT:+--port="${PORT}"} \
+ --configdir="${CONFIGDIR}"
+ else
+ # running on baselayout-1
+ start-stop-daemon --start --chuid "${QUASSEL_USER}" --background --make-pidfile \
+ --pidfile "${PID}" --env HOME="${CONFIGDIR}" \
+ --exec "${CORE}" -- --logfile="${LOGFILE}" --loglevel="${LOGLEVEL}" \
+ ${LISTEN:+--listen="${LISTEN}"} ${PORT:+--port="${PORT}"} \
+ --configdir="${CONFIGDIR}"
+ fi
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping Quassel Core"
+ start-stop-daemon --stop --pidfile "${PID}" --exec "${CORE}"
+ eend $?
+}