Gentoo Archives: gentoo-commits

From: "Maciej Mrozowski (reavertm)" <reavertm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-irc/quassel/files: quasselcore.init
Date: Sat, 03 Jul 2010 10:31:03
Message-Id: 20100703103055.48D9C2C5F4@corvid.gentoo.org
1 reavertm 10/07/03 10:30:55
2
3 Modified: quasselcore.init
4 Log:
5 Fix init.d file (-R for recursive chown), quote some variables, specify which files to move migration.
6 (Portage version: 2.2_rc67/cvs/Linux x86_64)
7
8 Revision Changes Path
9 1.6 net-irc/quassel/files/quasselcore.init
10
11 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-irc/quassel/files/quasselcore.init?rev=1.6&view=markup
12 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-irc/quassel/files/quasselcore.init?rev=1.6&content-type=text/plain
13 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-irc/quassel/files/quasselcore.init?r1=1.5&r2=1.6
14
15 Index: quasselcore.init
16 ===================================================================
17 RCS file: /var/cvsroot/gentoo-x86/net-irc/quassel/files/quasselcore.init,v
18 retrieving revision 1.5
19 retrieving revision 1.6
20 diff -u -r1.5 -r1.6
21 --- quasselcore.init 1 Jul 2010 10:34:03 -0000 1.5
22 +++ quasselcore.init 3 Jul 2010 10:30:55 -0000 1.6
23 @@ -1,7 +1,7 @@
24 #!/sbin/runscript
25 # Copyright 1999-2010 Gentoo Foundation
26 # Distributed under the terms of the GNU General Public License v2
27 -# $Header: /var/cvsroot/gentoo-x86/net-irc/quassel/files/quasselcore.init,v 1.5 2010/07/01 10:34:03 scarabeus Exp $
28 +# $Header: /var/cvsroot/gentoo-x86/net-irc/quassel/files/quasselcore.init,v 1.6 2010/07/03 10:30:55 reavertm Exp $
29
30 depend() {
31 need net
32 @@ -11,23 +11,28 @@
33 LOGFILE="/var/log/quassel.log"
34 CORE="$(which quasselcore)"
35 PID="/var/run/quassel.pid"
36 -CONFIGDIR="/var/lib/quassel/"
37 +CONFIGDIR="/var/lib/quassel"
38 QUASSEL_USER="quassel"
39
40 checkconfig() {
41 + # set defaults
42 + LISTEN=${LISTEN:-"0.0.0.0"}
43 + LOGLEVEL=${LOGLEVEL:-"Info"}
44 + PORT=${PORT:-"4242"}
45 +
46 # check config folder
47 if [ ! -d "${CONFIGDIR}" ]; then
48 - mkdir ${CONFIGDIR} || return 1
49 + mkdir "${CONFIGDIR}" || return 1
50 fi
51 # permissions always changed just to avoid runtime issues
52 - chown -r ${QUASSEL_USER}:${QUASSEL_USER} ${CONFIGDIR} || return 1
53 + chown -R "${QUASSEL_USER}":"${QUASSEL_USER}" "${CONFIGDIR}" || return 1
54
55 # check log file
56 if [ ! -e "${LOGFILE}" ]; then
57 - touch ${LOGFILE} || return 1
58 + touch "${LOGFILE}" || return 1
59 fi
60 # permissions always changed just to avoid runtime issues
61 - chown ${QUASSEL_USER}:${QUASSEL_USER} ${LOGFILE} || return 1
62 + chown "${QUASSEL_USER}":"${QUASSEL_USER}" "${LOGFILE}" || return 1
63 }
64
65 start() {
66 @@ -37,24 +42,24 @@
67
68 if [ -n "${RC_UNAME}" ]; then
69 # running on baselayout-2/openrc
70 - start-stop-daemon --start --user ${QUASSEL_USER} --background --make-pidfile \
71 - --pidfile ${PID} \
72 - --exec ${CORE} -- --logfile=${LOGFILE} --loglevel=${LOGLEVEL:-"Info"} \
73 - --listen=${LISTEN:-"0.0.0.0"} --port=${PORT:-"4242"} \
74 - --configdir=${CONFIGDIR:-"/var/lib/quassel/"}
75 + start-stop-daemon --start --user "${QUASSEL_USER}" --background --make-pidfile \
76 + --pidfile "${PID}" \
77 + --exec "${CORE}" -- --logfile="${LOGFILE}" --loglevel="${LOGLEVEL}" \
78 + --listen="${LISTEN}" --port="${PORT}" \
79 + --configdir="${CONFIGDIR}"
80 else
81 # running on baselayout-1
82 - start-stop-daemon --start --chuid ${QUASSEL_USER} --background --make-pidfile \
83 - --pidfile ${PID} --env HOME="/var/lib/quassel/" \
84 - --exec ${CORE} -- --logfile=${LOGFILE} --loglevel=${LOGLEVEL:-"Info"} \
85 - --listen=${LISTEN:-"0.0.0.0"} --port=${PORT:-"4242"} \
86 - --configdir=${CONFIGDIR:-"/var/lib/quassel/"}
87 + start-stop-daemon --start --chuid "${QUASSEL_USER}" --background --make-pidfile \
88 + --pidfile "${PID}" --env HOME="${CONFIGDIR}" \
89 + --exec "${CORE}" -- --logfile="${LOGFILE}" --loglevel="${LOGLEVEL}" \
90 + --listen="${LISTEN}" --port="${PORT}" \
91 + --configdir="${CONFIGDIR}"
92 fi
93 eend $?
94 }
95
96 stop() {
97 ebegin "Stopping Quassel Core"
98 - start-stop-daemon --stop --pidfile ${PID} --exec ${CORE}
99 + start-stop-daemon --stop --pidfile "${PID}" --exec "${CORE}"
100 eend $?
101 }