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