LMS-Community / slimserver-platforms

Platform-specific build tools for Lyrion Music Server
48 stars 41 forks source link

RPM package requires awk #67

Open mavit opened 1 month ago

mavit commented 1 month ago

I tried installing the RPM in a SLES container, and found that awk was missing:

desktop:~> podman run -it registry.suse.com/suse/sle15:15.6
Trying to pull registry.suse.com/suse/sle15:15.6...
Getting image source signatures
Copying blob 0b109ba7bbe2 done   |
Copying config 43536441fd done   |
Writing manifest to image destination
42935f653ebf:/ # zypper install https://downloads.lms-community.org/LogitechMediaServer_v8.5.2/logitechmediaserver-8.5.2-1.noarch.rpm
Refreshing service 'container-suseconnect-zypp'.
Retrieving repository 'SLE_BCI' metadata .................................[done]
Building repository 'SLE_BCI' cache ......................................[done]
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 3 NEW packages are going to be installed:
  libgdbm4 logitechmediaserver perl

The following package has no support information from its vendor:
  logitechmediaserver

The following 2 packages are not supported by their vendor:
  libgdbm4 perl

3 new packages to install.
Overall download size: 93.3 MiB. Already cached: 0 B. After the operation,
additional 249.0 MiB will be used.

Backend:  classic_rpmtrans
Continue? [y/n/v/...? shows all options] (y):
Retrieving: libgdbm4-1.12-1.418.x86_64 (SLE_BCI)            (1/3),  76.5 KiB
Retrieving: libgdbm4-1.12-1.418.x86_64.rpm ...............................[done]
Retrieving: perl-5.26.1-150300.17.17.1.x86_64 (SLE_BCI)     (2/3),   6.5 MiB
Retrieving: perl-5.26.1-150300.17.17.1.x86_64.rpm ............[done (6.3 MiB/s)]
Retrieving: logitechmediaserver-8.5.2-1.noarch (Plain RPM files cache)
                                                            (3/3),  86.7 MiB
logitechmediaserver-8.5.2-1.noarch.rpm:
    Package header is not signed!

logitechmediaserver-8.5.2-1.noarch (Plain RPM files cache): Signature verification failed [6-File is unsigned]
Abort, retry, ignore? [a/r/i] (a): i

Checking for file conflicts: .............................................[done]
(1/3) Installing: libgdbm4-1.12-1.418.x86_64 .............................[done]
(2/3) Installing: perl-5.26.1-150300.17.17.1.x86_64 ......................[done]
/var/tmp/rpm-tmp.a41KKK: line 106: awk: command not found
Point your web browser to http://42935f653ebf:9000/ to configure Logitech Media Server.
(3/3) Installing: logitechmediaserver-8.5.2-1.noarch .....................[done]
42935f653ebf:/ # exit

It probably makes sense to replace use of awk with perl, but ensuring awk is installed is a quick fix for now.

michaelherger commented 1 month ago

@mavit would cut be available by default? I'm surprised awk isn't. I thought that was one of those tools which would "always" be installed.

@JohanSaaw I see you added those lines using awk. But I think some of them could be changed to use cut or grep instead. If they were available by default, would you mind changing the code lines?

JohanSaaw commented 1 month ago

Hi @michaelherger , @mavit

I'll check the code in the RPM scripts. I see this is for v 8. 5.2, so I aasume I would need to make the fix for 8.5.2, 8.5.3 and 9.0.0, or?

Would it be an acceptable solution to add awk as a pre-req in the RPM package?

On SUSE and RedHat variants cut is a part of the RPM package coreutils. That package will always be installed (I can't imagine an installation without it at least).

Regards, Johan

mavit commented 1 month ago

would cut be available by default?

It's present even in the Red Hat UBI micro container image, so I think the answer is currently yes. I'd probably Requires: /usr/bin/cut anyway, just in case.

But Perl seems like an obvious choice for these kinds of one-liners, here.

JohanSaaw commented 1 month ago

@michaelherger ,

I had a closer look. I can fix this, As @mavit says, I also think it is best to do it with some in-line PERL code in the shell scripts.

There is one occurrence of awk that has been in the code for ages and that is the line:

PORT=awk '/^httpport/ {print $2}' %{_var}/lib/%{shortname}/prefs/server.prefs

I updated the line with "%{shortname}", that is probably why it looks like I added the awk. If you check the RPM spec file for v 8.5.2 you will see that it is there.

I added the other four occurrences when I amended the RPM spec file to re-brand all components to lyrionmusicserver.

I will start fixing the v 9.0.0 and then I can also submit a fix for v 8.5.3.

Is that OK?

Regards, Johan

michaelherger commented 1 month ago

Go for it! I'm thankful for any contribution!

JohanSaaw commented 1 month ago

@michaelherger ,

Just to let you know.

My son is visiting, so I can't spend the time I would like on this. So I'll probably only be able to create a pull request for this at the coming week-end (24-25/08).

Regards, Johan

michaelherger commented 1 month ago

My son is visiting, so I can't spend the time I would like on this. So I'll probably only be able to create a pull request for this at the coming week-end (24-25/08).

No problem! It's not broken, is it? Just an improvement. Enjoy your time with your son.