Changeset 8ca172f


Ignore:
Timestamp:
2022-12-04T17:09:00Z (2 months ago)
Author:
GitHub <noreply@…>
Branches:
master
Children:
2bd8f39
Parents:
7e90c03
git-author:
Björn Bidar <bjorn.bidar@…> (04-12-22 17:09:00)
git-committer:
GitHub <noreply@…> (04-12-22 17:09:00)
Message:

Systemd Enhancements: Create user and directory automatically (#163)

  • configure: Simplify check for systemd, allow to request systemd support

Signed-off-by: Björn Bidar <bjorn.bidar@…>

  • configure: Add helper to be compatible with old and new systemd pc vars

Re:
https://github.com/systemd/systemd/commit/4908de44b0a0409f84a7cdc5641b114d6ce8ba03

Signed-off-by: Björn Bidar <bjorn.bidar@…>

  • systemd: Support systemd-sysusers.d

Signed-off-by: Björn Bidar <bjorn.bidar@…>

  • systemd: Define StateDirectory, create biltbee directory automatically

Signed-off-by: Björn Bidar <bjorn.bidar@…>

  • systemd: Also listen to /run/bitlbee/socket

Signed-off-by: Björn Bidar <bjorn.bidar@…>

  • systemd: Create RuntimeDirectory automatically

Signed-off-by: Björn Bidar <bjorn.bidar@…>

  • systemd: Also run regular systemd service as user

Signed-off-by: Björn Bidar <bjorn.bidar@…>

Signed-off-by: Björn Bidar <bjorn.bidar@…>

Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    r7e90c03 r8ca172f  
    3333        @echo Installed successfully
    3434        @echo
     35ifndef SYSTEMDSYSTEMUNITDIR
    3536        @if ! [ -d $(DESTDIR)$(CONFIG) ]; then echo -e '\nThe configuration directory $(DESTDIR)$(CONFIG) does not exist yet, don'\''t forget to create it!'; fi
     37endif
    3638        @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
    3739ifdef SYSTEMDSYSTEMUNITDIR
     
    144146endif
    145147
     148ifdef SYSUSERSDIR
     149        $(INSTALL) -Dm644 init/bitlbee.sysusers $(DESTDIR)/$(SYSUSERSDIR)/bitlbee.conf
     150else
     151        @echo SYSUSERSDIR not set, not install sysusers.d files
     152endif
     153
    146154tar:
    147155        fakeroot debian/rules clean || make distclean
  • configure

    r7e90c03 r8ca172f  
    1919includedir='$prefix/include/bitlbee/'
    2020systemdsystemunitdir=''
     21sysusersdir=''
    2122libevent='/usr/'
    2223pidfile='/var/run/bitlbee.pid'
     
    5556
    5657pie=1
     58
     59systemd=auto
    5760
    5861arch=$(uname -s)
     
    129132--plugindir=...                                         $plugindir
    130133--systemdsystemunitdir=...                              $systemdsystemunitdir
     134--sysusersdir                       $sysusersdir
    131135--pidfile=...                                           $pidfile
    132136--config=...                                            $config
     
    157161                                                        $ssl
    158162--external_json_parser=0/1/auto Use External JSON parser $external_json_parser
     163--systemd=0/1  Enable/disable systemd support $systemd
    159164
    160165
     
    750755fi
    751756
    752 if [ -z "$systemdsystemunitdir" ]; then
    753         if $PKG_CONFIG --exists systemd; then
    754                 systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
    755         fi
    756 fi
    757 if [ -n "$systemdsystemunitdir" ]; then
    758         if [ "$systemdsystemunitdir" != "no" ]; then
    759                 echo "SYSTEMDSYSTEMUNITDIR=$systemdsystemunitdir" >> Makefile.settings
    760         fi
     757if [ ! "$systemd" = 0 ]; then
     758    if ! $PKG_CONFIG --exists systemd ; then
     759        if [ -n "$systemdsystemunitdir" ] || [ "$systemd" -eq 1 ]; then
     760            echo "systemd requested but not found"
     761            exit 1
     762        else
     763            systemd=0
     764        fi
     765    fi
     766fi
     767
     768pkgconf_systemd_var() {
     769    # First try deprecated variable, use newer variable if not found
     770    if $PKG_CONFIG --print-variables systemd | grep -q $1 ; then
     771        $PKG_CONFIG --variable=$1 systemd
     772    else
     773        $PKG_CONFIG --variable=$2 systemd
     774    fi
     775}
     776
     777if [ "$systemd" -eq 1 ]; then
     778        if [ -z "$systemdsystemunitdir" ]; then
     779                systemdsystemunitdir=$(pkgconf_systemd_var systemdsystemunitdir systemd_system_unit_dir)
     780        fi
     781    if [ -z "$tmpfiles_dir" ] ; then
     782        tmpfilesdir=$(pkgconf_systemd_var tmpfilesdir tmpfiles_dir)
     783    fi
     784    if [ -z "$sysusersdir" ] ; then
     785        sysusersdir=$(pkgconf_systemd_var sysusersdir sysusers_dir)
     786    fi
     787
     788        echo "SYSTEMDSYSTEMUNITDIR=$systemdsystemunitdir" >> Makefile.settings
     789    echo "SYSUSERSDIR=$sysusersdir" >> Makefile.settings
    761790fi
    762791
     
    10051034fi
    10061035
    1007 if [ -n "$systemdsystemunitdir" ]; then
     1036if [ "$systemd" -eq 1 ]; then
    10081037        echo '  systemd enabled.'
    10091038else
  • init/bitlbee.service.in

    r7e90c03 r8ca172f  
    55ExecStart=@sbindir@bitlbee -F -n
    66KillMode=process
     7StateDirectory=bitlbee
     8RuntimeDirectory=bitlbee
     9User=bitlbee
    710
    811[Install]
  • init/bitlbee.socket

    r7e90c03 r8ca172f  
    44[Socket]
    55ListenStream=6667
     6ListenStream=%t/bitlbee/socket
    67BindToDevice=lo
    78Accept=yes
  • init/bitlbee@.service.in

    r7e90c03 r8ca172f  
    77StandardError=syslog
    88User=bitlbee
     9StateDirectory=bitlbee
     10RuntimeDirectory=bitlbee
Note: See TracChangeset for help on using the changeset viewer.