aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2009-07-17 12:58:51 +0000
committerUlrich Müller <ulm@gentoo.org>2009-07-17 12:58:51 +0000
commit9248b4567fdcf5898ffd3e83d3b6ac38d77103b8 (patch)
treea6954c45b5ab6f060e1f85b825569fd8902c169f
parentTest commit #2 for cia.vc per request from fauli. (diff)
downloademacs-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--ChangeLog7
-rw-r--r--emacs.rc24
2 files changed, 22 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 2566d6e..227f3df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/emacs.rc b/emacs.rc
index 4471fd8..b359d8c 100644
--- a/emacs.rc
+++ b/emacs.rc
@@ -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 $?
}