# $Id: smeserver-gallery.spec,v 1.4 2008/11/25 16:20:22 slords Exp $ # Authority: nocvs # Name: Dietmar Berteld %define name smeserver-gallery2 %define version 2.2 %define release 3 %define rpmver 4.0.4 Summary: gallery2 Photo Sharing Web Application for SME Server 7.x based on Gallery2 2.2 Name: %{name} Version: %{version} Release: %{release}%{?dist} License: GPL Group: /Web/Applications Source: %{name}-%{version}.tar.gz URL: http://group-office.com/ BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot BuildArchitectures: noarch Requires: e-smith-base, e-smith-release >= 7 BuildRequires: e-smith-devtools %description This RPM is an unofficial addon for the SME Server 7.x. The target audience is the Linux/E-smith administrator who wants to add Photo Sharing package . Gallery2 is the next generation of open source photo sharing web applications. Gallery2 gives you an intuitive way to blend photo management seamlessly into your own website whether you're running a small personal site or a large community site. Hundreds of thousands of people and organizations are using Gallery2 to create personalized photo albums on their websites. After installation open your webbrowser your local site https://your_e-smith-server_adress/gallery2 %changelog * Tue May 29 2007 Dietmar Berteld - [2.2.2-3] Change MySQL-creating method to SME and fix the "upgrade bug" with chmod 640 to the /opt/gallery2/html/upgrade directory * Mon May 14 2007 Dietmar Berteld - [2.2-2] Change to variables, automatic language settings * Thu May 08 2007 Dietmar Berteld - [2.2-1] Initial version %prep rm -rf $RPM_BUILD_ROOT %setup %build %install /bin/rm -rf $RPM_BUILD_ROOT (/usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT) /bin/rm -f %{name}-%{version}-filelist /sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist %files -f %{name}-%{version}-filelist %defattr(-,root,root) %clean rm -rf $RPM_BUILD_ROOT %pre %post APP=Gallery2 URL=gallery2 WORKDIR=/root HTMLDIR=/opt/gallery2 MYSQLDB=gallery2 MYSQLUSER=gallery2user GATEWAY=$(/sbin/e-smith/db configuration get GatewayIP) LOCALIP=$(/sbin/e-smith/db configuration get LocalIP) LOCMASK=$(/sbin/e-smith/db configuration get LocalNetmask) DOMAINE=$(/sbin/e-smith/db configuration get DomainName) SRVMODE=$(/sbin/e-smith/db configuration get SystemMode) SRVNAME=$(/sbin/e-smith/db configuration get SystemName) if [ "$SRVMODE" = "servergateway" ]; then OUTERIP=$(/sbin/e-smith/db configuration get ExternalIP) OUTMASK=$(/sbin/e-smith/db configuration get ExternalNetmask) fi TIMEZONE=$(/sbin/e-smith/db configuration get TimeZone) # Untar the application to /opt cd /opt tar xzf gallery2.tar.gz rm -rf gallery2.tar.gz rm -rf /smeserver-gallery2-2.2-3.spec # Creating the database echo "Creating database '$MYSQLDB' and user '$MYSQLUSER'" /etc/e-smith/events/actions/initialize-default-databases mysqladmin -u root create $MYSQLDB case "$LANG" in en_US) mysql $MYSQLDB < $HTMLDIR/gallery2_en.sql ;; de_DE) mysql $MYSQLDB < $HTMLDIR/gallery2_de.sql ;; es_ES) mysql $MYSQLDB < $HTMLDIR/gallery2_es.sql ;; fr_FR) mysql $MYSQLDB < $HTMLDIR/gallery2_fr.sql ;; it_IT) mysql $MYSQLDB < $HTMLDIR/gallery2_it.sql ;; sv_SE) mysql $MYSQLDB < $HTMLDIR/gallery2_sv.sql ;; esac MYSQLPASS=$(/sbin/e-smith/config getprop $MYSQLDB DbPassword) mysql -u root -e "SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( '$MYSQLPASS' ) " mysqladmin flush-privileges /etc/rc.d/init.d/mysql.init start # Change Gallery2-Password cd $HTMLDIR/html sed 's.gallery2password.'$MYSQLPASS'.g' config.php > config_neu.php mv config_neu.php config.php chmod 644 config.php chmod -R 640 upgrade # Deleting some folders and creation of config.php rm -rf $HTMLDIR/html/install rm -rf $HTMLDIR/$MYSQLDB*.sql # Custom template fragment /sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf /etc/rc7.d/S86httpd-e-smith sigusr1 echo "=======================================================================" echo "$APP Installation finished. " echo "go to http://$DOMAINE/$URL" echo "Username : admin" echo "Password : admin" echo " " echo "Please change the admin-password !! " echo "=======================================================================" %preun # General Information APP=Gallery2 URL=gallery2 WORKDIR=/root HTMLDIR=/opt/gallery2 MYSQLDB=gallery2 MYSQLUSER=gallery2user # This section deletes the database echo "Deleting database '$MYSQLDB' and user '$MYSQLUSER'" mysql -u root -e "DROP DATABASE $MYSQLDB" mysql -u root -e "REVOKE ALL PRIVILEGES ON $MYSQLDB.* FROM '$MYSQLUSER'@'localhost';" mysql -u root -e "DROP USER $MYSQLUSER@localhost;" # Delete folder $HTMLDIR echo "Deleting folder '$HTMLDIR'" rm -rf $HTMLDIR # Delete custom template fragment /sbin/e-smith/config delete $MYSQLDB /sbin/e-smith/expand-template etc/httpd/conf/httpd.conf /etc/rc7.d/S86httpd-e-smith sigusr1 %postun