# $Id: smeserver-oscommerce.spec,v 1.3 2008/04/02 15:03:58 slords Exp $ # Authority: cool34000 # Name: Sylvain Gomez %define name smeserver-oscommerce %define version 2.2rc1 %define release 3 %define rpmver 4.0.4 Summary: osCommerce is a web-based online shop e-commerce solution Name: %{name} Version: %{version} Release: %{release}%{?dist} License: GPL Group: Web/Application Source: %{name}-%{version}.tar.gz URL: http://www.oscommerce.com/ 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. osCommerce is an Open Source based online shop e-commerce solution that is available for free under the GNU General Public License. It features a rich set of out-of-the-box online shopping cart functionality that allows store owners to setup, run, and maintain their online stores with minimum effort and with no costs, fees, or limitations involved. http://yourdomain.com/oscommerce %changelog * Thu Feb 07 2008 Jonathan Martens - 2.2rc1-3 - Removed version number from spec file filename - Fixed control commands for httpd-e-smith * Mon Oct 15 2007 Sylvain Gomez - 2.2rc1-2 - Fixed forced https redirection - Fixed Apache template for better compatibility with SME 8.0 - Better integration in SME * Sun Aug 12 2007 Sylvain Gomez - 2.2rc1-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 oscommerce to SME's db /etc/e-smith/events/actions/initialize-default-databases echo " " # Variables OSCOMPASS=$(/sbin/e-smith/db configuration getprop oscommerce DbPassword) DOMAIN=$(/sbin/e-smith/db configuration get DomainName) echo "Decompressing files..." cd /opt tar xfz oscommerce.tar.gz rm oscommerce.tar.gz echo "Creating MySQL user and DataBase..." mysqladmin -u root create oscommerce mysql -e " grant select, insert, update, delete on oscommerce.* to 'oscommerce'@'localhost' " mysql -u root -e " SET PASSWORD FOR oscommerce@localhost = PASSWORD( '$OSCOMPASS' ) " mysqladmin flush-privileges echo "Importing MySQL DataBase..." mysql oscommerce < /opt/oscommerce.sql rm -f /opt/oscommerce.sql # Changing password and domain-name in both configure.php sed -e "s/yourdomain.com/$DOMAIN/" /opt/oscommerce/catalog/includes/configure.php >/opt/oscommerce/catalog/includes/configure.php.new sed -e "s/yourdomain.com/$DOMAIN/" /opt/oscommerce/catalog/admin/includes/configure.php >/opt/oscommerce/catalog/admin/includes/configure.php.new sed 's.yourdbpassword.'$OSCOMPASS'.g' /opt/oscommerce/catalog/includes/configure.php.new >/opt/oscommerce/catalog/includes/configure.php sed 's.yourdbpassword.'$OSCOMPASS'.g' /opt/oscommerce/catalog/admin/includes/configure.php.new >/opt/oscommerce/catalog/admin/includes/configure.php rm -f /opt/oscommerce/catalog/includes/configure.php.new rm -f /opt/oscommerce/catalog/admin/includes/configure.php.new echo "Applying modifications to httpd..." /sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf /usr/sbin/sv t httpd-e-smith echo " " echo "-------------------------------------------------------------------------------" echo "osCommerce Installation finished." echo "URL of the website : http://$DOMAIN/oscommerce" echo "URL of the adminpanel: https://$DOMAIN/oscommerce/admin" echo " " echo "Please change first the admin password!" echo "User: admin" echo "Pass: admin" echo " " /sbin/e-smith/config show oscommerce echo "-------------------------------------------------------------------------------" %preun %postun echo "Restarting Apache..." /sbin/e-smith/expand-template etc/httpd/conf/httpd.conf /usr/sbin/sv t httpd-e-smith echo "Deleting MySQL user and DataBase..." mysql -u root -e "DROP DATABASE oscommerce" mysql -u root -e "REVOKE ALL PRIVILEGES ON oscommerce.* FROM 'oscommerce'@'localhost';" mysql -u root -e "DROP USER oscommerce@localhost;" /sbin/e-smith/config delete oscommerce echo "Removing install directory..." rm -rf /opt/oscommerce