From fe506cb01d86424ddf10d15de4e86bf7a1df6e4a Mon Sep 17 00:00:00 2001 From: Johan S <81185596+JohanSaaw@users.noreply.github.com> Date: Tue, 24 Feb 2026 12:19:31 +0100 Subject: [PATCH 01/19] Delete the Sys V init file for RHEL and SUSE based distibutions. As all the RPM based distributions use systemd now, and have done it for an extended period of time, it is no longer necessary for the Lyrion RPM package to support Sys V Init. --- redhat/lyrionmusicserver.init | 202 ---------------------------------- 1 file changed, 202 deletions(-) delete mode 100644 redhat/lyrionmusicserver.init diff --git a/redhat/lyrionmusicserver.init b/redhat/lyrionmusicserver.init deleted file mode 100644 index dc88459e..00000000 --- a/redhat/lyrionmusicserver.init +++ /dev/null @@ -1,202 +0,0 @@ -#!/bin/bash -# -# lyrionmusicserver Startup script for the Lyrion Music Server -# -# chkconfig: 345 80 30 -# description: Lyrion Music Server powers the Squeezebox, Transporter and SLIMP3 network music \ -# players and is the best software to stream your music to any software MP3 \ -# player. It supports MP3, AAC, WMA, FLAC, Ogg Vorbis, WAV and more! \ -# As of version 7.7 it also supports UPnP clients, serving pictures and movies too! -# processname: lyrionmusicserver -# config: /etc/lyrionmusicserver/lyrionmusicserver.conf -# config: /etc/sysconfig/lyrionmusicserver - -# -### BEGIN INIT INFO -# Provides: lyrionmusicserver -# Required-Start: $syslog $remote_fs -# Should-Start: $time ypbind sendmail -# Required-Stop: $syslog $remote_fs -# Should-Stop: $time ypbind sendmail -# Default-Start: 3 5 -# Default-Stop: 0 1 2 6 -# Short-Description: Startup script for the Lyrion Music Server -# Description: Lyrion Music Server powers the Squeezebox, Transporter and SLIMP3 network music \ -# players and is the best software to stream your music to any software MP3 \ -# player. It supports MP3, AAC, WMA, FLAC, Ogg Vorbis, WAV and more! \ -# As of version 7.7 it also supports UPnP clients, serving pictures and movies too! -### END INIT INFO -# - -if [[ -n $(grep -i -E "(redhat|centos|fedora)" /etc/os-release 2>/dev/null) || -f /etc/redhat-release ]] ; then - redhat=yes - - # Source function library. - . /etc/rc.d/init.d/functions - # Source networking configuration. - . /etc/sysconfig/network - # Check that networking is up. - [ "${NETWORKING}" = "no" ] && exit 0 - - # Check for existence of needed config file and read it - LYRION_CONFIG=/etc/sysconfig/lyrionmusicserver - test -r $LYRION_CONFIG || { echo "$LYRION_CONFIG not existing"; - if [ "$1" = "stop" ]; then exit 0; - else exit 6; fi; } - - # Read config - . $LYRION_CONFIG - - # Check for missing binaries (stale symlinks should not happen) - # Note: Special treatment of stop for LSB conformance - LYRION_BIN="$LYRION_HOME/lyrionmusicserver" - test -x $LYRION_BIN || { echo "$LYRION_BIN not installed"; - if [ "$1" = "stop" ]; then exit 0; - else exit 5; fi; } - - LOCKFILE="/var/lock/subsys/lyrionmusicserver" - RETVAL=0 - - start() { - echo -n "Starting Lyrion Music Server: " - daemon --user $LYRION_USER $LYRION_BIN $LYRION_ARGS - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch $LOCKFILE - return $RETVAL - } - - stop() { - echo -n "Stopping Lyrion Music Server: " - # Support old versions of RHEL and still fix bug 5620 - KILLPROC_ARGS="" - if [ `grep -c 'Usage: killproc.*-d delay' /etc/init.d/functions` -ge 1 ]; then - KILLPROC_ARGS="-d 6" - fi - killproc $KILLPROC_ARGS $LYRION_BIN - RETVAL=$? - if [ $RETVAL -ne 0 ]; then - # If killproc fails, try killall (fix for RHEL4) - killall lyrionmusicserver - RETVAL=$? - [ $RETVAL -eq 0 ] && echo_success - [ $RETVAL -ne 0 ] && echo_failure - fi - echo - [ $RETVAL -eq 0 ] && rm -f $LOCKFILE - return $RETVAL - } - - restart() { - stop - sleep 5 - start - } - - condrestart() { - [ -f $LOCKFILE ] && restart || : - } - - fdr_status() { - status $LYRION_BIN - RETVAL=$? - } - -elif [[ -n $(grep -i -E "(suse|sles)" /etc/os-release 2>/dev/null) || -f /etc/SuSE-release ]]; then - suse=yes - - # Check for existence of needed config file and read it - LYRION_CONFIG=/etc/sysconfig/lyrionmusicserver - test -r $LYRION_CONFIG || { echo "$LYRION_CONFIG not existing"; - if [ "$1" = "stop" ]; then exit 0; - else exit 6; fi; } - - # Read config - . $LYRION_CONFIG - - # Check for missing binaries (stale symlinks should not happen) - # Note: Special treatment of stop for LSB conformance - LYRION_BIN="$LYRION_HOME/lyrionmusicserver" - test -x $LYRION_BIN || { echo "$LYRION_BIN not installed"; - if [ "$1" = "stop" ]; then exit 0; - else exit 5; fi; } - - # Source rc.status and reset - . /etc/rc.status - rc_reset - - start() { - echo -n "Starting Lyrion Music Server: " - export HOME=$LYRION_HOME - startproc -u $LYRION_USER $LYRION_BIN $LYRION_ARGS - rc_status -v - } - - stop() { - echo -n "Stopping Lyrion Music Server: " - killproc -TERM $LYRION_BIN - rc_status -v - } - - restart() { - $0 stop - $0 start - rc_status - } - - condrestart() { - $0 status - if test $? = 0; then - $0 restart - else - rc_reset - fi - rc_status - } - - fdr_status() { - /sbin/checkproc $LYRION_BIN - rc_status -v - } - -else - echo "Unable to detect Linux distribution." - exit 1 -fi - -# Do not change this, it will most likely break the lyrionmusicserver -# installation. The directory /usr/lib/perl5/vendor_perl is where the RPM -# package drops the Slim perl modules. Setting PERL5LIB to this location will -# make sure that the Lyrion Music server executable looks here before it scans the -# directories in the perl @INC array. -export PERL5LIB="/usr/lib/perl5/vendor_perl" - -# See how we were called. -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart|reload|force-reload) - restart - ;; - condrestart|try-restart) - condrestart - ;; - status) - fdr_status - ;; - *) - echo "Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}" - exit 1 -esac - -if [[ -n "$redhat" ]]; then - exit $RETVAL -elif [[ -n "$suse" ]]; then - rc_exit -else - exit 1 -fi From a6d5bfb0d32a7bff92ff4d98055e2ab040d9550d Mon Sep 17 00:00:00 2001 From: Johan S <81185596+JohanSaaw@users.noreply.github.com> Date: Tue, 24 Feb 2026 12:24:18 +0100 Subject: [PATCH 02/19] Updated infrmation on how to use unit drop in files for Lyrion Updated and improved information on how to use systemd drop in files to amend/change the start-up parameters of Lyrion Music Server --- redhat/README.systemd | 156 ++++++++++++++++++++++++++++-------------- 1 file changed, 106 insertions(+), 50 deletions(-) diff --git a/redhat/README.systemd b/redhat/README.systemd index ae82deb7..1b154e6e 100644 --- a/redhat/README.systemd +++ b/redhat/README.systemd @@ -1,14 +1,3 @@ -* BACKGROUND - -The fedora, RedHat, CentOS and SUSE distributions have changed the -start-up system to systemd from SYSV. The distributions offer -some backwards compatibility, but in the long run it is better -to migrate the Lyrion Music Server to use a systemd unit file for -start-up. Systemd seems to be the future for these distributions, -whatever we might think about it. - -* More information - Please read the following man pages for in depth information on how the systemd unit files work. @@ -16,30 +5,80 @@ systemd.unit systemd.service +******************************************************************************** * Stop/Start/Check status of Lyrion Music Server +******************************************************************************** sudo systemctl start lyrionmusicserver sudo systemctl stop lyrionmusicserver systemctl status lyrionmusicserver sudo systemctl restart lyrionmusicserver -* To see the contentof the systemd unit file +******************************************************************************** +* To see the content of the systemd unit file +******************************************************************************** systemctl cat lyrionmusicserver -* The user running Lyrion Music server +******************************************************************************** +* Adapting the Lyrion Music Configuration +******************************************************************************** -Due to the way systemd unit files work it has been deemed better not to -allow setting of the user id running the Lyrion Muisc server in the -/etc/sysconfig/lyrionmusicserver file. To change the user running lyrionmusicserver, -please create a so called drop-in file in the directory: +To tweak, extend or change the Lyrion Music Server it is necessary to use drop +in files for systemd. The drop in files for Lyrion Music Server must be created +in: /etc/systemd/system/lyrionmusicserver.service.d -(you will have to create the directory). The file can be called anything, but -it needs the string .conf at the end, e.g. +You will have to create the directory yourself. The drop in file can be called +anything, but it needs the string ".conf" at the end of the name, e.g. + +lyrion_changed_config.conf + +You can create one or more drop in files in that directory. You can have one or +changes to the configuration in the files. Remember that the files are read in +lexicographical order so that the files read last overrides the files read +earlier if they have overlapping configration statements. + +NOTE: NEVER MAKE ANY CHANGES TO THE UNIT FILE DELIVERED BY RPM PACKAGE IN THE + LOCATION /usr/lib/systemd/system/lyrionmusicserver.service. ANY CHANGES IN + THIS FILE WILL BE OVERWRITTEN NEXT TIME THE LYRION MUSIC SERVER IS + UPGRADED. + +The default systemd unit file comes with a working configuration. Only change +it, if you know what you are doing. + +In the default unit file the following 5 environment variables are defined. + +Environment="LYRION_CFG_DIR=/var/lib/lyrionmusicserver/prefs" +Environment="LYRION_LOG_DIR=/var/log/lyrionmusicserver" +Environment="LYRION_CACHE_DIR=/var/lib/lyrionmusicserver/cache" +Environment="LYRION_CHARSET=utf8" +Environment="LYRION_ADDITIONAL_ARGS=" -mylyrionuser.conf +These environment variables are used further down in the unit file in the start +command. + +You can change the value of the four first variables and add any other command +line parameter to the start command of the Lyrion Music Server by adding one or +more drop in files in /etc/systemd/system/lyrionmusicserver.service.d as +described here above. + +You can also change the user id and group id used to run the server with +drop in files. There is an example here below. + +******************************************************************************** +* +* EXAMPLES +* +******************************************************************************** + +******************************************************************************** +* How to change the log directory location +******************************************************************************** + +Create a file in /etc/systemd/system/lyrionmusicserver.service.d, you can call +the file whatever you like, but the name must end with ".conf". The content of the file should be (without the dashed lines) @@ -47,48 +86,65 @@ The content of the file should be (without the dashed lines) [Service] -USER=add-the-user-id-you-want-to-use-here +Environment="LYRION_LOG_DIR=/your/preferred/location" + ----------------------------------------------- +After you created the file you must tell the systemd to pick up the changes. +Execute: + +sudo systemctl daemon-reload + +Then restart Lyrion Music Server so that it picks up the new configuration. + +NOTE: Make sure that you create the new diretory before you restart the service. + +******************************************************************************** * Passing extra arguments to the Lyrion Music server +******************************************************************************** -The way the variable LYRION_ARGS is defined in /etc/sysconfig/lyrionmusicserver -makes it unusable in the systemd unit file. If you have added parameters to -this variable in the file and you want to keep them, then you must instead add -them to the new variable LYRION_ADDITIONAL_ARGS. You can do this by adding -the following in the /etc/sysconfig/lyrionmusicserver file (without the dashed -lines) +If you want to pass extra variables to Lyrion Music Server at startup, then add +them to the variable LYRION_ADDITIONAL_ARGS. To do this create a drop in file in +/etc/systemd/system/lyrionmusicserver.service.d with this content (without the +dashed lines): ------------------------------------------------ -LYRION_ADDITIONAL_ARGS="--d_startup" +[Service] + +Environment="LYRION_ADDITIONAL_ARGS=--d_startup" ------------------------------------------------ *** PLEASE NOTE *** -You can't use nested variables like in the past for LYRION_ARGS. +You can't use nested variables in the definition for LYRION_ADDITIONAL_ARGS. -An alternative is to create a drop-in file for systemd as described here above -for the USER. You can of course use the same drop-in file, just add an -additional line like this +******************************************************************************** +* How to change the user id and group used to run Lyrion Music Server +******************************************************************************** -Environment="LYRION_ADDITIONAL_ARGS=--d_startup" +Create a file in /etc/systemd/system/lyrionmusicserver.service.d, you can call +the file whatever you like, but the name ust end with ".conf". + +The content of the file should be (without the dashed lines) + +----------------------------------------------- + +[Service] + +USER=the-preferred-user-name +GROUP=the-preferred-group-name + +----------------------------------------------- + +After you created the file you must tell the systemd to pick up the changes. +Execute: + +sudo systemctl daemon-reload -Please remember that the content of /etc/sysconfig/lyrionmusicserver will -override the content of the drop-in files in -/etc/systemd/system/lyrionmusicserver.service.d. This means that if you define -LYRION_ADDITIONAL_ARGS both in the drop-in file and in -/etc/sysconfig/lyrionmusicserver, then it is the content of the latter that will -be used. - -################################################################################ -I strongly recommend to either delete the file /etc/sysconfig/lyrionmusicserver -or comment out all lines in the file and entirely rely on the drop in file in -/etc/systemd/system/lyrionmusicserver.service.d if you want to make any changes -to the way the Lyrion Music server is started. - -** NEVER EDIT ** the file /usr/lib/systemd/systemlyrionmusicserver.service. This -file will be overwritten next time you upgrade the Lyrion Music Server. If you -need to change anything in the unit file, then use the drop-in file in -/etc/systemd/system/lyrionmusicserver.service.d as described here above. +NOTE! +Please bear in mind that changing the user and group that runs the Lyrion Music +Server processes is a far reaching change. You will have to ensure that the new +user id and group id have sufficient read and write rights to all the file used +by the Lyrion Music Server. From 302affadaa32b34e4a1b7ac870ab8f68a66c30e0 Mon Sep 17 00:00:00 2001 From: Johan S <81185596+JohanSaaw@users.noreply.github.com> Date: Tue, 24 Feb 2026 12:28:03 +0100 Subject: [PATCH 03/19] Replace /etc/sysconfig/lyrionmusicserver. The file /etc/sysconfig/lyrionmusicserver was used to configure start-up parameters for the Lyrion Music Server when it was controlled by Sys V Init. The file can also be used by systemd, but it fits very badly in the concept of systemd. It is better not to use it at all. The file is thus replaced by a stub file with some information and a pointer to the README.systemd file. --- redhat/lyrionmusicserver.config | 43 ++++++++------------------------- 1 file changed, 10 insertions(+), 33 deletions(-) diff --git a/redhat/lyrionmusicserver.config b/redhat/lyrionmusicserver.config index 0b3603c7..d65a7726 100644 --- a/redhat/lyrionmusicserver.config +++ b/redhat/lyrionmusicserver.config @@ -1,33 +1,10 @@ -# Edit this to suit your setup -# But if your server is systemd based you could -# consider to comment out all the lines and instead -# use unit drop-in files in /etc/systemd/system/lyrionmusicserver.service.d - -# The variable LYRION_USER will only be picked up by SYSV systems. -# To change the user running lyrionmusicserver on a systemd server, please -# check /usr/share/ilyrionmusicserver/README.systemd -LYRION_USER="lyrionmusicserver" - -# The following variables are picked up by both SYSV and -# systemd based servers -LYRION_HOME="/usr/libexec" -LYRION_CFG_DIR="/var/lib/lyrionmusicserver/prefs" -LYRION_LOG_DIR="/var/log/lyrionmusicserver" -LYRION_CACHE_DIR="/var/lib/lyrionmusicserver/cache" -LYRION_CHARSET="utf8" - -# The variable LYRION_ARGS will only be picked up by SYSV based servers. -# For systemd based system use the LYRION_ADDITIONAL_ARGS here below. -LYRION_ARGS="--daemon --prefsdir=$LYRION_CFG_DIR --logdir=$LYRION_LOG_DIR --cachedir=$LYRION_CACHE_DIR --charset=$LYRION_CHARSET" - -# The variable LYRION_ADDITIONAL_ARGS will only be picked up by -# systemd based servers. To use it uncomment the line here below and -# add any valid arguments you want between the quotation marks. -# Please note you can't use nested variables. - -# LYRION_ADDITIONAL_ARGS="" - -# Alternatively you could use a systemd unit drop in file to define -# LYRION_ADDITIONAL_ARGS, see /usr/share/lyrionmusicserver/README.systemd -# and the systemd.unit, systemd.service man pages. But in that case the above -# line must remain commented as this file takes precedence oce any unit file. +#------------------------------------------------------------------------------ +# PLEASE NOTE! +# +# As the RPM distribution of Lyrion Music Server no longer supports Sys V +# Init, this file has been obsoleted. +# +# Use systemd drop in files instead to adapt/amend the configuration. +# Read /usr/share/lyrionmusicserver/README.systemd for more information. +# +#------------------------------------------------------------------------------ From 541cafb3f49c290f686c65d19226233931fe083b Mon Sep 17 00:00:00 2001 From: Johan S <81185596+JohanSaaw@users.noreply.github.com> Date: Tue, 24 Feb 2026 12:30:35 +0100 Subject: [PATCH 04/19] Fix an error in the logrotate config. The use of pgrep in the postrotate section was wrong --- redhat/lyrionmusicserver.logrotate | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/redhat/lyrionmusicserver.logrotate b/redhat/lyrionmusicserver.logrotate index 90dfbf22..d75b2987 100644 --- a/redhat/lyrionmusicserver.logrotate +++ b/redhat/lyrionmusicserver.logrotate @@ -1,9 +1,14 @@ +# We rely on some of the settings made +# in the global logrotate.conf. That way +# the set-up will be in line with the +# idifferent distribution's defaults. /var/log/lyrionmusicserver/server.log { missingok notifempty sharedscripts postrotate - /bin/kill -USR1 `pgrep lyrionmusicserver >/dev/null 2>&1` >/dev/null 2>&1 || true + # send USR1 to lyriuonmusicserver PID to reset logging + /bin/kill -USR1 `pgrep lyrionmusicser 2>&1` >/dev/null 2>&1 || true endscript } From fe60576abf9f96e268363028cef7a3d0604316d7 Mon Sep 17 00:00:00 2001 From: Johan S <81185596+JohanSaaw@users.noreply.github.com> Date: Tue, 24 Feb 2026 12:34:46 +0100 Subject: [PATCH 05/19] Updates to handle removal of Sys V Init support The Init script file has been removed. Logic for migrating non-standard Sys V Init configuration to systemd has been removed, The systemd unit file is now properly installed using standard RPM techniques Added dependency on system (%systemd_requires) as the package provides a unit file. --- redhat/lyrionmusicserver.service | 9 --------- 1 file changed, 9 deletions(-) diff --git a/redhat/lyrionmusicserver.service b/redhat/lyrionmusicserver.service index da7e7e00..c255014a 100644 --- a/redhat/lyrionmusicserver.service +++ b/redhat/lyrionmusicserver.service @@ -8,20 +8,12 @@ After=network.target # directory /etc/systemd/system/lyrionmusicserver.service.d # Read man page for systemd.unit and systemd.service. # -# Or they can be overriden in /etc/sysconfig/lyrionmusicserver -# The first option is recommended. -Environment="LYRION_HOME=/usr/libexec" Environment="LYRION_CFG_DIR=/var/lib/lyrionmusicserver/prefs" Environment="LYRION_LOG_DIR=/var/log/lyrionmusicserver" Environment="LYRION_CACHE_DIR=/var/lib/lyrionmusicserver/cache" Environment="LYRION_CHARSET=utf8" Environment="LYRION_ADDITIONAL_ARGS=" -# The content of this file will override any setting made with the Environment -# variables here above. It will also override any Environment variables set -# in /etc/systemd/system/lyrionmusicserver.service.d/*.conf -EnvironmentFile=-/etc/sysconfig/lyrionmusicserver - # Do not change this, it will most likely break the lyrionmusicserver # installation. The directory /usr/lib/perl5/vendor_perl is where the RPM # package drops the Slim perl modules. Setting PERL5LIB to this location will @@ -29,7 +21,6 @@ EnvironmentFile=-/etc/sysconfig/lyrionmusicserver # directories in the perl @INC array. Environment="PERL5LIB=/usr/lib/perl5/vendor_perl" -#Type=simple User=lyrionmusicserver Group=lyrionmusicserver ExecStart=/usr/libexec/lyrionmusicserver --prefsdir $LYRION_CFG_DIR --logdir $LYRION_LOG_DIR --cachedir $LYRION_CACHE_DIR --charset $LYRION_CHARSET $LYRION_ADDITIONAL_ARGS From 8e4d931f4d2e046ee96f442724383a31833ab163 Mon Sep 17 00:00:00 2001 From: Johan S <81185596+JohanSaaw@users.noreply.github.com> Date: Tue, 24 Feb 2026 12:54:35 +0100 Subject: [PATCH 06/19] Removal of Sys V Init support The Sys V Init is outdated. Removed the parallel support of Sys V init. Now only supporting systemd. --- redhat/lyrionmusicserver.spec | 168 +++++----------------------------- 1 file changed, 23 insertions(+), 145 deletions(-) diff --git a/redhat/lyrionmusicserver.spec b/redhat/lyrionmusicserver.spec index 3e2b9460..a66c3f99 100644 --- a/redhat/lyrionmusicserver.spec +++ b/redhat/lyrionmusicserver.spec @@ -84,7 +84,6 @@ License: GPL and proprietary URL: https://www.lyrion.org Source0: %{src_basename}.tgz Source1: %{shortname}.config -Source2: %{shortname}.init Source3: %{shortname}.logrotate Source4: %{shortname}.service Source5: README.systemd @@ -104,6 +103,7 @@ Requires(post): /usr/bin/mv Requires(post): /usr/bin/rm Requires(post): /usr/sbin/usermod Requires: perl >= 5.10.0 +%systemd_requires Recommends: perl(IO::Socket::SSL) Provides: %{src_basename} = %{version}-%{release} @@ -145,7 +145,7 @@ rm -rf CPAN/arch/*/MSWin32-x86-multi-thread rm -rf $RPM_BUILD_ROOT # FHS compatible directory structure -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/init.d +mkdir -p $RPM_BUILDROOT%{_unitdir} mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{shortname} mkdir -p $RPM_BUILD_ROOT%{_usr}/lib/perl5/vendor_perl @@ -181,11 +181,10 @@ cp -p gdresized.pl $RPM_BUILD_ROOT%{_usr}/libexec/%{shortname}-resized ln -s %{_var}/lib/%{shortname}/Plugins \ $RPM_BUILD_ROOT%{_datadir}/%{shortname}/Plugins -# Install init, configuration and log files +# Install service, configuration and log files install -Dp -m755 %SOURCE1 $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{shortname} -install -Dp -m755 %SOURCE2 $RPM_BUILD_ROOT%{_datadir}/%{shortname}/%{shortname}.SYSV install -Dp -m644 %SOURCE3 $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{shortname} -install -Dp -m644 %SOURCE4 $RPM_BUILD_ROOT%{_datadir}/%{shortname}/%{shortname}.service +install -Dp -m644 %SOURCE4 $RPM_BUILD_ROOT%{_unitdir}/%{shortname}.service install -Dp -m644 %SOURCE5 $RPM_BUILD_ROOT%{_datadir}/%{shortname}/README.systemd install -Dp -m644 %SOURCE6 $RPM_BUILD_ROOT%{_datadir}/%{shortname}/README.rebranding touch $RPM_BUILD_ROOT%{_var}/lib/%{shortname}/prefs/server.prefs @@ -296,93 +295,6 @@ exit 0 %post -function parseSysconfigSqueezeboxserver { - - test -f /tmp/squeezerpmdebug && set -x - - # Some simple checks on the /etc/sysconfig/squeezeboxserver - # No guarantees that these checks will catch all changes that may have - # been made that might have an impact on the move to systemd - . %{_sysconfdir}/sysconfig/%{shortname} - if [ "$LYRION_USER" != "%{userd}" ] ; then - echo "" - echo "#######################################################################" - echo "You seem to have changed the user id used to run %{shortname}." - echo "Please read %{_datadir}/%{shortname}/README.systemd to find out" - echo "how transfer this change to the new systemd set-up." - echo "#######################################################################" - echo "" - fi - - # Check if any additions to the LYRION_ARGS variable have been made. - # Do that by filter out the ones we know should be there. - extra=`echo $LYRION_ARGS |/usr/bin/perl -lane 'print foreach grep { not m/^(?:--daemon|--prefsdir|--logdir|--cachedir|--charset)(?:=|$)/ } @F'` || : - if [ -n "$extra" ] ; then - echo "" - echo "#######################################################################" - echo "You seem to have changed the LYRION_ARGS variable in %{_sysconfdir}/sysconfig/%{shortname}." - echo "Please read %{_datadir}/%{shortname}/README.systemd to find out" - echo "how transfer this change to the new systemd set-up." - echo "#######################################################################" - echo "" - fi -} - -function setSYSV { - - test -f /tmp/squeezerpmdebug && set -x - - # This is a SYSV server. Copy SYSV script to the correct place. - /usr/bin/cp -p %{_datadir}/%{shortname}/%{shortname}.SYSV %{_sysconfdir}/init.d/%{shortname} >/dev/null 2>&1 || : - - # Koozali SME Server pre version 10 uses SYSV init and uses runlevel 7 - # I have no idea if the release file is still called /etc/e-smit-release. - if [ -f /etc/e-smith-release -a -d /etc/rc7.d ] ; then - /usr/bin/ln -sf %{_sysconfdir}/init.d/%{shortname} /etc/rc7.d/S80%{shortname} >/dev/null 2>&1 || : - db configuration set %{shortname} service status enabled >/dev/null 2>&1 || : - fi - - # Check if we are moving from squeezeboxserver to lyrionmusicserver - # if we are, then we must explicitly stop the squeezeboxserver, - # otherwise the start of the lyrionmusicserver will fail. - if [ -f /var/tmp/SqueezeToLyrion ]; then - /sbin/service squeezeboxserver stop || : - /usr/bin/rm -f /var/tmp/SqueezeToLyrion || : - fi - - /sbin/chkconfig --add %{shortname} >/dev/null 2>&1 || : - /sbin/service %{shortname} restart >/dev/null 2>&1 || : -} - -function setSystemd { - - test -f /tmp/squeezerpmdebug && set -x - # The SME server (now a days Koozali SME) started using systemd with - # version 10 (based on CentOS 7). Next version is based on Rocky Linux. - # So we don't need any special handling for Koozali SME here. - - if [ -n "$migrate" ] ; then - # If we currently are running through a SYSV script. First stop - /sbin/service %{shortname} stop >/dev/null 2>&1 || : - /sbin/chkconfig --del %{shortname} >/dev/null 2>&1 || : - # We should not remove the old SYSV init file. The RPM - # package will take care of this when we do an upgrade. - fi - - # Check if we are moving from squeezeboxserver to lyrionmusicserver - # if we are, then we must explicitly stop the squeezeboxserver, - # otherwise the start of the lyrionmusicserver will fail. - if [ -f /var/tmp/SqueezeToLyrion ]; then - /usr/bin/systemctl stop squeezeboxserver.service >/dev/null 2>&1 || : - /usr/bin/rm -f /var/tmp/SqueezeToLyrion || : - fi - - /usr/bin/cp -p %{_datadir}/%{shortname}/%{shortname}.service /usr/lib/systemd/system/%{shortname}.service || : - /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || : - /usr/bin/systemctl enable %{shortname}.service >/dev/null 2>&1 || : - /usr/bin/systemctl restart %{shortname}.service >/dev/null 2>&1 || : -} - function migrateSqueezeboxServerConfig { test -f /tmp/squeezerpmdebug && set -x @@ -469,81 +381,35 @@ test -f /tmp/squeezerpmdebug && set -x # We will use ID_LIKE and ID from this file . /etc/os-release || : -# If the SYSV init script exists and the server uses systemd -# then migrate to systemd unit file. -if [ -e /etc/init.d/%{shortname} -a -x /usr/bin/systemctl ] ; then - migrate=true -fi - # Check if we need to migrate a squeezeboxserver config to lyrion music server - if [ -f /var/tmp/migrateSqueezeboxserverConfig ]; then migrateSqueezeboxServerConfig fi -if [ ! -x /usr/bin/systemctl ] ; then - setSYSV -else - setSystemd -fi - PORT=`/usr/bin/perl -lane 'if ( /^httpport:/) {print $F[1]; exit}' %{_var}/lib/%{shortname}/prefs/server.prefs` [ -z "$PORT" ] && PORT=9000 HOSTNAME=`uname -n` -if [ -n "$migrate" ] ; then - echo "Lyrion Music Server was migrated from old style SYSV to systemd start-up." - parseSysconfigSqueezeboxserver || : -fi +# Enable and start the Lyrion Music Server +/usr/bin/systemctl daemon-reload >/dev/null 2>&1 || : +/usr/bin/systemctl enable %{shortname}.service >/dev/null 2>&1 || : +/usr/bin/systemctl restart %{shortname}.service >/dev/null 2>&1 || : echo "Point your web browser to http://$HOSTNAME:$PORT/ to configure Lyrion Music Server." %preun test -f /tmp/squeezerpmdebug && set -x -function unsetSYSV { - - /sbin/service %{shortname} stop >/dev/null 2>&1 || : - if [ -f /etc/e-smith-release -a -d /etc/rc7.d ] ; then - #SME Server uses runlevel 7 - db configuration set %{shortname} service status disabled >/dev/null 2>&1 || : - /usr/bin/rm /etc/rc7.d/S80%{shortname} || : - fi - /sbin/chkconfig --del %{shortname} >/dev/null 2>&1 || : - # Remove the SYSV file we copied in the post script. - /usr/bin/rm -f /etc/init.d/%{shortname} || : - -} - -function unsetSystemd { - - # systemd - /usr/bin/systemctl unmask %{shortname}.service >/dev/null 2>&1 || : - /usr/bin/systemctl disable %{shortname}.service >/dev/null 2>&1 || : - /usr/bin/systemctl stop %{shortname}.service >/dev/null 2>&1 || : - # Remove the unit file we copied in the post script. - /usr/bin/rm -f /usr/lib/systemd/system/%{shortname}.service || : - /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || : - -} - . /etc/os-release || : if [ "$1" -eq "0" ] ; then # If not upgrading - # First stop and removethe start-up script/unit file. - if [ ! -x /usr/bin/systemctl ] ; then - - unsetSYSV - - else - - unsetSystemd - - fi + /usr/bin/systemctl stop %{shortname}.service >/dev/null 2>&1 || : + /usr/bin/systemctl disable %{shortname}.service >/dev/null 2>&1 || : + /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || : fi @@ -578,6 +444,9 @@ fi %attr(0644,%{userd},%{groupd}) %ghost %{_var}/log/%{shortname}/server.log %attr(0644,%{userd},%{groupd}) %ghost %{_var}/log/%{shortname}/scanner.log +# Systemd service file. +%attr(0644,root,root) %{_unitdir}/%{shortname}.service + # Configuration files and init script %dir %{_sysconfdir}/%{shortname} %attr(0755,%{userd},%{groupd}) %dir %{_var}/lib/%{shortname}/prefs @@ -605,6 +474,15 @@ fi %changelog +* Sat Feb 21 2026 Johan Saaw +- Remove support for Sys V Init. RedHat and SUSE based distros + moved to systemd many years ago and now they are also removing + backwards compatibility for init scripts, so it is time to + remove Sys V Init components. This includes the lyrionmusicserver + file in /etc/sysconfig. +- Added systemd as pre-requisite with the %systemd_requires macro. +- Fixed error in the logrotate config. + * Mon Oct 20 2025 Peter Oliver - Drop support for Perl versions not currently seen in usage stats. From 026208ea8580e83dea738544299ecd5120eac444 Mon Sep 17 00:00:00 2001 From: Johan S <81185596+JohanSaaw@users.noreply.github.com> Date: Tue, 24 Feb 2026 14:34:11 +0100 Subject: [PATCH 07/19] Fix small error in logrtate config --- redhat/lyrionmusicserver.logrotate | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redhat/lyrionmusicserver.logrotate b/redhat/lyrionmusicserver.logrotate index d75b2987..2578aa26 100644 --- a/redhat/lyrionmusicserver.logrotate +++ b/redhat/lyrionmusicserver.logrotate @@ -1,7 +1,7 @@ # We rely on some of the settings made # in the global logrotate.conf. That way # the set-up will be in line with the -# idifferent distribution's defaults. +# different distribution's defaults. /var/log/lyrionmusicserver/server.log { missingok notifempty From 13d71169513577eb0cec8220e789348f88707020 Mon Sep 17 00:00:00 2001 From: Johan S <81185596+JohanSaaw@users.noreply.github.com> Date: Tue, 24 Feb 2026 14:34:59 +0100 Subject: [PATCH 08/19] Remove Sys V Init support Some further small teaks to the explanations to make it more readable. --- README.systemd | 151 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 README.systemd diff --git a/README.systemd b/README.systemd new file mode 100644 index 00000000..ccb7e814 --- /dev/null +++ b/README.systemd @@ -0,0 +1,151 @@ +Please read the following man pages for in depth information on how +the systemd unit files work. + +systemd.unit +systemd.service + + +******************************************************************************** +* Stop/Start/Check status of Lyrion Music Server +******************************************************************************** + +sudo systemctl start lyrionmusicserver +sudo systemctl stop lyrionmusicserver +systemctl status lyrionmusicserver +sudo systemctl restart lyrionmusicserver + +******************************************************************************** +* To see the content of the systemd unit file +******************************************************************************** + +systemctl cat lyrionmusicserver + +******************************************************************************** +* Adapting the Lyrion Music Configuration +******************************************************************************** + +To tweak, extend or change the Lyrion Music Server it is necessary to use drop +in files for systemd. The drop in files for Lyrion Music Server must be created +in: + +/etc/systemd/system/lyrionmusicserver.service.d + +You will have to create the directory yourself. The drop in file can be called +anything, but it needs the string ".conf" at the end of the name, e.g. + +lyrion_changed_config.conf + +You can create one or more drop in files in that directory. You can have one or +more changes to the configuration in the files. Remember that the files are read +in lexicographic order so that the files read last overrides the files read +earlier if they have overlapping configuration statements. + +NOTE: NEVER MAKE ANY CHANGES TO THE UNIT FILE DELIVERED BY RPM PACKAGE IN THE + LOCATION /usr/lib/systemd/system/lyrionmusicserver.service. ANY CHANGES IN + THIS FILE WILL BE OVERWRITTEN NEXT TIME THE LYRION MUSIC SERVER IS + UPGRADED. + +The default systemd unit file comes with a working configuration. Only change +it, if you know what you are doing. + +In the default unit file the following 5 environment variables are defined. + +Environment="LYRION_CFG_DIR=/var/lib/lyrionmusicserver/prefs" +Environment="LYRION_LOG_DIR=/var/log/lyrionmusicserver" +Environment="LYRION_CACHE_DIR=/var/lib/lyrionmusicserver/cache" +Environment="LYRION_CHARSET=utf8" +Environment="LYRION_ADDITIONAL_ARGS=" + +These environment variables are used further down in the unit file in the start +command. + +You can change the Lyrion start-up command by changing the value of the four +first variables here above and add any other command line parameter to the start +command by using the variable LYRION_ADDITIONAL_ARGS by adding one or +more drop in files in /etc/systemd/system/lyrionmusicserver.service.d as +described here above. + +You can also change the user id and group id used to run the server with +drop in files. There is an example here below. + +******************************************************************************** +* +* EXAMPLES +* +******************************************************************************** + +******************************************************************************** +* How to change the log directory location +******************************************************************************** + +Create a file in /etc/systemd/system/lyrionmusicserver.service.d, you can call +the file whatever you like, but the name must end with ".conf". + +The content of the file should be (without the dashed lines) + +----------------------------------------------- + +[Service] + +Environment="LYRION_LOG_DIR=/your/preferred/location" + + +----------------------------------------------- + +After you created the file you must tell the systemd to pick up the changes. +Execute: + +sudo systemctl daemon-reload + +Then restart Lyrion Music Server so that it picks up the new configuration. + +NOTE: Make sure that you create the new diretory before you restart the service. + +******************************************************************************** +* Passing extra arguments to the Lyrion Music server +******************************************************************************** + +If you want to pass extra variables to Lyrion Music Server at startup, then add +them to the variable LYRION_ADDITIONAL_ARGS. To do this create a drop in file in +/etc/systemd/system/lyrionmusicserver.service.d with this content (without the +dashed lines): + +------------------------------------------------ + +[Service] + +Environment="LYRION_ADDITIONAL_ARGS=--d_startup" + +------------------------------------------------ + +*** PLEASE NOTE *** +You can't use nested variables in the definition for LYRION_ADDITIONAL_ARGS. + +******************************************************************************** +* How to change the user id and group used to run Lyrion Music Server +******************************************************************************** + +Create a file in /etc/systemd/system/lyrionmusicserver.service.d, you can call +the file whatever you like, but the name ust end with ".conf". + +The content of the file should be (without the dashed lines) + +----------------------------------------------- + +[Service] + +USER=the-preferred-user-name +GROUP=the-preferred-group-name + +----------------------------------------------- + +After you created the file you must tell the systemd to pick up the changes. +Execute: + +sudo systemctl daemon-reload + +NOTE! +Please bear in mind that changing the user and group that runs the Lyrion Music +Server processes is a far reaching change. You will have to ensure that the new +user id and group id have sufficient read and write rights to all the file used +by the Lyrion Music Server. From 56d277ea0010953fc6ed9c6af103c56ba56aa047 Mon Sep 17 00:00:00 2001 From: Johan S <81185596+JohanSaaw@users.noreply.github.com> Date: Tue, 24 Feb 2026 14:36:59 +0100 Subject: [PATCH 09/19] Remove Sys V Init support Made some changes to improve the explanations on how to use drop in files for the systemd unit file. --- redhat/README.systemd | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/redhat/README.systemd b/redhat/README.systemd index 1b154e6e..ccb7e814 100644 --- a/redhat/README.systemd +++ b/redhat/README.systemd @@ -36,9 +36,9 @@ anything, but it needs the string ".conf" at the end of the name, e.g. lyrion_changed_config.conf You can create one or more drop in files in that directory. You can have one or -changes to the configuration in the files. Remember that the files are read in -lexicographical order so that the files read last overrides the files read -earlier if they have overlapping configration statements. +more changes to the configuration in the files. Remember that the files are read +in lexicographic order so that the files read last overrides the files read +earlier if they have overlapping configuration statements. NOTE: NEVER MAKE ANY CHANGES TO THE UNIT FILE DELIVERED BY RPM PACKAGE IN THE LOCATION /usr/lib/systemd/system/lyrionmusicserver.service. ANY CHANGES IN @@ -59,8 +59,9 @@ Environment="LYRION_ADDITIONAL_ARGS=" These environment variables are used further down in the unit file in the start command. -You can change the value of the four first variables and add any other command -line parameter to the start command of the Lyrion Music Server by adding one or +You can change the Lyrion start-up command by changing the value of the four +first variables here above and add any other command line parameter to the start +command by using the variable LYRION_ADDITIONAL_ARGS by adding one or more drop in files in /etc/systemd/system/lyrionmusicserver.service.d as described here above. From a320f9e638762ac2fc81ef79426f314e469e2049 Mon Sep 17 00:00:00 2001 From: Johan S <81185596+JohanSaaw@users.noreply.github.com> Date: Tue, 24 Feb 2026 14:40:20 +0100 Subject: [PATCH 10/19] Remove Sys V Init support Removed references to Sys V Init in the README file. --- redhat/README.rebranding | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/redhat/README.rebranding b/redhat/README.rebranding index bf0dfedc..fca59641 100644 --- a/redhat/README.rebranding +++ b/redhat/README.rebranding @@ -16,17 +16,10 @@ stopped also changes. systemctl stop lyrionmusicserver -> Stops the music server systemctl status lyrionmusicserver -> Shows the status of the music server -- SYSV init system - - /etc/init.d/lyrionmusicserver start -> Starts the music server - /etc/init.d/lyrionmusicserver stop -> Stops the music server - /etc/init.d/lyrionmusicserver status -> Shows the status of the music server - Configuration files are in /var/lib/lyrionmusicserver /etc/lyrionmusicserver - /etc/sysconfig/lyrionmusicserver Log files in @@ -52,11 +45,6 @@ locations of the Lyrion Music Server. This will be done if, and only if If these two conditions are not met, then the Lyrion Music Server must be configured from scratch or you can migrate your configuration manually. -** NOTE ** -If you have made changes to /etc/sysconfig/squeezeboxserver, then you must -do those changes to /etc/sysconfig/lyrionmusicserver yourself, if you want -to keep them. - ** NOTE ** If you have created a drop-in file for the systemd service squeezeboxserver, then you must create the corresponding drop-in file for the systemd service From 1dadef3c7431c3487259ffb8fb3e28ba9d40f1b0 Mon Sep 17 00:00:00 2001 From: Johan S <81185596+JohanSaaw@users.noreply.github.com> Date: Tue, 24 Feb 2026 20:57:27 +0100 Subject: [PATCH 11/19] Fix error in logrotate.conf Fixed a silly typo in a comment. --- redhat/lyrionmusicserver.logrotate | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redhat/lyrionmusicserver.logrotate b/redhat/lyrionmusicserver.logrotate index 2578aa26..35802c12 100644 --- a/redhat/lyrionmusicserver.logrotate +++ b/redhat/lyrionmusicserver.logrotate @@ -7,7 +7,7 @@ notifempty sharedscripts postrotate - # send USR1 to lyriuonmusicserver PID to reset logging + # send USR1 to lyrionmusicserver PID to reset logging /bin/kill -USR1 `pgrep lyrionmusicser 2>&1` >/dev/null 2>&1 || true endscript } From 7f71b68d8afd9e516a15221fe6380746c034eb89 Mon Sep 17 00:00:00 2001 From: Johan S <81185596+JohanSaaw@users.noreply.github.com> Date: Fri, 27 Feb 2026 20:13:09 +0100 Subject: [PATCH 12/19] Use systemctl to signal LMS after log rotation. Suggestion by mavit, to use systemctl functionality to signal lyruionmusicserver with USR1 after log rotation. --- redhat/lyrionmusicserver.logrotate | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/redhat/lyrionmusicserver.logrotate b/redhat/lyrionmusicserver.logrotate index 35802c12..eb49db02 100644 --- a/redhat/lyrionmusicserver.logrotate +++ b/redhat/lyrionmusicserver.logrotate @@ -7,8 +7,8 @@ notifempty sharedscripts postrotate - # send USR1 to lyrionmusicserver PID to reset logging - /bin/kill -USR1 `pgrep lyrionmusicser 2>&1` >/dev/null 2>&1 || true + # send USR1 to main lyrionmusicserver process to reset logging + /usr/bin/systemctl --kill-whom=main --signal=USR1 kill lyrionmusicserver.service endscript } From 059065012aee7c7d323903175c4102483d7a7585 Mon Sep 17 00:00:00 2001 From: Johan S <81185596+JohanSaaw@users.noreply.github.com> Date: Sat, 28 Feb 2026 16:41:47 +0100 Subject: [PATCH 13/19] Added support for systemd preset functionality. - Added systemd as pre-requisite with the %systemd_requires macro. - Added BuildRequires systemd-rpm-macros - Added use of systemd_pre, systemd_preun, systemd_post and systemd_postun_with_restart to initialise and handle the unit file and service correctly. - Added a systemd preset file to enable lyrionmusicserver at installation time. - Added logic to start lyrionmusicserver immediately during install if it is a first time installation. Upgrades will follow the packaging rules. --- redhat/lyrionmusicserver.spec | 120 ++++++++++++++++++++++++---------- 1 file changed, 84 insertions(+), 36 deletions(-) diff --git a/redhat/lyrionmusicserver.spec b/redhat/lyrionmusicserver.spec index a66c3f99..7e838758 100644 --- a/redhat/lyrionmusicserver.spec +++ b/redhat/lyrionmusicserver.spec @@ -88,10 +88,13 @@ Source3: %{shortname}.logrotate Source4: %{shortname}.service Source5: README.systemd Source6: README.rebranding +Source7: %{shortname}.preset BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot Vendor: Lyrion Community +BuildRequires: systemd-rpm-macros +%systemd_requires Requires(pre): /usr/bin/getent Requires(pre): /usr/bin/touch Requires(pre): /usr/sbin/groupadd @@ -102,8 +105,21 @@ Requires(post): /usr/bin/ln Requires(post): /usr/bin/mv Requires(post): /usr/bin/rm Requires(post): /usr/sbin/usermod -Requires: perl >= 5.10.0 -%systemd_requires + +# The SUSE and Fedora/RedHat universes have decided differently +# on how PERL returns version numbers. The following line +# works on Fedora/RedHat but not on SUSE. +#Requires: (perl(:VERSION) >= 5.22 and perl(:VERSION) < 5.43) +# The following line works on SUSE but not on Fedore/RedHat flavours +#Requires: (perl >= 5.22 and perl < 5.43) +# The following 2 lines work on SUSE but not on Fedora/RedHat. +#Requires: perl >= 5.22 +#Conflicts: perl >= 5.43 +# It leaves this possibility if we want to have a require statement +# that requires PERL higher than 5.22 but lower than 5.43. This works +# on both SUSE and Fedora/RedHat. +Requires: (perl(:MODULE_COMPAT_5.22.0) or perl(:MODULE_COMPAT_5.24.0) or perl(:MODULE_COMPAT_5.26.0) or perl(:MODULE_COMPAT_5.28.0) or perl(:MODULE_COMPAT_5.30.0) or perl(:MODULE_COMPAT_5.32.0) or perl(:MODULE_COMPAT_5.34.0) or perl(:MODULE_COMPAT_5.36.0) or perl(:MODULE_COMPAT_5.38.0) or perl(:MODULE_COMPAT_5.40.0) or perl(:MODULE_COMPAT_5.42.0)) + Recommends: perl(IO::Socket::SSL) Provides: %{src_basename} = %{version}-%{release} @@ -145,7 +161,8 @@ rm -rf CPAN/arch/*/MSWin32-x86-multi-thread rm -rf $RPM_BUILD_ROOT # FHS compatible directory structure -mkdir -p $RPM_BUILDROOT%{_unitdir} +mkdir -p $RPM_BUILD_ROOT%{_unitdir} +mkdir -p $RPM_BUILD_ROOT%{_presetdir} mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{shortname} mkdir -p $RPM_BUILD_ROOT%{_usr}/lib/perl5/vendor_perl @@ -187,6 +204,7 @@ install -Dp -m644 %SOURCE3 $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{shortname install -Dp -m644 %SOURCE4 $RPM_BUILD_ROOT%{_unitdir}/%{shortname}.service install -Dp -m644 %SOURCE5 $RPM_BUILD_ROOT%{_datadir}/%{shortname}/README.systemd install -Dp -m644 %SOURCE6 $RPM_BUILD_ROOT%{_datadir}/%{shortname}/README.rebranding +install -Dp -m644 %SOURCE7 $RPM_BUILD_ROOT%{_presetdir}/50-%{shortname}.preset touch $RPM_BUILD_ROOT%{_var}/lib/%{shortname}/prefs/server.prefs touch $RPM_BUILD_ROOT%{_var}/lib/%{shortname}/prefs/log.conf cp -p convert.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{shortname} @@ -280,7 +298,10 @@ function checkConfigMigration () { return 0 } +test -f /tmp/squeezerpmdebug && echo "pre script" test -f /tmp/squeezerpmdebug && set -x + +# Create user and group if needed. /usr/bin/getent group %{groupd} >/dev/null || /usr/sbin/groupadd -r %{groupd} /usr/bin/getent passwd %{userd} >/dev/null || \ /usr/sbin/useradd -r -g %{groupd} -d %{_datadir}/%{shortname} -s /sbin/nologin \ @@ -291,6 +312,10 @@ test -f /tmp/squeezerpmdebug && set -x # configuration is necessary checkConfigMigration +# The following deals with the handling of the unit file so that +# the service is initialised according to the packaging rules. +%systemd_pre %{shortname}.service + exit 0 @@ -362,25 +387,20 @@ function migrateSqueezeboxServerConfig { echo "Server. All Components of the software have been re-branded from" echo "squeezeboxserver to lyrionmusicserver." echo "To stop and start the software use:" - echo "systemd start lyrionmusicserver (on systemd systems)" - echo "/sbin/service lyrionmusicserver start (on SYSV Init systems)." + echo "systemd start lyrionmusicserver" echo "and analogous for stop, status etc." echo "" - echo "If you have made changes to /etc/sysconfig/squeezeboxserver, then you" - echo "must transfer those changes yourself to /etc/sysconfig/%{shortname}." echo "" echo "For more information, read %{_datadir}/%{shortname}/README.rebranding." + echo "For more information, read %{_datadir}/%{shortname}/README.systemd." echo "################################################################################" echo "" } +test -f /tmp/squeezerpmdebug && echo "post script" test -f /tmp/squeezerpmdebug && set -x -# Source /etc/os-release to find out what kind of system we are on. -# We will use ID_LIKE and ID from this file -. /etc/os-release || : - # Check if we need to migrate a squeezeboxserver config to lyrion music server if [ -f /var/tmp/migrateSqueezeboxserverConfig ]; then @@ -388,33 +408,54 @@ if [ -f /var/tmp/migrateSqueezeboxserverConfig ]; then fi -PORT=`/usr/bin/perl -lane 'if ( /^httpport:/) {print $F[1]; exit}' %{_var}/lib/%{shortname}/prefs/server.prefs` -[ -z "$PORT" ] && PORT=9000 -HOSTNAME=`uname -n` +# The following continues the initialisation of the service from +# the pre script. It will use the systemd.preset files to decide +# whether the service should be enabled or disabled by default. +%systemd_post %{shortname}.service + +# Here is an anomaly that I introduce to honour the long standing +# tradition that the Lyrion Music Server is started immediately +# if it is a first time installation. This of course contradicts +# the packaging rules of Fedora/SUSE et al +if [ "$1" -eq "1" ] ; then + # This is a first time install. + /usr/bin/systemctl start %{shortname}.service || : + + PORT=`/usr/bin/perl -lane 'if ( /^httpport:/) {print $F[1]; exit}' %{_var}/lib/%{shortname}/prefs/server.prefs` || : + [ -z "$PORT" ] && PORT=9000 + HOSTNAME=`uname -n` || : + echo "Point your web browser to http://$HOSTNAME:$PORT/ to configure Lyrion Music Server." || : +else + # The following should normally be done in the postun script, + # but as versions before 9.2 did not use the systemd_* macros to initialise + # the service according to the packaging rules and the postun script was + # empty, we need to do this here. + # This bit of code should eentually be removed when we think most of the users are on + # version 9.2 or newer. + /usr/bin/systemctl try-restart %{shortname}.service || : +fi -# Enable and start the Lyrion Music Server -/usr/bin/systemctl daemon-reload >/dev/null 2>&1 || : -/usr/bin/systemctl enable %{shortname}.service >/dev/null 2>&1 || : -/usr/bin/systemctl restart %{shortname}.service >/dev/null 2>&1 || : +exit 0 -echo "Point your web browser to http://$HOSTNAME:$PORT/ to configure Lyrion Music Server." %preun +test -f /tmp/squeezerpmdebug && echo "preun script" test -f /tmp/squeezerpmdebug && set -x -. /etc/os-release || : - -if [ "$1" -eq "0" ] ; then - # If not upgrading +# Use this macro to ensure proper +# handling of the service. +%systemd_preun %{shortname}.service - /usr/bin/systemctl stop %{shortname}.service >/dev/null 2>&1 || : - /usr/bin/systemctl disable %{shortname}.service >/dev/null 2>&1 || : - /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || : -fi +%postun +test -f /tmp/squeezerpmdebug && echo "postun script" +test -f /tmp/squeezerpmdebug && set -x +# Use this macro to ensure proper +# handling of the service. +%systemd_postun_with_restart %{shortname}.service -%postun +exit 0 %files @@ -444,8 +485,9 @@ fi %attr(0644,%{userd},%{groupd}) %ghost %{_var}/log/%{shortname}/server.log %attr(0644,%{userd},%{groupd}) %ghost %{_var}/log/%{shortname}/scanner.log -# Systemd service file. +# Systemd service file and preset file. %attr(0644,root,root) %{_unitdir}/%{shortname}.service +%attr(0644,root,root) %{_presetdir}/50-%{shortname}.preset # Configuration files and init script %dir %{_sysconfdir}/%{shortname} @@ -474,14 +516,20 @@ fi %changelog -* Sat Feb 21 2026 Johan Saaw -- Remove support for Sys V Init. RedHat and SUSE based distros - moved to systemd many years ago and now they are also removing - backwards compatibility for init scripts, so it is time to - remove Sys V Init components. This includes the lyrionmusicserver - file in /etc/sysconfig. +* Sat Feb 28 2026 Johan Saaw +- Removed support for Sys V Init. RedHat and SUSE based distros + moved to systemd many years ago. Also removed support for + /etc/sysconfig/lyrionmusicserver - Added systemd as pre-requisite with the %systemd_requires macro. -- Fixed error in the logrotate config. +- Added BuildRequires systemd-rpm-macros +- Added use of systemd_pre, systemd_preun, systemd_post and + systemd_postun_with_restart to initialise and handle the unit + file and service correctly. +- Added a systemd preset file to enable lyrionmusicserver at + installation time. +- Added logic to start lyrionmusicserver immediately during + install if it is a first time installation. Upgrades will + follow the packaging rules. * Mon Oct 20 2025 Peter Oliver - Drop support for Perl versions not currently seen in usage stats. From 5de74b93752dd8666e67753848f0a495abb2a392 Mon Sep 17 00:00:00 2001 From: Johan S <81185596+JohanSaaw@users.noreply.github.com> Date: Sat, 28 Feb 2026 16:42:44 +0100 Subject: [PATCH 14/19] Add systemd preset file for Lyrion Added a systemd preset file to enable lyrionmusicserver immediately at installation. --- redhat/lyrionmusicserver.preset | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 redhat/lyrionmusicserver.preset diff --git a/redhat/lyrionmusicserver.preset b/redhat/lyrionmusicserver.preset new file mode 100644 index 00000000..8be4cda0 --- /dev/null +++ b/redhat/lyrionmusicserver.preset @@ -0,0 +1,6 @@ +#------------------------------------------------------------------------------- +# We want the lyrionmusicserver to be enabled immediately after installation. +# The reason is that all configuration is performed via the web-GUI. There is +# no configurations to be done on the command line or manually in files. +#------------------------------------------------------------------------------- +enable lyrionmusicserver.service From c3282634e13f3181db5e221d42e3f743ae44e023 Mon Sep 17 00:00:00 2001 From: Johan S <81185596+JohanSaaw@users.noreply.github.com> Date: Sat, 28 Feb 2026 16:44:31 +0100 Subject: [PATCH 15/19] Delete README.systemd Added in wrong location. --- README.systemd | 151 ------------------------------------------------- 1 file changed, 151 deletions(-) delete mode 100644 README.systemd diff --git a/README.systemd b/README.systemd deleted file mode 100644 index ccb7e814..00000000 --- a/README.systemd +++ /dev/null @@ -1,151 +0,0 @@ -Please read the following man pages for in depth information on how -the systemd unit files work. - -systemd.unit -systemd.service - - -******************************************************************************** -* Stop/Start/Check status of Lyrion Music Server -******************************************************************************** - -sudo systemctl start lyrionmusicserver -sudo systemctl stop lyrionmusicserver -systemctl status lyrionmusicserver -sudo systemctl restart lyrionmusicserver - -******************************************************************************** -* To see the content of the systemd unit file -******************************************************************************** - -systemctl cat lyrionmusicserver - -******************************************************************************** -* Adapting the Lyrion Music Configuration -******************************************************************************** - -To tweak, extend or change the Lyrion Music Server it is necessary to use drop -in files for systemd. The drop in files for Lyrion Music Server must be created -in: - -/etc/systemd/system/lyrionmusicserver.service.d - -You will have to create the directory yourself. The drop in file can be called -anything, but it needs the string ".conf" at the end of the name, e.g. - -lyrion_changed_config.conf - -You can create one or more drop in files in that directory. You can have one or -more changes to the configuration in the files. Remember that the files are read -in lexicographic order so that the files read last overrides the files read -earlier if they have overlapping configuration statements. - -NOTE: NEVER MAKE ANY CHANGES TO THE UNIT FILE DELIVERED BY RPM PACKAGE IN THE - LOCATION /usr/lib/systemd/system/lyrionmusicserver.service. ANY CHANGES IN - THIS FILE WILL BE OVERWRITTEN NEXT TIME THE LYRION MUSIC SERVER IS - UPGRADED. - -The default systemd unit file comes with a working configuration. Only change -it, if you know what you are doing. - -In the default unit file the following 5 environment variables are defined. - -Environment="LYRION_CFG_DIR=/var/lib/lyrionmusicserver/prefs" -Environment="LYRION_LOG_DIR=/var/log/lyrionmusicserver" -Environment="LYRION_CACHE_DIR=/var/lib/lyrionmusicserver/cache" -Environment="LYRION_CHARSET=utf8" -Environment="LYRION_ADDITIONAL_ARGS=" - -These environment variables are used further down in the unit file in the start -command. - -You can change the Lyrion start-up command by changing the value of the four -first variables here above and add any other command line parameter to the start -command by using the variable LYRION_ADDITIONAL_ARGS by adding one or -more drop in files in /etc/systemd/system/lyrionmusicserver.service.d as -described here above. - -You can also change the user id and group id used to run the server with -drop in files. There is an example here below. - -******************************************************************************** -* -* EXAMPLES -* -******************************************************************************** - -******************************************************************************** -* How to change the log directory location -******************************************************************************** - -Create a file in /etc/systemd/system/lyrionmusicserver.service.d, you can call -the file whatever you like, but the name must end with ".conf". - -The content of the file should be (without the dashed lines) - ------------------------------------------------ - -[Service] - -Environment="LYRION_LOG_DIR=/your/preferred/location" - - ------------------------------------------------ - -After you created the file you must tell the systemd to pick up the changes. -Execute: - -sudo systemctl daemon-reload - -Then restart Lyrion Music Server so that it picks up the new configuration. - -NOTE: Make sure that you create the new diretory before you restart the service. - -******************************************************************************** -* Passing extra arguments to the Lyrion Music server -******************************************************************************** - -If you want to pass extra variables to Lyrion Music Server at startup, then add -them to the variable LYRION_ADDITIONAL_ARGS. To do this create a drop in file in -/etc/systemd/system/lyrionmusicserver.service.d with this content (without the -dashed lines): - ------------------------------------------------- - -[Service] - -Environment="LYRION_ADDITIONAL_ARGS=--d_startup" - ------------------------------------------------- - -*** PLEASE NOTE *** -You can't use nested variables in the definition for LYRION_ADDITIONAL_ARGS. - -******************************************************************************** -* How to change the user id and group used to run Lyrion Music Server -******************************************************************************** - -Create a file in /etc/systemd/system/lyrionmusicserver.service.d, you can call -the file whatever you like, but the name ust end with ".conf". - -The content of the file should be (without the dashed lines) - ------------------------------------------------ - -[Service] - -USER=the-preferred-user-name -GROUP=the-preferred-group-name - ------------------------------------------------ - -After you created the file you must tell the systemd to pick up the changes. -Execute: - -sudo systemctl daemon-reload - -NOTE! -Please bear in mind that changing the user and group that runs the Lyrion Music -Server processes is a far reaching change. You will have to ensure that the new -user id and group id have sufficient read and write rights to all the file used -by the Lyrion Music Server. From b69756dc5dcab8684911c2918e36081eface71ab Mon Sep 17 00:00:00 2001 From: Johan S <81185596+JohanSaaw@users.noreply.github.com> Date: Sat, 28 Feb 2026 16:52:26 +0100 Subject: [PATCH 16/19] Added systemd preset file for RPM Added systemd preset file for RPM. Removed Sys V init file for RPM. --- buildme.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildme.pl b/buildme.pl index fdad4f7c..6b1250dc 100755 --- a/buildme.pl +++ b/buildme.pl @@ -634,9 +634,9 @@ sub buildRPM { ## Copy the various SPEC< Config, etc files into the right dirs... copy("$buildDir/platforms/redhat/lyrionmusicserver.config", "$buildDir/rpm/SOURCES"); - copy("$buildDir/platforms/redhat/lyrionmusicserver.init", "$buildDir/rpm/SOURCES"); copy("$buildDir/platforms/redhat/lyrionmusicserver.logrotate", "$buildDir/rpm/SOURCES"); copy("$buildDir/platforms/redhat/lyrionmusicserver.service", "$buildDir/rpm/SOURCES"); + copy("$buildDir/platforms/redhat/lyrionmusicserver.preset", "$buildDir/rpm/SOURCES"); copy("$buildDir/platforms/redhat/README.systemd", "$buildDir/rpm/SOURCES"); copy("$buildDir/platforms/redhat/README.rebranding", "$buildDir/rpm/SOURCES"); copy("$buildDir/platforms/redhat/lyrionmusicserver.spec", "$buildDir/rpm/SPECS"); From 3e6c31795f5d1be1839774c60e86f14977415ff1 Mon Sep 17 00:00:00 2001 From: Johan S <81185596+JohanSaaw@users.noreply.github.com> Date: Mon, 2 Mar 2026 11:28:37 +0100 Subject: [PATCH 17/19] Refined perl Requires statement Refined the perl Requires statement to work on both SUSE and RedHat based distros. Will work with both rpm and zypper/dnf commands. Now requires minimum v 5.22 and less than v. 5.43. Also changed Recommends: perl(IO::Socket::SSL) to Requires: perl(IO::Socket::SSL) As I noticed that a lot of functionality in LMS will not work without that. --- redhat/lyrionmusicserver.spec | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/redhat/lyrionmusicserver.spec b/redhat/lyrionmusicserver.spec index 7e838758..088e1817 100644 --- a/redhat/lyrionmusicserver.spec +++ b/redhat/lyrionmusicserver.spec @@ -105,22 +105,8 @@ Requires(post): /usr/bin/ln Requires(post): /usr/bin/mv Requires(post): /usr/bin/rm Requires(post): /usr/sbin/usermod - -# The SUSE and Fedora/RedHat universes have decided differently -# on how PERL returns version numbers. The following line -# works on Fedora/RedHat but not on SUSE. -#Requires: (perl(:VERSION) >= 5.22 and perl(:VERSION) < 5.43) -# The following line works on SUSE but not on Fedore/RedHat flavours -#Requires: (perl >= 5.22 and perl < 5.43) -# The following 2 lines work on SUSE but not on Fedora/RedHat. -#Requires: perl >= 5.22 -#Conflicts: perl >= 5.43 -# It leaves this possibility if we want to have a require statement -# that requires PERL higher than 5.22 but lower than 5.43. This works -# on both SUSE and Fedora/RedHat. -Requires: (perl(:MODULE_COMPAT_5.22.0) or perl(:MODULE_COMPAT_5.24.0) or perl(:MODULE_COMPAT_5.26.0) or perl(:MODULE_COMPAT_5.28.0) or perl(:MODULE_COMPAT_5.30.0) or perl(:MODULE_COMPAT_5.32.0) or perl(:MODULE_COMPAT_5.34.0) or perl(:MODULE_COMPAT_5.36.0) or perl(:MODULE_COMPAT_5.38.0) or perl(:MODULE_COMPAT_5.40.0) or perl(:MODULE_COMPAT_5.42.0)) - -Recommends: perl(IO::Socket::SSL) +Requires: ((perl >= 5.22 or perl(:VERSION) >= 5.22) with ( perl < 5.43 or perl(:VERSION) < 5.43)) +Requires: perl(IO::Socket::SSL) Provides: %{src_basename} = %{version}-%{release} Obsoletes: logitechmediaserver From 158ea767a81b74976c33a6d96ce7490294ea29f9 Mon Sep 17 00:00:00 2001 From: Johan S <81185596+JohanSaaw@users.noreply.github.com> Date: Mon, 2 Mar 2026 13:43:12 +0100 Subject: [PATCH 18/19] Update redhat/lyrionmusicserver.spec Co-authored-by: Peter Oliver --- redhat/lyrionmusicserver.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redhat/lyrionmusicserver.spec b/redhat/lyrionmusicserver.spec index 088e1817..51d7d2d6 100644 --- a/redhat/lyrionmusicserver.spec +++ b/redhat/lyrionmusicserver.spec @@ -373,7 +373,7 @@ function migrateSqueezeboxServerConfig { echo "Server. All Components of the software have been re-branded from" echo "squeezeboxserver to lyrionmusicserver." echo "To stop and start the software use:" - echo "systemd start lyrionmusicserver" + echo "systemctl start lyrionmusicserver" echo "and analogous for stop, status etc." echo "" echo "" From f410b2a0fead0556d2ae59ebd88ea96951990aa3 Mon Sep 17 00:00:00 2001 From: Johan S <81185596+JohanSaaw@users.noreply.github.com> Date: Mon, 2 Mar 2026 16:22:04 +0100 Subject: [PATCH 19/19] Refinements to Requires for perl RedHat flavour distributions v. 8 and v.9 requires a plain Require: perl to be added so that needed Perl modules are pulled in. --- redhat/lyrionmusicserver.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/redhat/lyrionmusicserver.spec b/redhat/lyrionmusicserver.spec index 51d7d2d6..f06ef5bb 100644 --- a/redhat/lyrionmusicserver.spec +++ b/redhat/lyrionmusicserver.spec @@ -105,7 +105,13 @@ Requires(post): /usr/bin/ln Requires(post): /usr/bin/mv Requires(post): /usr/bin/rm Requires(post): /usr/sbin/usermod +# The following is needed to ensure that we get the right version of Perl. +# The perl(:VERSION) is for RedHat flavours, the perl >= is for SUSE flavours. Requires: ((perl >= 5.22 or perl(:VERSION) >= 5.22) with ( perl < 5.43 or perl(:VERSION) < 5.43)) + +# This one is needed on RedHat flavour versions 8 and 9 +# Without it there will be necessary perl modules missing. +Requires: perl Requires: perl(IO::Socket::SSL) Provides: %{src_basename} = %{version}-%{release} @@ -373,7 +379,7 @@ function migrateSqueezeboxServerConfig { echo "Server. All Components of the software have been re-branded from" echo "squeezeboxserver to lyrionmusicserver." echo "To stop and start the software use:" - echo "systemctl start lyrionmusicserver" + echo "systemd start lyrionmusicserver" echo "and analogous for stop, status etc." echo "" echo ""