Bug 18168 - SYS V start script in RPM distribution does not work for openSUSE 15.0
: SYS V start script in RPM distribution does not work for openSUSE 15.0
Status: RESOLVED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Platform Support
: 7.9.x
: PC SuSE Linux
: -- normal (vote)
: 7.9.x
Assigned To: Unassigned bug - please assign me!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-02-04 18:47 UTC by jshubertus
Modified: 2019-02-12 18:22 UTC (History)
0 users

See Also:
Category: ---


Attachments
/etc/init.d/squeezeboxserver start script (5.06 KB, application/octet-stream)
2019-02-04 18:47 UTC, jshubertus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jshubertus 2019-02-04 18:47:48 UTC
Created attachment 7765 [details]
/etc/init.d/squeezeboxserver start script

openSUSE has adapted the systemd start-up system instead of the SYS V init scripts. The systemd developers also requires a new file called /etc/os-release to identify the operating system flavour. 

openSUSE has adopted this file and has now with version 15.o completely removed the old file called /etc/SuSE-release that used to indicate the version of the OS.

In the file /etc/init.d/squeezeboxserver an if/elif/else statement is used to check if the files /etc/redhat-release or /etc/SuSE-release exist on the server. Depending on the result the start script uses RedHat or SUSE methods to start the squeezeboxserver. As a result of the removal of the file /etc/SuSE-release the start script no longer works on openSUSE 15.0 installations.

Although there is an easy work-around (create the file /etc/SuSE-release) I think it would be better to amend the if/elif/else statement in the start script to look for the content of the /etc/os-release file as well.

One possible solution would be to exchange the following line in the start script:


elif [ -f /etc/SuSE-release ] ; then

with this line

elif [[ -n $(grep -i -E "(sles|suse)" /etc/os-release 2>/dev/null) ||  -f /etc/SuSE-release ]]; then

The new line checks if the file os-release contains the identifier sles or suse. If the first conditional statement is false it will also look for the old SuSE-release file.

A further improvement would also be to print an error message to STDOUT or STDERR instead of just exiting silently with an error code if the start script can't determine the Linux flavour.

I am unaware for Fedora/RedHat/CentOS plans about the /etc/redhat-release versus /etc/os-release. Maybe they will not go so far as SUSE did and completely remove the /etc/redhat-release file but it might be a good idea to also change the first part of the if/elif/else statement in a similar way to check for fedora/redhat/CentOS.

The attached file is an amended version of the start script. It works on openSUSE 15.0 but I am not able to test on any of the RedHat derivatives as I don't have such an installation.

Regards, Johan
Comment 2 jshubertus 2019-02-12 18:22:00 UTC
Thanks for including this. 

I have tested a new build and it works as expected.

Regards, Johan