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