# $Id: smeserver-phpbb.spec,v 1.4 2008/11/25 16:20:27 slords Exp $ # Authority: nocvs # Name: Dietmar Berteld %define name smeserver-phpbb %define version 2.0.22 %define release 2 %define rpmver 4.0.4 Summary: phpBB Forum Web Application for SME Server 7.x based on phpBB-2.0.22 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 Web Forum package . PhpBB has become the most widely used Open Source forum solution. With a large and highly customisable set of key features coupled with a standards compliant interface, phpBB will grow with, and compliment your website. With millions of installations worldwide, it is no wonder phpBB is one of the most popular ways to create and support a community. https://your_e-smith-server_adress/forum %changelog * Tue May 29 2007 Dietmar Berteld - [2.0.22-2] Change MySQL-creating method to SME and fixing bugs * Fri May 11 2007 Dietmar Berteld - [2.0.22-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 # General Information APP=phpBB URL=forum WORKDIR=/root HTMLDIR=/opt/phpBB2 MYSQLDB=phpbb MYSQLUSER=phpbbuser 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 echo "Untar the application to $HTMLDIR" cd /opt tar xfz phpBB-2.0.22.tar.gz tar xfz lang_french.tar.gz tar xfz lang_german.tar.gz tar xfz lang_italian.tar.gz tar xfz lang_spanish.tar.gz tar xfz lang_swedish.tar.gz rm -rf *.tar.gz mv lang* $HTMLDIR/language rm -rf /smeserver-phpbb-2.0.22-2.spec # Configuration of domain-settings sed -e "s/'youraddress@yourdomain.com'/'admin@$DOMAINE'/" $HTMLDIR/phpbb.sql >$HTMLDIR/phpbb.sql.new sed -e "s/'yourdomain.com'/'$DOMAINE'/" $HTMLDIR/phpbb.sql.new >$HTMLDIR/phpbb.sql sed -e "s/'A _little_ text to describe your forum'/'$DOMAINE'/" $HTMLDIR/phpbb.sql >$HTMLDIR/phpbb.sql.new sed -e "s/'www.myserver.tld'/'$DOMAINE'/" $HTMLDIR/phpbb.sql.new >$HTMLDIR/phpbb.sql case "$LANG" in de_DE) sed -e "s/'english'/'german'/" $HTMLDIR/phpbb.sql >$HTMLDIR/phpbb.sql.new ;; en_US) sed -e "s/'english'/'english'/" $HTMLDIR/phpbb.sql >$HTMLDIR/phpbb.sql.new ;; es_ES) sed -e "s/'english'/'spanish'/" $HTMLDIR/phpbb.sql >$HTMLDIR/phpbb.sql.new ;; fr_FR) sed -e "s/'english'/'french'/" $HTMLDIR/phpbb.sql >$HTMLDIR/phpbb.sql.new ;; it_IT) sed -e "s/'english'/'italian'/" $HTMLDIR/phpbb.sql >$HTMLDIR/phpbb.sql.new ;; sv_FI) sed -e "s/'english'/'swedish'/" $HTMLDIR/phpbb.sql >$HTMLDIR/phpbb.sql.new ;; esac # Creating the database echo "Creating database '$MYSQLDB' and user '$MYSQLUSER'" /etc/e-smith/events/actions/initialize-default-databases mysqladmin -u root create $MYSQLDB mysql $MYSQLDB < $HTMLDIR/phpbb.sql.new 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 # Deleting some folders and creation of config.php rm -rf $HTMLDIR/contrib rm -rf $HTMLDIR/docs rm -rf $HTMLDIR/install rm -rf $HTMLDIR/phpbb.sql rm -rf $HTMLDIR/phpbb.sql.new echo " $HTMLDIR/config.php echo >> $HTMLDIR/config.php echo >> $HTMLDIR/config.php echo "// phpBB 2.x auto-generated config file" >> $HTMLDIR/config.php echo "// Do not change anything in this file!" >> $HTMLDIR/config.php echo >> $HTMLDIR/config.php echo "\$dbms = 'mysql4';" >> $HTMLDIR/config.php echo >> $HTMLDIR/config.php echo "\$dbhost = 'localhost';" >> $HTMLDIR/config.php echo "\$dbname = '$MYSQLDB';" >> $HTMLDIR/config.php echo "\$dbuser = '$MYSQLUSER';" >> $HTMLDIR/config.php echo "\$dbpasswd = '$MYSQLPASS';" >> $HTMLDIR/config.php echo >> $HTMLDIR/config.php echo "\$table_prefix = 'phpbb_';" >> $HTMLDIR/config.php echo >> $HTMLDIR/config.php echo "define('PHPBB_INSTALLED', true);" >> $HTMLDIR/config.php echo >> $HTMLDIR/config.php echo "?>" >> $HTMLDIR/config.php # Change rights cd /opt chown -R root.root $HTMLDIR find $HTMLDIR -type d -exec chmod 555 {} \; find $HTMLDIR -type f -exec chmod 444 {} \; chmod 777 $HTMLDIR/images/avatars # Custom template fragment and restart services /sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf /etc/rc7.d/S86httpd-e-smith sigusr1 mysqladmin flush-privileges /etc/rc.d/init.d/mysql.init start 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=phpBB URL=forum WORKDIR=/root HTMLDIR=/opt/phpBB2 MYSQLDB=phpbb MYSQLUSER=phpbbuser # 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