Skip to content

Commit 1fdd90c

Browse files
Merge pull request #1374 from piCorePlayer/Add_pCP_Stable
2 parents ac4b314 + 79f6f86 commit 1fdd90c

File tree

9 files changed

+195
-5
lines changed

9 files changed

+195
-5
lines changed

.github/actions/build/action.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ runs:
4040
ref: ${{ steps.getversion.outputs.GIT_BRANCH }}
4141

4242

43+
- name: Check out pCP platform code
44+
if: ${{ startsWith(inputs.build-params, 'pcp') }}
45+
uses: actions/checkout@v4
46+
with:
47+
repository: picoreplayer/lms-update-script
48+
path: platforms/pcp
49+
4350
- name: Set up Docker environment
4451
if: ${{ startsWith(inputs.build-params, 'docker') }}
4552
id: dockersetup

Changelog9.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ <h2><a name="v9.0.4" id="v9.0.4"></a>Version 9.0.4</h2>
1717
<ul>
1818
<li>Add Homebrew's binary path to OSX search paths.</li>
1919
<li><a href="https://github.com/LMS-Community/slimserver/issues/1441">#1441</a> - Install procps package Docker image in support of plugins which need the tools to manage their helper processes.</li>
20+
<li>Make piCorePlayer a first class citizan: add Slim::Utils::OS::pCP to support it</li>
2021
</ul>
2122
<br />
2223

