1 |
Author: ulm |
2 |
Date: 2009-07-17 12:58:51 +0000 (Fri, 17 Jul 2009) |
3 |
New Revision: 1336 |
4 |
|
5 |
Modified: |
6 |
emacs-daemon/ChangeLog |
7 |
emacs-daemon/emacs.rc |
8 |
Log: |
9 |
Be compatible with baselayout-1. |
10 |
|
11 |
Modified: emacs-daemon/ChangeLog |
12 |
=================================================================== |
13 |
--- emacs-daemon/ChangeLog 2009-07-16 17:22:31 UTC (rev 1335) |
14 |
+++ emacs-daemon/ChangeLog 2009-07-17 12:58:51 UTC (rev 1336) |
15 |
@@ -1,3 +1,10 @@ |
16 |
+2009-07-17 Ulrich Mueller <ulm@g.o> |
17 |
+ |
18 |
+ * emacs.rc (USER): Initialise from SVCNAME instead of RC_SVCNAME, |
19 |
+ in order to be compatible with baselayout-1. OpenRC defines both. |
20 |
+ (start): Test for OpenRC. Compatibility code for start-stop-daemon |
21 |
+ of baselayout-1. |
22 |
+ |
23 |
2009-03-18 Ulrich Mueller <ulm@g.o> |
24 |
|
25 |
* Version 0.14 released. |
26 |
|
27 |
Modified: emacs-daemon/emacs.rc |
28 |
=================================================================== |
29 |
--- emacs-daemon/emacs.rc 2009-07-16 17:22:31 UTC (rev 1335) |
30 |
+++ emacs-daemon/emacs.rc 2009-07-17 12:58:51 UTC (rev 1336) |
31 |
@@ -8,7 +8,7 @@ |
32 |
: ${EMACS_SHELL=/bin/bash} |
33 |
: ${EMACS_START:=/usr/libexec/emacs/emacs-wrapper.sh} |
34 |
: ${EMACS_TIMEOUT:=30} |
35 |
-USER=${RC_SVCNAME#*.} |
36 |
+USER=${SVCNAME#*.} |
37 |
PIDFILE_DIR=/var/run/emacs/${USER} |
38 |
PIDFILE=${PIDFILE_DIR}/emacs.pid |
39 |
|
40 |
@@ -20,7 +20,7 @@ |
41 |
} |
42 |
|
43 |
checkconfig() { |
44 |
- if [ "${USER}" = "${RC_SVCNAME}" ]; then |
45 |
+ if [ "${USER}" = "${SVCNAME}" ]; then |
46 |
eerror "You have to create an init script for each user:" |
47 |
eerror "ln -s emacs /etc/init.d/emacs.<user>" |
48 |
return 1 |
49 |
@@ -50,15 +50,21 @@ |
50 |
|
51 |
SHELL=${EMACS_SHELL:-$(awk -F: "\$1 == \"${USER}\" { print \$7 }" \ |
52 |
/etc/passwd)} |
53 |
- export SHELL |
54 |
+ export SHELL EMACS EMACS_TIMEOUT |
55 |
|
56 |
ebegin "Starting Emacs daemon for user ${USER}" |
57 |
- # This was tested with start-stop-daemon from OpenRC; don't expect |
58 |
- # it to work with other implementations. |
59 |
- start-stop-daemon --start \ |
60 |
- --user "${USER}" --chdir "${home}" --pidfile "${PIDFILE}" \ |
61 |
- --env EMACS="${EMACS}" --env EMACS_TIMEOUT="${EMACS_TIMEOUT}" \ |
62 |
- --exec "${EMACS_START}" -- ${EMACS_OPTS} |
63 |
+ if [ -z "${RC_SVCNAME}" ]; then |
64 |
+ # baselayout-1 |
65 |
+ start-stop-daemon --start \ |
66 |
+ --user "${USER}" --exec "${EMACS}" --pidfile "${PIDFILE}" \ |
67 |
+ --chuid "${USER}" --chdir "${home}" --env HOME="${home}" \ |
68 |
+ --startas "${EMACS_START}" -- ${EMACS_OPTS} |
69 |
+ else |
70 |
+ # OpenRC |
71 |
+ start-stop-daemon --start \ |
72 |
+ --user "${USER}" --pidfile "${PIDFILE}" --chdir "${home}" \ |
73 |
+ --exec "${EMACS_START}" -- ${EMACS_OPTS} |
74 |
+ fi |
75 |
eend $? |
76 |
} |