1 |
%define name subsonic |
2 |
%define version 4.8 |
3 |
%define release 1 |
4 |
Name: %{name} |
5 |
Version: %{version} |
6 |
Release: %{release}%{?dist} |
7 |
Summary: A web-based music streamer, jukebox and Podcast receiver |
8 |
Source: %{name}-%{version}.tar.gz |
9 |
BuildRoot: /var/tmp/%{name}-%{version}-buildroot |
10 |
#BuildRequires: e-smith-devtools |
11 |
Group: Applications/Multimedia |
12 |
License: GPLv3 |
13 |
URL: http://subsonic.org |
14 |
|
15 |
%description |
16 |
Subsonic is a web-based music streamer, jukebox and Podcast receiver, |
17 |
providing access to your music collection wherever you are. Use it |
18 |
to share your music with friends, or to listen to your music while away |
19 |
from home. |
20 |
|
21 |
Apps for Android, iPhone and Windows Phone are also available. |
22 |
|
23 |
Java 1.6 or higher is required to run Subsonic. |
24 |
|
25 |
Subsonic can be found at http://subsonic.org |
26 |
%prep |
27 |
%setup |
28 |
|
29 |
|
30 |
%install |
31 |
rm -rf $RPM_BUILD_ROOT |
32 |
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT) |
33 |
rm -f %{name}-%{version}-filelist |
34 |
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \ |
35 |
| grep -v "/etc/sysconfig/subsonic" \ |
36 |
> %{name}-%{version}-filelist |
37 |
|
38 |
%clean |
39 |
rm -rf $RPM_BUILD_ROOT |
40 |
|
41 |
%files -f %{name}-%{version}-filelist |
42 |
%defattr(-,root,root) |
43 |
%config(noreplace) /etc/sysconfig/subsonic |
44 |
#%files |
45 |
#%defattr(644,root,root,755) |
46 |
#/usr/share/subsonic/subsonic-booter-jar-with-dependencies.jar |
47 |
#/usr/share/subsonic/subsonic.war |
48 |
#%attr(755,root,root) /usr/share/subsonic/subsonic.sh |
49 |
#%attr(755,root,root) /etc/init.d/subsonic |
50 |
#%attr(755,root,root) /var/subsonic/transcode/ffmpeg |
51 |
#%attr(755,root,root) /var/subsonic/transcode/lame |
52 |
#%config(noreplace) /etc/sysconfig/subsonic |
53 |
|
54 |
%pre |
55 |
# Stop Subsonic service. |
56 |
if [ -e /etc/init.d/subsonic ]; then |
57 |
service subsonic stop |
58 |
fi |
59 |
|
60 |
# Backup database. |
61 |
if [ -e /var/subsonic/db ]; then |
62 |
rm -rf /var/subsonic/db.backup |
63 |
cp -R /var/subsonic/db /var/subsonic/db.backup |
64 |
fi |
65 |
|
66 |
exit 0 |
67 |
|
68 |
%post |
69 |
ln -sf /usr/share/subsonic/subsonic.sh /usr/bin/subsonic |
70 |
chmod 750 /var/subsonic |
71 |
|
72 |
# Clear jetty cache. |
73 |
rm -rf /var/subsonic/jetty |
74 |
|
75 |
# For SELinux: Set security context |
76 |
chcon -t java_exec_t /etc/init.d/subsonic 2>/dev/null |
77 |
|
78 |
# Configure and start Subsonic service. |
79 |
chkconfig --add subsonic |
80 |
service subsonic start |
81 |
|
82 |
exit 0 |
83 |
|
84 |
%preun |
85 |
# Only do it if uninstalling, not upgrading. |
86 |
if [ $1 = 0 ] ; then |
87 |
|
88 |
# Stop the service. |
89 |
[ -e /etc/init.d/subsonic ] && service subsonic stop |
90 |
|
91 |
# Remove symlink. |
92 |
rm -f /usr/bin/subsonic |
93 |
|
94 |
# Remove startup scripts. |
95 |
chkconfig --del subsonic |
96 |
|
97 |
fi |
98 |
|
99 |
exit 0 |
100 |
|