HTML/EN/html/docs/linux-update.html

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
1-
[% extension = installerFile.match('\.(rpm|deb)$');
1+
[% extension = installerFile.match('\.(rpm|deb|tcz)$');
22
IF extension;
33
distro = extension.0;
44
END;
55
%]
66

7+
[% IF distro == 'tcz' %]
8+
9+
<p>On piCorePlayer we provide a script to download and update Lyrion Music Server.
10+
This script will update your local copy of LMS to the latest build.<p>
11+
12+
<button onclick="window.location.href='http://' + window.location.hostname + ':80/cgi-bin/writetolms.cgi?ACTION=Update';">
13+
Update &amp; restart Lyrion Music Server
14+
</button>
15+
16+
<p>...or use
17+
<script language="JavaScript">
18+
document.write('<a href="' + window.location.protocol + '//' + window.location.hostname + ':80' + '/cgi-bin/lms-update.cgi?ACTION=Nightly' + '" >this Link</a> ' );
19+
</script> to update LMS using the piCorePlayer interface.</p>
20+
21+
[% ELSE %]
22+
723
<p>On some Linux distributions we provide an automatic download of Lyrion Music Server update installers.
824
These currently are available for .rpm and .deb based systems.<p>
925

@@ -25,3 +41,5 @@
2541
<li><code>sudo dpkg -i [% installerFile %]</code></li>
2642
[% END %]
2743
</ul>
44+
45+
[% END %]

HTML/EN/html/docs/linux-update.html.de

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
1-
[% extension = installerFile.match('\.(rpm|deb)$');
1+
[% extension = installerFile.match('\.(rpm|deb|tcz)$');
22
IF extension;
33
distro = extension.0;
44
END;
55
%]
66

7+
[% IF distro == 'tcz' %]
8+
9+
<p>piCorePlayer stellt ein Skript zum Herunterladen und Aktualisieren von Lyrion Music Server zur Verf&uuml;gung.
10+
Dieses Skript aktualisiert Ihr LMS auf den neuesten Stand.<p>
11+
12+
<button onclick="window.location.href='http://' + window.location.hostname + ':80/cgi-bin/writetolms.cgi?ACTION=Update';">
13+
Lyrion Music Server aktualisieren und neu starten
14+
</button>
15+
16+
<p>...oder folgen Sie
17+
<script language="JavaScript">
18+
document.write('<a href="' + window.location.protocol + '//' + window.location.hostname + ':80' + '/cgi-bin/lms-update.cgi?ACTION=Nightly' + '" >diesem Link</a> ' );
19+
</script> zur Aktualisierung des LMS &uuml;ber die piCorePlayer-Schnittstelle.</p>
20+
21+
[% ELSE %]
22+
723
<p>Auf einigen Linux Distributionen bieten wir eine vereinfachte Lyrion Music Server Aktualisierung an.
824
Dies ist derzeit auf RPM und Debian basierenden Systemen der Fall.<p>
925

@@ -25,3 +41,5 @@ Dies ist derzeit auf RPM und Debian basierenden Systemen der Fall.<p>
2541
<li><code>sudo dpkg -i [% installerFile %]</code></li>
2642
[% END %]
2743
</ul>
44+
45+
[% END %]

HTML/EN/html/docs/linux-update.html.fr

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
1-
[% extension = installerFile.match('\.(rpm|deb)$');
1+
[% extension = installerFile.match('\.(rpm|deb|tcz)$');
22
IF extension;
33
distro = extension.0;
44
END;
55
%]
66

7+
[% IF distro == 'tcz' %]
8+
9+
<p>Sur piCorePlayer, nous fournissons un script pour t&eacute;l&eacute;charger et mettre &agrave; jour Lyrion Music Server.
10+
Ce script mettra &agrave; jour votre copie de LMS avec la derni&egrave;re version.<p>
11+
12+
<button onclick="window.location.href='http://' + window.location.hostname + ':80/cgi-bin/writetolms.cgi?ACTION=Update';">
13+
Mise &agrave; jour et red&eacute;marrage de Lyrion Music Server
14+
</button>
15+
16+
<p>...ou bien suivez
17+
<script language="JavaScript">
18+
document.write('<a href="' + window.location.protocol + '//' + window.location.hostname + ':80' + '/cgi-bin/lms-update.cgi?ACTION=Nightly' + '" >ce lien</a> ' );
19+
</script> pour mettre &agrave; jour le LMS en utilisant l'interface piCorePlayer.</p>
20+
21+
[% ELSE %]
22+
723
<p>Sur certaines distributions Linux, nous proposons un t&eacute;l&eacute;chargement automatique des programmes d'installation des mises &agrave; jour de Lyrion Music Server. Ceux-ci sont actuellement disponibles pour les syst&egrave;mes bas&eacute;s sur des packages .rpm et .deb.<p>
824

925
[% IF distro == 'deb' %]
@@ -24,3 +40,5 @@ END;
2440
<li><code>sudo dpkg -i [% installerFile %]</code></li>
2541
[% END %]
2642
</ul>
43+
44+
[% END %]

Slim/Utils/OS/Linux.pm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ sub getFlavor {
7676
# parse new-school operating system identification file if available
7777
if (-f '/etc/os-release' && open(OS_RELEASE, '/etc/os-release')) {
7878
while (<OS_RELEASE>) {
79-
if (/^NAME="(.*?)"/i) {
79+
if (/^NAME="?(.*)"?/i) {
8080
$osName = lc($1);
8181
last;
8282
}
@@ -104,6 +104,11 @@ sub getFlavor {
104104
} elsif (-f '/etc/synoinfo.conf' || -f '/etc.defaults/synoinfo.conf') {
105105

106106
return 'Synology DiskStation';
107+
108+
} elsif ($osName =~ /picoreplayer/ ) {
109+
110+
return 'piCorePlayer';
111+
107112
}
108113

109114
return 'Linux';

Slim/Utils/OS/pCP.pm

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
package Slim::Utils::OS::pCP;
2+
3+
# OS file for pCP https://www.picoreplayer.org
4+
#
5+
# Revision 1.1
6+
# 2017-04-16 Removed /proc from a music path
7+
#
8+
# Revision 1.2
9+
# 2017-08-14 Added Manual Plugin directory at Cache/Plugins
10+
#
11+
# Revision 2.0
12+
# 2025-03-23 Packages now being built by Lyrion.org. Use default Cache/updates folder
13+
14+
use strict;
15+
use warnings;
16+
17+
use base qw(Slim::Utils::OS::Linux);
18+
use File::Spec::Functions qw(catdir);
19+
20+
use constant MAX_LOGSIZE => 1024*1024*1; # maximum log size: 1 MB
21+
use constant UPDATE_DIR => '/tmp/slimupdate';
22+
23+
sub initDetails {
24+
my $class = shift;
25+
26+
$class->{osDetails} = $class->SUPER::initDetails();
27+
$class->{osDetails}->{osName} = 'piCore';
28+
return $class->{osDetails};
29+
}
30+
31+
sub getSystemLanguage { 'EN' }
32+
33+
sub localeDetails {
34+
my $lc_ctype = 'utf8';
35+
my $lc_time = 'C';
36+
37+
return ($lc_ctype, $lc_time);
38+
}
39+
40+
=head2 dirsFor( $dir )
41+
42+
Return OS Specific directories.
43+
44+
Argument $dir is a string to indicate which of the server directories we
45+
need information for.
46+
47+
pCP Uses a update directory in /tmp and a custom manual plugin folder
48+
49+
=cut
50+
51+
sub dirsFor {
52+
my ($class, $dir) = @_;
53+
54+
my @dirs;
55+
56+
if ($dir eq 'updates') {
57+
58+
mkdir UPDATE_DIR unless -d UPDATE_DIR;
59+
@dirs = (UPDATE_DIR);
60+
}
61+
else {
62+
@dirs = $class->SUPER::dirsFor($dir);
63+
64+
if ($dir eq "Plugins") {
65+
push @dirs, catdir( Slim::Utils::Prefs::preferences('server')->get('cachedir'), 'Plugins' );
66+
unshift @INC, catdir( Slim::Utils::Prefs::preferences('server')->get('cachedir') );
67+
}
68+
}
69+
70+
return wantarray() ? @dirs : $dirs[0];
71+
}
72+
73+
sub canAutoUpdate { 1 }
74+
sub installerExtension { 'tcz' }
75+
sub installerOS { 'pcp' }
76+
77+
sub getUpdateParams {
78+
my ($class, $url) = @_;
79+
80+
if ($url) {
81+
require File::Slurp;
82+
83+
my $updateFile = UPDATE_DIR . '/update_url';
84+
File::Slurp::write_file($updateFile, $url);
85+
}
86+
87+
return {
88+
cb => \&Slim::Utils::OS::Linux::signalUpdateReady
89+
};
90+
}
91+
92+
sub logRotate {
93+
# only keep small log files (1MB) because they are in RAM
94+
Slim::Utils::OS->logRotate($_[1], MAX_LOGSIZE);
95+
}
96+
97+
sub ignoredItems {
98+
return (
99+
'bin' => '/',
100+
'dev' => '/',
101+
'etc' => '/',
102+
'opt' => '/',
103+
'init' => '/',
104+
'root' => '/',
105+
'sbin' => '/',
106+
'tmp' => '/',
107+
'var' => '/',
108+
'lib' => '/',
109+
'run' => '/',
110+
'sys' => '/',
111+
'usr' => '/',
112+
'proc' => '/',
113+
'lost+found'=> 1,
114+
);
115+
}
116+
117+
1;
118+

Slim/Utils/OSDetect.pm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ sub init {
111111
require Slim::Utils::OS::Synology;
112112
$os = Slim::Utils::OS::Synology->new();
113113

114+
} elsif ($os =~ /piCorePlayer/i) {
115+
116+
require Slim::Utils::OS::pCP;
117+
$os = Slim::Utils::OS::pCP->new();
118+
114119
} else {
115120

116121
$os = Slim::Utils::OS::Linux->new();

Slim/Utils/Update.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ sub cleanup {
341341

342342
my $ext = $os->installerExtension() . ($additionalExt ? "\.$additionalExt" : '');
343343

344-
Slim::Utils::Misc::deleteFiles($path, qr/^LyrionMusicServer.*\.$ext$/i);
344+
Slim::Utils::Misc::deleteFiles($path, qr/^LyrionMusicServer.*\.$ext(\.md5\.txt)?$/i);
345345
}
346346

347347
1;

0 commit comments

Comments
 (0)