commit:     071286eb7bfc3f4466f2f96bdcbcf69e314fa578
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sun Mar  9 20:21:18 2025 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Sun Mar  9 20:21:18 2025 +0000
URL:        https://gitweb.gentoo.org/proj/emacs-tools.git/commit/?id=071286eb

Add user unit file for systemd

* emacs.service: New file. User unit file for systemd, copied
from Emacs 30.1.
* Makefile (DISTFILES): Add it.

Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 ChangeLog     |  4 ++++
 Makefile      |  2 +-
 emacs.service | 19 +++++++++++++++++++
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index dabba3c..c07710f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2025-03-09  Ulrich Müller  <[email protected]>
 
+       * emacs.service: New file. User unit file for systemd, copied
+       from Emacs 30.1.
+       * Makefile (DISTFILES): Add it.
+
        * emacs-wrapper.sh: New file, moved here from emacs-daemon.
        * 10emacs-common-gentoo.el: Ditto. Simplified.
        * Makefile (DISTFILES): Add them.

diff --git a/Makefile b/Makefile
index bedfc9f..3385d1f 100644
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,7 @@ ICONFILES = sink.png \
 GSCHEMAFILES = org.gnu.emacs.defaults.gschema.xml
 DISTFILES = README.gentoo.in README.daemon \
        site-start.el site-gentoo.el subdirs.el.in 10emacs-common-gentoo.el \
-       emacs.initd emacs-wrapper.sh \
+       emacs.initd emacs-wrapper.sh emacs.service \
        $(DESKTOPFILES) $(addprefix icons/,COPYRIGHT.icons $(ICONFILES)) \
        $(GSCHEMAFILES)
 

diff --git a/emacs.service b/emacs.service
new file mode 100644
index 0000000..bb2e181
--- /dev/null
+++ b/emacs.service
@@ -0,0 +1,19 @@
+[Unit]
+Description=Emacs text editor
+Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/
+
+[Service]
+Type=notify
+ExecStart=/usr/bin/emacs --fg-daemon
+
+# Emacs will exit with status 15 after having received SIGTERM, which
+# is the default "KillSignal" value systemd uses to stop services.
+SuccessExitStatus=15
+
+# The location of the SSH auth socket varies by distribution, and some
+# set it from PAM, so don't override by default.
+# Environment=SSH_AUTH_SOCK=%t/keyring/ssh
+Restart=on-failure
+
+[Install]
+WantedBy=default.target

Reply via email to