1 |
%define name smeserver-kplaylist |
2 |
%define version 1.7.426 |
3 |
%define release 1 |
4 |
%define rpmver 4.0.4 |
5 |
|
6 |
|
7 |
Summary: kPlaylist is a free PHP system that makes your music collection available via the Internet. |
8 |
Name: %{name} |
9 |
Version: %{version} |
10 |
Release: %{release}%{?dist} |
11 |
License: GPL |
12 |
Group: SME/Addon |
13 |
Source: %{name}-%{version}.tar.gz |
14 |
URL: http://www.kplaylist.net/ |
15 |
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot |
16 |
BuildArchitectures: noarch |
17 |
Requires: e-smith-base |
18 |
Requires: e-smith-release >= 7 |
19 |
|
20 |
|
21 |
%description |
22 |
This RPM is an unofficial addon for the SME Server 7.x. |
23 |
kPlaylist is a free PHP system that makes your music collection available via the Internet. |
24 |
http://yourdomain.com/kplaylist |
25 |
|
26 |
|
27 |
%changelog |
28 |
* Sat Nov 24 2007 Sylvain Gomez <sylvaingomez@free.fr> |
29 |
[1.7.426-1] Original version |
30 |
|
31 |
|
32 |
%prep |
33 |
|
34 |
|
35 |
%setup |
36 |
|
37 |
|
38 |
%build |
39 |
# Default DB parameters |
40 |
DEFAULTS1=root/etc/e-smith/db/configuration/defaults/kplaylist |
41 |
DEFAULTS2=root/etc/e-smith/db/accounts/defaults/kplaylist |
42 |
mkdir -p $DEFAULTS1 |
43 |
mkdir -p $DEFAULTS2 |
44 |
echo "kplaylist" > $DEFAULTS1/DbName |
45 |
echo "kplaylist" > $DEFAULTS1/DbUser |
46 |
echo "off" > $DEFAULTS1/HTTPS |
47 |
echo "16M" > $DEFAULTS1/MaxUpload |
48 |
echo "KPlaylist" > $DEFAULTS1/Name |
49 |
echo "local" > $DEFAULTS1/PublicAccess |
50 |
echo "service" > $DEFAULTS1/type |
51 |
echo "url" > $DEFAULTS2/type |
52 |
|
53 |
# Creating templates.metadata |
54 |
TEMPLATE1=root/etc/e-smith/templates.metadata/etc/e-smith/sql/init |
55 |
mkdir -p $TEMPLATE1 |
56 |
echo 'PERMS=0540' > $TEMPLATE1/80kplaylist_mysql.sql |
57 |
|
58 |
|
59 |
%install |
60 |
rm -rf $RPM_BUILD_ROOT |
61 |
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT) |
62 |
rm -f %{name}-%{version}-filelist |
63 |
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist |
64 |
|
65 |
|
66 |
%clean |
67 |
rm -rf $RPM_BUILD_ROOT |
68 |
|
69 |
|
70 |
%pre |
71 |
# Checking if KPlaylist files are present before updating |
72 |
# If present, installation files + MySQL DB + DB values are saved |
73 |
if [ -d /opt/kplaylist ]; then |
74 |
case $LANG in |
75 |
fr_FR) echo "Sauvegarde de l'ancienne install dans /opt/RPM_BACKUP" ;; |
76 |
*) echo "Backing up old install in /opt/RPM_BACKUP" ;; |
77 |
esac |
78 |
mkdir -p /opt/RPM_BACKUP |
79 |
cd /opt/kplaylist |
80 |
tar -czf /opt/RPM_BACKUP/html.tar.gz html |
81 |
mysqldump kplaylist > /opt/RPM_BACKUP/kplaylist.sql |
82 |
/sbin/e-smith/db configuration show kplaylist > /opt/RPM_BACKUP/kplaylist-config.txt |
83 |
fi |
84 |
|
85 |
|
86 |
%post |
87 |
# Initializing SME DB |
88 |
/etc/e-smith/events/actions/initialize-default-databases |
89 |
|
90 |
# Variables |
91 |
SRVNAME=$(/sbin/e-smith/db configuration get SystemName) |
92 |
KPLPASS=$(/sbin/e-smith/db configuration getprop kplaylist DbPassword) |
93 |
if [ -d /opt/kplaylist ] ; then UPDATE=1 ; else UPDATE=0 ; fi |
94 |
|
95 |
# Basic structure |
96 |
mkdir -p /opt/kplaylist/{files,html} |
97 |
chown www:www /opt/kplaylist/files |
98 |
chmod 3770 /opt/kplaylist/files |
99 |
chown root:www /opt/kplaylist/html |
100 |
chmod 770 /opt/kplaylist/html |
101 |
|
102 |
# Creating index.php |
103 |
sed 's.yourpassword.'$KPLPASS'.g' /usr/share/doc/kplaylist-1.7.426/Sources/kplaylist.1.7.426.php > /opt/kplaylist/html/index.php |
104 |
chown root:www /opt/kplaylist/html/index.php |
105 |
chmod 660 /opt/kplaylist/html/index.php |
106 |
|
107 |
# MySQL installation |
108 |
/sbin/e-smith/expand-template /etc/e-smith/sql/init/80kplaylist_mysql.sql |
109 |
if [ "$UPDATE" = "0" ] ; then |
110 |
if [ -f /usr/share/doc/kplaylist-1.7.426/Sources/$LANG.sql ] ;then |
111 |
cp /usr/share/doc/kplaylist-1.7.426/Sources/$LANG.sql /etc/e-smith/sql/init/81kplaylist_db.sql |
112 |
else |
113 |
cp /usr/share/doc/kplaylist-1.7.426/Sources/en_US.sql /etc/e-smith/sql/init/81kplaylist_db.sql |
114 |
fi |
115 |
fi |
116 |
/etc/rc.d/init.d/mysql.init start 2>/dev/null >/dev/null |
117 |
|
118 |
# Applying modifications |
119 |
/sbin/e-smith/expand-template /etc/samba/smb.conf |
120 |
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf |
121 |
/etc/init.d/smbd restart 2>/dev/null >/dev/null |
122 |
service smb restart 2>/dev/null >/dev/null |
123 |
/etc/rc7.d/S86httpd-e-smith sigusr1 2>/dev/null >/dev/null |
124 |
|
125 |
echo "-------------------------------------------------------------------------------" |
126 |
case $LANG in |
127 |
fr_FR) |
128 |
case $UPDATE in |
129 |
0) echo "Installation de KPlaylist terminée !" ;; |
130 |
*) echo "Mise à jour de KPlaylist terminée !" ;; |
131 |
esac |
132 |
echo "Pour plus de détails, visitez http://wiki.contribs.org/KPlaylist/fr" ;; |
133 |
*) |
134 |
case $UPDATE in |
135 |
0) echo "Kplaylist Installation finished!" ;; |
136 |
*) echo "Kplaylist Update finished!" ;; |
137 |
esac |
138 |
echo "For more details, see http://wiki.contribs.org/KPlaylist" ;; |
139 |
esac |
140 |
echo "-------------------------------------------------------------------------------" |
141 |
|
142 |
|
143 |
%preun |
144 |
if [ $1 = 0 ] ; then |
145 |
mv /usr/share/doc/kplaylist-1.7.426/Sources/DO_NOT_USE_OR_DELETE/KPlaylist-Full-Uninstall.sh /root/ |
146 |
fi |
147 |
|
148 |
|
149 |
%postun |
150 |
if [ $1 = 0 ] ; then |
151 |
/sbin/e-smith/expand-template /etc/samba/smb.conf |
152 |
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf |
153 |
/etc/init.d/smbd restart 2>/dev/null >/dev/null |
154 |
service smb restart 2>/dev/null >/dev/null |
155 |
/etc/rc7.d/S86httpd-e-smith sigusr1 2>/dev/null >/dev/null |
156 |
|
157 |
echo "Uninstallation finished!" |
158 |
echo " " |
159 |
echo "If you want to completly remove KPlaylist" |
160 |
echo "(installation files, MySQL user+database)" |
161 |
echo "please issue the following command at the prompt:" |
162 |
echo "# sh /root/KPlaylist-Full-Uninstall.sh" |
163 |
fi |
164 |
|
165 |
|
166 |
%files -f %{name}-%{version}-filelist |
167 |
|
168 |
|
169 |
%defattr(-,root,root) |