diff --git a/contrib/archlinux/conf.d/ebusd b/contrib/archlinux/conf.d/ebusd index 4efd44dd..5b74ee4d 100644 --- a/contrib/archlinux/conf.d/ebusd +++ b/contrib/archlinux/conf.d/ebusd @@ -4,13 +4,9 @@ # Options to pass to ebusd (run "ebusd -?" for more info): EBUSD_OPTS="--scanconfig" -# In order to run multiple ebusd instances, simply define several EBUSD_OPTS -# with a unique suffix for each. -# Recommended is using a number as suffix for all EBUSD_OPTS settings. -# That number can then be used as additional "instance" parameter to the init.d -# script in order to start/stop an individual ebusd instance instead of all -# instances. -# Example (uncomment the EBUSD_OPTS above): -#EBUSD_OPTS1="--scanconfig -d /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A50285BI-if00-port0 -p 8888 -l /var/log/ebusd1.log" -#EBUSD_OPTS2="--scanconfig -d /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A900acTF-if00-port0 -p 8889 -l /var/log/ebusd2.log" -#EBUSD_OPTS3="--scanconfig -d /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A900beCG-if00-port0 -p 8890 -l /var/log/ebusd3.log" +# MULTIPLE EBUSD INSTANCES WITH SYSTEMD +# In order to run muiltiple ebusd instances on a systemd enabled system, just +# copy the /usr/lib/systemd/system/ebusd.service file to /etc/systemd/system/ +# with a different name (e.g. ebusd-2.service), remove the line starting with +# 'EnvironmentFile=', and replace the '$EBUSD_OPTS' with the options for that +# particular ebusd instance. diff --git a/contrib/debian/default/ebusd b/contrib/debian/default/ebusd index f71664ff..f70e42bc 100644 --- a/contrib/debian/default/ebusd +++ b/contrib/debian/default/ebusd @@ -4,13 +4,20 @@ # Options to pass to ebusd (run "ebusd -?" for more info): EBUSD_OPTS="--scanconfig" -# In order to run multiple ebusd instances, simply define several EBUSD_OPTS -# with a unique suffix for each. -# Recommended is using a number as suffix for all EBUSD_OPTS settings. -# That number can then be used as additional "instance" parameter to the init.d -# script in order to start/stop an individual ebusd instance instead of all -# instances. -# Example (uncomment the EBUSD_OPTS above): +# MULTIPLE EBUSD INSTANCES WITH SYSV +# In order to run multiple ebusd instances on a SysV enabled system, simply +# define several EBUSD_OPTS with a unique suffix for each. Recommended is to +# use a number as suffix for all EBUSD_OPTS settings. That number will then be +# taken as additional "instance" parameter to the init.d script in order to +# start/stop an individual ebusd instance instead of all instances. +# Example: (uncomment the EBUSD_OPTS above) #EBUSD_OPTS1="--scanconfig -d /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A50285BI-if00-port0 -p 8888 -l /var/log/ebusd1.log" #EBUSD_OPTS2="--scanconfig -d /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A900acTF-if00-port0 -p 8889 -l /var/log/ebusd2.log" -#EBUSD_OPTS3="--scanconfig -d /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A900beCG-if00-port0 -p 8890 -l /var/log/ebusd3.log" \ No newline at end of file +#EBUSD_OPTS3="--scanconfig -d /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A900beCG-if00-port0 -p 8890 -l /var/log/ebusd3.log" + +# MULTIPLE EBUSD INSTANCES WITH SYSTEMD +# In order to run muiltiple ebusd instances on a systemd enabled system, just +# copy the /usr/lib/systemd/system/ebusd.service file to /etc/systemd/system/ +# with a different name (e.g. ebusd-2.service), remove the line starting with +# 'EnvironmentFile=', and replace the '$EBUSD_OPTS' with the options for that +# particular ebusd instance. diff --git a/contrib/debian/systemd/ebusd.service b/contrib/debian/systemd/ebusd.service new file mode 100644 index 00000000..00078092 --- /dev/null +++ b/contrib/debian/systemd/ebusd.service @@ -0,0 +1,14 @@ +[Unit] +Description=ebusd, the daemon for communication with eBUS heating systems. +After=network.target +ConditionPathExists=/var/log + +[Service] +Type=forking +Restart=always +PIDFile=/var/run/ebusd.pid +EnvironmentFile=-/etc/conf.d/ebusd +ExecStart=/usr/bin/ebusd $EBUSD_OPTS + +[Install] +WantedBy=multi-user.target diff --git a/make_debian.sh b/make_debian.sh index 3bed6750..75c1fd30 100755 --- a/make_debian.sh +++ b/make_debian.sh @@ -54,10 +54,17 @@ echo "*************" echo " pack" echo "*************" echo -mkdir -p $RELEASE/DEBIAN $RELEASE/etc/init.d $RELEASE/etc/default $RELEASE/etc/ebusd $RELEASE/etc/logrotate.d || exit 1 +mkdir -p $RELEASE/DEBIAN $RELEASE/etc/default $RELEASE/etc/ebusd $RELEASE/etc/logrotate.d || exit 1 rm $RELEASE/usr/bin/ebusfeed -cp contrib/debian/init.d/ebusd $RELEASE/etc/init.d/ebusd || exit 1 -cp contrib/debian/default/ebusd $RELEASE/etc/default/ebusd || exit 1 +if [ -d /run/systemd/system ]; then + mkdir -p $RELEASE/lib/systemd/system || exit 1 + cp contrib/debian/systemd/ebusd.service $RELEASE/lib/systemd/system/ebusd.service || exit 1 + cp contrib/debian/default/ebusd $RELEASE/etc/default/ebusd || exit 1 +else + mkdir -p $RELEASE/etc/init.d || exit 1 + cp contrib/debian/init.d/ebusd $RELEASE/etc/init.d/ebusd || exit 1 + cp contrib/debian/default/ebusd $RELEASE/etc/default/ebusd || exit 1 +fi cp contrib/etc/ebusd/* $RELEASE/etc/ebusd/ || exit 1 cp contrib/etc/logrotate.d/ebusd $RELEASE/etc/logrotate.d/ || exit 1 cp ChangeLog.md $RELEASE/DEBIAN/changelog || exit 1 @@ -70,18 +77,23 @@ Architecture: $ARCH Maintainer: John Baier Homepage: https://github.com/john30/ebusd Bugs: https://github.com/john30/ebusd/issues -Depends: libstdc++6 (>= 4.8.1), libc6, libgcc1$extralibs +Depends: logrotate, libstdc++6 (>= 4.8.1), libc6, libgcc1$extralibs Description: eBUS daemon. ebusd is a daemon for handling communication with eBUS devices connected to a 2-wire bus system. EOF cat < $RELEASE/DEBIAN/dirs /etc/ebusd -/etc/init.d /etc/default /etc/logrotate.d /usr/bin EOF +if [ -d /run/systemd/system ]; then + echo /lib/systemd/system >> $RELEASE/DEBIAN/dirs +else + echo /etc/init.d >> $RELEASE/DEBIAN/dirs +fi + cat < $RELEASE/DEBIAN/postinst #!/bin/sh echo "Instructions:"