diff options
author | Ulrich Müller <ulm@gentoo.org> | 2009-07-17 12:58:51 +0000 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2009-07-17 12:58:51 +0000 |
commit | 9248b4567fdcf5898ffd3e83d3b6ac38d77103b8 (patch) | |
tree | a6954c45b5ab6f060e1f85b825569fd8902c169f | |
parent | Test commit #2 for cia.vc per request from fauli. (diff) | |
download | emacs-tools-9248b4567fdcf5898ffd3e83d3b6ac38d77103b8.tar.gz emacs-tools-9248b4567fdcf5898ffd3e83d3b6ac38d77103b8.tar.bz2 emacs-tools-9248b4567fdcf5898ffd3e83d3b6ac38d77103b8.zip |
Be compatible with baselayout-1.
svn path=/emacs-daemon/; revision=1336
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | emacs.rc | 24 |
2 files changed, 22 insertions, 9 deletions
@@ -1,3 +1,10 @@ +2009-07-17 Ulrich Mueller <ulm@gentoo.org> + + * emacs.rc (USER): Initialise from SVCNAME instead of RC_SVCNAME, + in order to be compatible with baselayout-1. OpenRC defines both. + (start): Test for OpenRC. Compatibility code for start-stop-daemon + of baselayout-1. + 2009-03-18 Ulrich Mueller <ulm@gentoo.org> * Version 0.14 released. @@ -8,7 +8,7 @@ : ${EMACS_SHELL=/bin/bash} : ${EMACS_START:=/usr/libexec/emacs/emacs-wrapper.sh} : ${EMACS_TIMEOUT:=30} -USER=${RC_SVCNAME#*.} +USER=${SVCNAME#*.} PIDFILE_DIR=/var/run/emacs/${USER} PIDFILE=${PIDFILE_DIR}/emacs.pid @@ -20,7 +20,7 @@ depend() { } checkconfig() { - if [ "${USER}" = "${RC_SVCNAME}" ]; then + if [ "${USER}" = "${SVCNAME}" ]; then eerror "You have to create an init script for each user:" eerror "ln -s emacs /etc/init.d/emacs.<user>" return 1 @@ -50,15 +50,21 @@ start() { SHELL=${EMACS_SHELL:-$(awk -F: "\$1 == \"${USER}\" { print \$7 }" \ /etc/passwd)} - export SHELL + export SHELL EMACS EMACS_TIMEOUT ebegin "Starting Emacs daemon for user ${USER}" - # This was tested with start-stop-daemon from OpenRC; don't expect - # it to work with other implementations. - start-stop-daemon --start \ - --user "${USER}" --chdir "${home}" --pidfile "${PIDFILE}" \ - --env EMACS="${EMACS}" --env EMACS_TIMEOUT="${EMACS_TIMEOUT}" \ - --exec "${EMACS_START}" -- ${EMACS_OPTS} + if [ -z "${RC_SVCNAME}" ]; then + # baselayout-1 + start-stop-daemon --start \ + --user "${USER}" --exec "${EMACS}" --pidfile "${PIDFILE}" \ + --chuid "${USER}" --chdir "${home}" --env HOME="${home}" \ + --startas "${EMACS_START}" -- ${EMACS_OPTS} + else + # OpenRC + start-stop-daemon --start \ + --user "${USER}" --pidfile "${PIDFILE}" --chdir "${home}" \ + --exec "${EMACS_START}" -- ${EMACS_OPTS} + fi eend $? } |