1 |
unnilennium |
1.1 |
# $Id: smeserver-gallery.spec,v 1.4 2008/11/25 16:20:22 slords Exp $ |
2 |
|
|
# Authority: nocvs |
3 |
|
|
# Name: Dietmar Berteld |
4 |
|
|
|
5 |
|
|
%define name smeserver-gallery2 |
6 |
|
|
%define version 2.2 |
7 |
|
|
%define release 3 |
8 |
|
|
%define rpmver 4.0.4 |
9 |
|
|
|
10 |
|
|
Summary: gallery2 Photo Sharing Web Application for SME Server 7.x based on Gallery2 2.2 |
11 |
|
|
Name: %{name} |
12 |
|
|
Version: %{version} |
13 |
|
|
Release: %{release}%{?dist} |
14 |
|
|
License: GPL |
15 |
|
|
Group: /Web/Applications |
16 |
|
|
Source: %{name}-%{version}.tar.gz |
17 |
|
|
URL: http://group-office.com/ |
18 |
|
|
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot |
19 |
|
|
BuildArchitectures: noarch |
20 |
|
|
Requires: e-smith-base, e-smith-release >= 7 |
21 |
|
|
BuildRequires: e-smith-devtools |
22 |
|
|
|
23 |
|
|
%description |
24 |
|
|
This RPM is an unofficial addon for the SME Server 7.x. |
25 |
|
|
The target audience is the Linux/E-smith administrator |
26 |
|
|
who wants to add Photo Sharing package . |
27 |
|
|
Gallery2 is the next generation of open source photo sharing web applications. |
28 |
|
|
Gallery2 gives you an intuitive way to blend photo management seamlessly into your |
29 |
|
|
own website whether you're running a small personal site or a large community site. |
30 |
|
|
Hundreds of thousands of people and organizations are using Gallery2 to create |
31 |
|
|
personalized photo albums on their websites. |
32 |
|
|
After installation open your webbrowser your local site |
33 |
|
|
https://your_e-smith-server_adress/gallery2 |
34 |
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
%changelog |
38 |
|
|
* Tue May 29 2007 Dietmar Berteld <dietmar@berteld.com> |
39 |
|
|
- [2.2.2-3] Change MySQL-creating method to SME and fix the "upgrade bug" |
40 |
|
|
with chmod 640 to the /opt/gallery2/html/upgrade directory |
41 |
|
|
|
42 |
|
|
* Mon May 14 2007 Dietmar Berteld <dietmar@berteld.com> |
43 |
|
|
- [2.2-2] Change to variables, automatic language settings |
44 |
|
|
|
45 |
|
|
* Thu May 08 2007 Dietmar Berteld <dietmar@berteld.com> |
46 |
|
|
- [2.2-1] Initial version |
47 |
|
|
|
48 |
|
|
%prep |
49 |
|
|
rm -rf $RPM_BUILD_ROOT |
50 |
|
|
|
51 |
|
|
%setup |
52 |
|
|
|
53 |
|
|
%build |
54 |
|
|
|
55 |
|
|
%install |
56 |
|
|
/bin/rm -rf $RPM_BUILD_ROOT |
57 |
|
|
(/usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT) |
58 |
|
|
/bin/rm -f %{name}-%{version}-filelist |
59 |
|
|
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist |
60 |
|
|
|
61 |
|
|
|
62 |
|
|
%files -f %{name}-%{version}-filelist |
63 |
|
|
|
64 |
|
|
%defattr(-,root,root) |
65 |
|
|
|
66 |
|
|
%clean |
67 |
|
|
rm -rf $RPM_BUILD_ROOT |
68 |
|
|
|
69 |
|
|
%pre |
70 |
|
|
|
71 |
|
|
%post |
72 |
|
|
APP=Gallery2 |
73 |
|
|
URL=gallery2 |
74 |
|
|
WORKDIR=/root |
75 |
|
|
HTMLDIR=/opt/gallery2 |
76 |
|
|
MYSQLDB=gallery2 |
77 |
|
|
MYSQLUSER=gallery2user |
78 |
|
|
|
79 |
|
|
GATEWAY=$(/sbin/e-smith/db configuration get GatewayIP) |
80 |
|
|
LOCALIP=$(/sbin/e-smith/db configuration get LocalIP) |
81 |
|
|
LOCMASK=$(/sbin/e-smith/db configuration get LocalNetmask) |
82 |
|
|
DOMAINE=$(/sbin/e-smith/db configuration get DomainName) |
83 |
|
|
SRVMODE=$(/sbin/e-smith/db configuration get SystemMode) |
84 |
|
|
SRVNAME=$(/sbin/e-smith/db configuration get SystemName) |
85 |
|
|
if [ "$SRVMODE" = "servergateway" ]; then |
86 |
|
|
OUTERIP=$(/sbin/e-smith/db configuration get ExternalIP) |
87 |
|
|
OUTMASK=$(/sbin/e-smith/db configuration get ExternalNetmask) |
88 |
|
|
fi |
89 |
|
|
TIMEZONE=$(/sbin/e-smith/db configuration get TimeZone) |
90 |
|
|
|
91 |
|
|
|
92 |
|
|
# Untar the application to /opt |
93 |
|
|
cd /opt |
94 |
|
|
tar xzf gallery2.tar.gz |
95 |
|
|
rm -rf gallery2.tar.gz |
96 |
|
|
rm -rf /smeserver-gallery2-2.2-3.spec |
97 |
|
|
|
98 |
|
|
|
99 |
|
|
# Creating the database |
100 |
|
|
echo "Creating database '$MYSQLDB' and user '$MYSQLUSER'" |
101 |
|
|
/etc/e-smith/events/actions/initialize-default-databases |
102 |
|
|
mysqladmin -u root create $MYSQLDB |
103 |
|
|
|
104 |
|
|
case "$LANG" in |
105 |
|
|
en_US) mysql $MYSQLDB < $HTMLDIR/gallery2_en.sql ;; |
106 |
|
|
de_DE) mysql $MYSQLDB < $HTMLDIR/gallery2_de.sql ;; |
107 |
|
|
es_ES) mysql $MYSQLDB < $HTMLDIR/gallery2_es.sql ;; |
108 |
|
|
fr_FR) mysql $MYSQLDB < $HTMLDIR/gallery2_fr.sql ;; |
109 |
|
|
it_IT) mysql $MYSQLDB < $HTMLDIR/gallery2_it.sql ;; |
110 |
|
|
sv_SE) mysql $MYSQLDB < $HTMLDIR/gallery2_sv.sql ;; |
111 |
|
|
esac |
112 |
|
|
|
113 |
|
|
MYSQLPASS=$(/sbin/e-smith/config getprop $MYSQLDB DbPassword) |
114 |
|
|
mysql -u root -e "SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( '$MYSQLPASS' ) " |
115 |
|
|
mysqladmin flush-privileges |
116 |
|
|
/etc/rc.d/init.d/mysql.init start |
117 |
|
|
|
118 |
|
|
# Change Gallery2-Password |
119 |
|
|
cd $HTMLDIR/html |
120 |
|
|
sed 's.gallery2password.'$MYSQLPASS'.g' config.php > config_neu.php |
121 |
|
|
mv config_neu.php config.php |
122 |
|
|
chmod 644 config.php |
123 |
|
|
chmod -R 640 upgrade |
124 |
|
|
|
125 |
|
|
|
126 |
|
|
# Deleting some folders and creation of config.php |
127 |
|
|
rm -rf $HTMLDIR/html/install |
128 |
|
|
rm -rf $HTMLDIR/$MYSQLDB*.sql |
129 |
|
|
|
130 |
|
|
|
131 |
|
|
# Custom template fragment |
132 |
|
|
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf |
133 |
|
|
/etc/rc7.d/S86httpd-e-smith sigusr1 |
134 |
|
|
|
135 |
|
|
echo "=======================================================================" |
136 |
|
|
echo "$APP Installation finished. " |
137 |
|
|
echo "go to http://$DOMAINE/$URL" |
138 |
|
|
echo "Username : admin" |
139 |
|
|
echo "Password : admin" |
140 |
|
|
echo " " |
141 |
|
|
echo "Please change the admin-password !! " |
142 |
|
|
echo "=======================================================================" |
143 |
|
|
|
144 |
|
|
|
145 |
|
|
%preun |
146 |
|
|
# General Information |
147 |
|
|
APP=Gallery2 |
148 |
|
|
URL=gallery2 |
149 |
|
|
WORKDIR=/root |
150 |
|
|
HTMLDIR=/opt/gallery2 |
151 |
|
|
MYSQLDB=gallery2 |
152 |
|
|
MYSQLUSER=gallery2user |
153 |
|
|
|
154 |
|
|
# This section deletes the database |
155 |
|
|
echo "Deleting database '$MYSQLDB' and user '$MYSQLUSER'" |
156 |
|
|
mysql -u root -e "DROP DATABASE $MYSQLDB" |
157 |
|
|
mysql -u root -e "REVOKE ALL PRIVILEGES ON $MYSQLDB.* FROM '$MYSQLUSER'@'localhost';" |
158 |
|
|
mysql -u root -e "DROP USER $MYSQLUSER@localhost;" |
159 |
|
|
|
160 |
|
|
|
161 |
|
|
# Delete folder $HTMLDIR |
162 |
|
|
echo "Deleting folder '$HTMLDIR'" |
163 |
|
|
rm -rf $HTMLDIR |
164 |
|
|
|
165 |
|
|
|
166 |
|
|
# Delete custom template fragment |
167 |
|
|
/sbin/e-smith/config delete $MYSQLDB |
168 |
|
|
/sbin/e-smith/expand-template etc/httpd/conf/httpd.conf |
169 |
|
|
/etc/rc7.d/S86httpd-e-smith sigusr1 |
170 |
|
|
|
171 |
|
|
%postun |
172 |
|
|
|
173 |
|
|
|