Ticket #738: 0001-systemd-install-systemd-unit-files.patch

File 0001-systemd-install-systemd-unit-files.patch, 4.3 KB (added by vmiklos@…, at 2010-12-27T16:25:14Z)
  • Makefile

    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) 
    3232uninstall: uninstall-bin uninstall-doc
    3333        @echo -e '\nmake uninstall does not remove files in '$(DESTDIR)$(ETCDIR)', you can use make uninstall-etc to do that.\n'
    3434
    35 install: install-bin install-doc install-plugins
     35install: install-bin install-doc install-plugins install-systemd
    3636        @if ! [ -d $(DESTDIR)$(CONFIG) ]; then echo -e '\nThe configuration directory $(DESTDIR)$(CONFIG) does not exist yet, don'\''t forget to create it!'; fi
    3737        @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
    3838        @echo
    3939
    40 .PHONY:   install   install-bin   install-etc   install-doc install-plugins \
     40.PHONY:   install   install-bin   install-etc   install-doc install-plugins install-systemd \
    4141        uninstall uninstall-bin uninstall-etc uninstall-doc \
    4242        all clean distclean tar $(subdirs)
    4343
    ifdef OTR_PI 
    109109        install -m 0755 otr.so $(DESTDIR)$(PLUGINDIR)
    110110endif
    111111
     112install-systemd:
     113ifdef 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)
     118endif
     119
    112120tar:
    113121        fakeroot debian/rules clean || make distclean
    114122        x=$$(basename $$(pwd)); \
  • configure

    diff --git a/configure b/configure
    index 3a3796d..9313fc7 100755
    a b datadir='$prefix/share/bitlbee/' 
    1515config='/var/lib/bitlbee/'
    1616plugindir='$prefix/lib/bitlbee/'
    1717includedir='$prefix/include/bitlbee/'
     18systemdsystemunitdir=''
    1819libevent='/usr/'
    1920pidfile='/var/run/bitlbee.pid'
    2021ipcsocket='/var/run/bitlbee.sock'
    Option Description Default 
    6263--mandir=...                                            $mandir
    6364--datadir=...                                           $datadir
    6465--plugindir=...                                         $plugindir
     66--systemdsystemunitdir=...                              $systemdsystemunitdir
    6567--pidfile=...                                           $pidfile
    6668--config=...                                            $config
    6769--ipcsocket=...                                         $ipcsocket
    else 
    487489        fi;
    488490fi
    489491
     492if [ -n "systemdsystemunitdir" ]; then
     493        echo "SYSTEMDSYSTEMUNITDIR=$systemdsystemunitdir" >> Makefile.settings
     494fi
     495
    490496if [ "$gcov" = "1" ]; then
    491497        echo "CFLAGS+=--coverage" >> Makefile.settings
    492498        echo "EFLAGS+=--coverage" >> Makefile.settings
    else 
    740746        echo '  Off-the-Record (OTR) Messaging disabled.'
    741747fi
    742748
     749if [ -n "$systemdsystemunitdir" ]; then
     750        echo '  systemd enabled.'
     751else
     752        echo '  systemd disabled.'
     753fi
     754
    743755echo '  Using event handler: '$events
    744756echo '  Using SSL library: '$ssl
    745757echo '  Building with these storage backends: '$STORAGES
  • new file init/bitlbee.service

    diff --git a/init/bitlbee.service b/init/bitlbee.service
    new file mode 100644
    index 0000000..adc8f52
    - +  
     1[Unit]
     2Description=BitlBee IRC/IM gateway
     3After=syslog.target
     4
     5[Service]
     6ExecStart=/usr/sbin/bitlbee -F -n
     7
     8[Install]
     9WantedBy=multi-user.target
  • new file init/bitlbee.socket

    diff --git a/init/bitlbee.socket b/init/bitlbee.socket
    new file mode 100644
    index 0000000..41d63fc
    - +  
     1[Unit]
     2Conflicts=bitlbee.service
     3
     4[Socket]
     5ListenStream=6667
     6Accept=yes
     7
     8[Install]
     9WantedBy=sockets.target
  • new file init/bitlbee@.service

    diff --git a/init/bitlbee@.service b/init/bitlbee@.service
    new file mode 100644
    index 0000000..15d2ad0
    - +  
     1[Unit]
     2Description=BitlBee Per-Connection Server
     3After=syslog.target
     4
     5[Service]
     6ExecStart=/usr/sbin/bitlbee
     7StandardInput=socket