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