# $Id: smeserver-smf.spec,v 1.1 2013/03/03 22:11:18 unnilennium Exp $ # Authority: cool34000 # Name: Sylvain Gomez %define name smeserver-smf %define version 1.1.4 %define release 1 %define rpmver 4.0.4 Summary: SMF is a php web-based forum Name: %{name} Version: %{version} Release: %{release}%{?dist} License: GPL Group: Web/Application Source: %{name}-%{version}.tar.gz URL: http://www.simplemachines.org/ BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot BuildArchitectures: noarch BuildRequires: e-smith-devtools Requires: e-smith-base, e-smith-release >= 7 %description This RPM is an unofficial addon for the SME Server 7.x. Simple Machines Forum — SMF in short — is a free, professional grade software package that allows you to set up your own online community within minutes. http://yourdomain.com/forum %changelog * Thu Oct 11 2007 Sylvain Gomez - 1.1.4-1 Original 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 # Adding SMF to SME's db /etc/e-smith/events/actions/initialize-default-databases echo " " # Variables SMFPASS=$(/sbin/e-smith/db configuration getprop SMF DbPassword) DOMAIN=$(/sbin/e-smith/db configuration get DomainName) echo "Decompressing files..." cd /opt tar xfz SMF.tar.gz rm SMF.tar.gz echo "Creating MySQL user and DataBase..." mysqladmin -u root create smf mysql -e " grant select, insert, update, delete, alter, index, create, drop on smf.* to 'smf'@'localhost' " mysql -u root -e " SET PASSWORD FOR smf@localhost = PASSWORD( '$SMFPASS' ) " mysqladmin flush-privileges echo "Importing MySQL DataBase..." sed -e "s/yourdomain.com/$DOMAIN/" /opt/SMF.sql >/opt/SMF_1.sql mysql smf < /opt/SMF_1.sql rm -f /opt/SMF.sql rm -f /opt/SMF_1.sql # Changing password and domain-name in Settings.php sed -e "s/yourdomain.com/$DOMAIN/" /opt/SMF/Settings.php >/opt/SMF/Settings.php.new sed 's.smfpassword.'$SMFPASS'.g' /opt/SMF/Settings.php.new >/opt/SMF/Settings.php case "$LANG" in de_DE) sed -e "s/english/german-utf8/" /opt/SMF/Settings.php >/opt/SMF/Settings.php.new ;; es_ES) sed -e "s/english/spanish-utf8/" /opt/SMF/Settings.php >/opt/SMF/Settings.php.new ;; fr_FR) sed -e "s/english/french-utf8/" /opt/SMF/Settings.php >/opt/SMF/Settings.php.new ;; it_IT) sed -e "s/english/italian-utf8/" /opt/SMF/Settings.php >/opt/SMF/Settings.php.new ;; sv_FI) sed -e "s/english/swedish-utf8/" /opt/SMF/Settings.php >/opt/SMF/Settings.php.new ;; *) sed -e "s/english/english/" /opt/SMF/Settings.php >/opt/SMF/Settings.php.new ;; esac mv -f /opt/SMF/Settings.php.new /opt/SMF/Settings.php chown root:www /opt/SMF/Settings.php chmod 664 /opt/SMF/Settings.php # Changing password and domain-name in Settings_bak.php sed -e "s/yourdomain.com/$DOMAIN/" /opt/SMF/Settings_bak.php >/opt/SMF/Settings_bak.php.new sed 's.smfpassword.'$SMFPASS'.g' /opt/SMF/Settings_bak.php.new >/opt/SMF/Settings_bak.php case "$LANG" in de_DE) sed -e "s/english/german-utf8/" /opt/SMF/Settings_bak.php >/opt/SMF/Settings_bak.php.new ;; es_ES) sed -e "s/english/spanish-utf8/" /opt/SMF/Settings_bak.php >/opt/SMF/Settings_bak.php.new ;; fr_FR) sed -e "s/english/french-utf8/" /opt/SMF/Settings_bak.php >/opt/SMF/Settings_bak.php.new ;; it_IT) sed -e "s/english/italian-utf8/" /opt/SMF/Settings_bak.php >/opt/SMF/Settings_bak.php.new ;; sv_FI) sed -e "s/english/swedish-utf8/" /opt/SMF/Settings_bak.php >/opt/SMF/Settings_bak.php.new ;; *) sed -e "s/english/english/" /opt/SMF/Settings_bak.php >/opt/SMF/Settings_bak.php.new ;; esac mv -f /opt/SMF/Settings_bak.php.new /opt/SMF/Settings_bak.php chown root:www /opt/SMF/Settings_bak.php chmod 664 /opt/SMF/Settings_bak.php echo "Applying modifications to httpd..." /sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf /etc/rc7.d/S86httpd-e-smith sigusr1 case "$LANG" in de_DE) lang=German ;; es_ES) lang=Spanish ;; fr_FR) lang=French ;; it_IT) lang=Italian ;; sv_FI) lang=Swedish ;; *) lang=English ;; esac echo " " echo "-------------------------------------------------------------------------------" echo "SMF Installation finished." echo "Default forum language is set to $lang." echo "URL of the website : http://$DOMAIN/forum" echo " " echo "Login: admin" echo "Pass : admin" echo "Please change the admin password first!" echo " " /sbin/e-smith/config show SMF echo "-------------------------------------------------------------------------------" %preun %postun echo "Restarting Apache..." /sbin/e-smith/expand-template etc/httpd/conf/httpd.conf /etc/rc7.d/S86httpd-e-smith sigusr1 echo "Deleting MySQL user and DataBase..." mysql -u root -e "DROP DATABASE smf" mysql -u root -e "REVOKE ALL PRIVILEGES ON smf.* FROM 'smf'@'localhost';" mysql -u root -e "DROP USER smf@localhost;" /sbin/e-smith/config delete SMF echo "Removing install directory..." rm -rf /opt/SMF