1 |
%define name madsonic |
2 |
%define version 6.2.9092 |
3 |
%define release 1 |
4 |
%define __os_install_post \ |
5 |
/usr/lib/rpm/brp-compress \ |
6 |
/usr/lib/rpm/brp-strip \ |
7 |
/usr/lib/rpm/brp-strip-static-archive \ |
8 |
echo "not /usr/lib/rpm/brp-strip-comment-note" \ |
9 |
%{nil} |
10 |
Name: %{name} |
11 |
Version: %{version} |
12 |
Release: %{release}%{?dist} |
13 |
Summary: A web-based music streamer, jukebox and Podcast receiver |
14 |
Source: %{name}-%{version}.tar.gz |
15 |
Source1: |
16 |
Patch0: madsonic-6.2.9084-test.patch |
17 |
Patch1: madsonic-6.2.9084-sysconfig.patch |
18 |
BuildRoot: /var/tmp/%{name}-%{version}-buildroot |
19 |
BuildArch: noarch |
20 |
BuildRequires: e-smith-devtools |
21 |
AutoReqProv: no |
22 |
Group: Applications/Multimedia |
23 |
License: GPLv3 |
24 |
URL: http://madsonic.org |
25 |
|
26 |
%changelog |
27 |
* Fri Jul 22 2022 Jean-Philippe Pialasse <tests@pialasse.com> 6.2.9092-1.sme |
28 |
- update with log4j fixes and more |
29 |
- systemd capable |
30 |
- add mediasonic.test |
31 |
|
32 |
* Fri Jun 04 2021 Jean-Philippe Pialasse <tests@pialasse.com> 6.2.9084-2.sme |
33 |
- fix permissions [SME: 10699] |
34 |
- fix noise on start with initial install [SME: 8016] |
35 |
|
36 |
* Thu Jun 03 2021 Jean-Philippe Pialasse <tests@pialasse.com> 6.2.9084-1.sme |
37 |
- update to 6.2.9084 |
38 |
- first build for SME10 |
39 |
|
40 |
* Sun Nov 17 2013 JP Pialasse <tests@pialasse.com> 5.0.3760-1.sme |
41 |
- first build for sme |
42 |
- adding noarch |
43 |
- adding e-smith-devtools |
44 |
|
45 |
%description |
46 |
Madsonic is a web-based music streamer, fork of Subsonic, jukebox and Podcast receiver, |
47 |
providing access to your music collection wherever you are. Use it |
48 |
to share your music with friends, or to listen to your music while away |
49 |
from home. |
50 |
|
51 |
Apps for Android, iPhone and Windows Phone are also available. |
52 |
|
53 |
Java 1.8 or higher is required to run Madsonic.>= 6.2 |
54 |
|
55 |
%prep |
56 |
%setup |
57 |
%patch0 -p1 |
58 |
%patch1 -p1 |
59 |
mkdir -p root/usr/lib/systemd/system |
60 |
cp %{SOURCE1} root/usr/lib/systemd/system |
61 |
mkdir -p root/run/madsonic |
62 |
mkdir -p root/usr/lib/tmpfiles.d/ |
63 |
mkdir -p root/usr/bin |
64 |
echo "d /run/madsonic 0755 madsonic madsonic" > root/usr/lib/tmpfiles.d/madsonic.conf |
65 |
rm root/etc/init.d/madsonic |
66 |
|
67 |
pushd root/usr/bin/ |
68 |
ln -sf /usr/share/madsonic/madsonic.sh madsonic |
69 |
popd |
70 |
|
71 |
|
72 |
%install |
73 |
rm -rf $RPM_BUILD_ROOT |
74 |
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT) |
75 |
rm -f %{name}-%{version}-filelist |
76 |
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \ |
77 |
--dir /usr/share/madsonic 'attr(0750,madsonic,madsonic)' \ |
78 |
--dir /var/madsonic 'attr(0750,madsonic,madsonic)' \ |
79 |
--file /usr/lib/tmpfiles.d/madsonic.conf 'attr(0750,root,root)' \ |
80 |
--file /usr/lib/systemd/system/madsonic.service 'attr(0544,root,root)' \ |
81 |
--dir /run/madsonic 'attr(0755,madsonic,madsonic)' \ |
82 |
--ignoredir /run \ |
83 |
--ignoredir "/etc/sysconfig/madsonic" \ |
84 |
--ignoredir "/etc/init.d" \ |
85 |
--ignoredir "/etc/sysconfig"\ |
86 |
> %{name}-%{version}-filelist |
87 |
|
88 |
%clean |
89 |
rm -rf $RPM_BUILD_ROOT |
90 |
|
91 |
%files -f %{name}-%{version}-filelist |
92 |
%defattr(-,root,root) |
93 |
%config(noreplace) /etc/sysconfig/madsonic |
94 |
|
95 |
%pre |
96 |
grep '^madsonic:' /etc/passwd > /dev/null || \ |
97 |
/usr/sbin/useradd -c "madsonic" -M -d /usr/share/madsonic -s /bin/bash madsonic |
98 |
/usr/sbin/usermod -aG audio madsonic |
99 |
|
100 |
# Stop Madsonic service. |
101 |
if [ -e /etc/init.d/madsonic ]; then |
102 |
service madsonic stop |
103 |
fi |
104 |
[ -e /usr/lib/systemd/system/madsonic.service ] && systemctl stop madsonic |
105 |
|
106 |
# Backup database. |
107 |
if [ -e /var/madsonic/db ]; then |
108 |
rm -rf /var/madsonic/db.backup |
109 |
cp -R /var/madsonic/db /var/madsonic/db.backup |
110 |
fi |
111 |
|
112 |
exit 0 |
113 |
|
114 |
%post |
115 |
#ln -sf /usr/share/madsonic/madsonic.sh /usr/bin/madsonic |
116 |
#chmod 750 /var/madsonic |
117 |
|
118 |
# Clear jetty cache. |
119 |
rm -rf /var/madsonic/jetty |
120 |
|
121 |
# For SELinux: Set security context |
122 |
chcon -t java_exec_t /etc/init.d/madsonic 2>/dev/null |
123 |
|
124 |
# Configure and start Madsonic service. |
125 |
#chkconfig --add madsonic |
126 |
#service madsonic start |
127 |
|
128 |
exit 0 |
129 |
%preun |
130 |
# Only do it if uninstalling, not upgrading. |
131 |
if [ $1 = 0 ] ; then |
132 |
|
133 |
# Stop the service. |
134 |
[ -e /etc/init.d/madsonic ] && service madsonic stop |
135 |
[ -e /usr/lib/systemd/system/madsonic.service ] && systemctl stop madsonic |
136 |
|
137 |
# Remove symlink. |
138 |
rm -f /usr/bin/madsonic |
139 |
|
140 |
# Remove startup scripts. |
141 |
chkconfig --del madsonic |
142 |
|
143 |
fi |
144 |
|
145 |
exit 0 |
146 |
|