From a89faa16d7e8ff929f73ae6efc19a406178d85b7 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@frugalware.org>
Date: Mon, 27 Dec 2010 17:14:27 +0100
Subject: [PATCH] systemd: install systemd unit files
bitlbee.service provides ForkDaemon mode,
bitlbee.socket/bitlbee@.service is available as well for the depreceated
inetd mode.
---
Makefile | 12 ++++++++++--
configure | 12 ++++++++++++
init/bitlbee.service | 9 +++++++++
init/bitlbee.socket | 9 +++++++++
init/bitlbee@.service | 7 +++++++
5 files changed, 47 insertions(+), 2 deletions(-)
create mode 100644 init/bitlbee.service
create mode 100644 init/bitlbee.socket
create mode 100644 init/bitlbee@.service
diff --git a/Makefile b/Makefile
index 24ef216..b3ba29c 100644
a
|
b
|
all: $(OUTFILE) $(OTR_PI) |
32 | 32 | uninstall: uninstall-bin uninstall-doc |
33 | 33 | @echo -e '\nmake uninstall does not remove files in '$(DESTDIR)$(ETCDIR)', you can use make uninstall-etc to do that.\n' |
34 | 34 | |
35 | | install: install-bin install-doc install-plugins |
| 35 | install: install-bin install-doc install-plugins install-systemd |
36 | 36 | @if ! [ -d $(DESTDIR)$(CONFIG) ]; then echo -e '\nThe configuration directory $(DESTDIR)$(CONFIG) does not exist yet, don'\''t forget to create it!'; fi |
37 | 37 | @if ! [ -e $(DESTDIR)$(ETCDIR)/bitlbee.conf ]; then echo -e '\nNo files are installed in '$(DESTDIR)$(ETCDIR)' by make install. Run make install-etc to do that.'; fi |
38 | 38 | @echo |
39 | 39 | |
40 | | .PHONY: install install-bin install-etc install-doc install-plugins \ |
| 40 | .PHONY: install install-bin install-etc install-doc install-plugins install-systemd \ |
41 | 41 | uninstall uninstall-bin uninstall-etc uninstall-doc \ |
42 | 42 | all clean distclean tar $(subdirs) |
43 | 43 | |
… |
… |
ifdef OTR_PI |
109 | 109 | install -m 0755 otr.so $(DESTDIR)$(PLUGINDIR) |
110 | 110 | endif |
111 | 111 | |
| 112 | install-systemd: |
| 113 | ifdef SYSTEMDSYSTEMUNITDIR |
| 114 | mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
| 115 | install -m 0644 init/bitlbee.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
| 116 | install -m 0644 init/bitlbee@.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
| 117 | install -m 0644 init/bitlbee.socket $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
| 118 | endif |
| 119 | |
112 | 120 | tar: |
113 | 121 | fakeroot debian/rules clean || make distclean |
114 | 122 | x=$$(basename $$(pwd)); \ |
diff --git a/configure b/configure
index 3a3796d..9313fc7 100755
a
|
b
|
datadir='$prefix/share/bitlbee/' |
15 | 15 | config='/var/lib/bitlbee/' |
16 | 16 | plugindir='$prefix/lib/bitlbee/' |
17 | 17 | includedir='$prefix/include/bitlbee/' |
| 18 | systemdsystemunitdir='' |
18 | 19 | libevent='/usr/' |
19 | 20 | pidfile='/var/run/bitlbee.pid' |
20 | 21 | ipcsocket='/var/run/bitlbee.sock' |
… |
… |
Option Description Default |
62 | 63 | --mandir=... $mandir |
63 | 64 | --datadir=... $datadir |
64 | 65 | --plugindir=... $plugindir |
| 66 | --systemdsystemunitdir=... $systemdsystemunitdir |
65 | 67 | --pidfile=... $pidfile |
66 | 68 | --config=... $config |
67 | 69 | --ipcsocket=... $ipcsocket |
… |
… |
else |
487 | 489 | fi; |
488 | 490 | fi |
489 | 491 | |
| 492 | if [ -n "systemdsystemunitdir" ]; then |
| 493 | echo "SYSTEMDSYSTEMUNITDIR=$systemdsystemunitdir" >> Makefile.settings |
| 494 | fi |
| 495 | |
490 | 496 | if [ "$gcov" = "1" ]; then |
491 | 497 | echo "CFLAGS+=--coverage" >> Makefile.settings |
492 | 498 | echo "EFLAGS+=--coverage" >> Makefile.settings |
… |
… |
else |
740 | 746 | echo ' Off-the-Record (OTR) Messaging disabled.' |
741 | 747 | fi |
742 | 748 | |
| 749 | if [ -n "$systemdsystemunitdir" ]; then |
| 750 | echo ' systemd enabled.' |
| 751 | else |
| 752 | echo ' systemd disabled.' |
| 753 | fi |
| 754 | |
743 | 755 | echo ' Using event handler: '$events |
744 | 756 | echo ' Using SSL library: '$ssl |
745 | 757 | echo ' Building with these storage backends: '$STORAGES |
diff --git a/init/bitlbee.service b/init/bitlbee.service
new file mode 100644
index 0000000..adc8f52
-
|
+
|
|
| 1 | [Unit] |
| 2 | Description=BitlBee IRC/IM gateway |
| 3 | After=syslog.target |
| 4 | |
| 5 | [Service] |
| 6 | ExecStart=/usr/sbin/bitlbee -F -n |
| 7 | |
| 8 | [Install] |
| 9 | WantedBy=multi-user.target |
diff --git a/init/bitlbee.socket b/init/bitlbee.socket
new file mode 100644
index 0000000..41d63fc
-
|
+
|
|
| 1 | [Unit] |
| 2 | Conflicts=bitlbee.service |
| 3 | |
| 4 | [Socket] |
| 5 | ListenStream=6667 |
| 6 | Accept=yes |
| 7 | |
| 8 | [Install] |
| 9 | WantedBy=sockets.target |
diff --git a/init/bitlbee@.service b/init/bitlbee@.service
new file mode 100644
index 0000000..15d2ad0
-
|
+
|
|
| 1 | [Unit] |
| 2 | Description=BitlBee Per-Connection Server |
| 3 | After=syslog.target |
| 4 | |
| 5 | [Service] |
| 6 | ExecStart=/usr/sbin/bitlbee |
| 7 | StandardInput=socket |