1 |
# $Id: smeserver-oscommerce.spec,v 1.5 2008/11/25 16:20:27 slords Exp $ |
2 |
# Authority: cool34000 |
3 |
# Name: Sylvain Gomez |
4 |
|
5 |
%define name smeserver-oscommerce |
6 |
%define version 2.2rc1 |
7 |
%define release 3 |
8 |
%define rpmver 4.0.4 |
9 |
|
10 |
Summary: osCommerce is a web-based online shop e-commerce solution |
11 |
Name: %{name} |
12 |
Version: %{version} |
13 |
Release: %{release}%{?dist} |
14 |
License: GPL |
15 |
Group: Web/Application |
16 |
Source: %{name}-%{version}.tar.gz |
17 |
URL: http://www.oscommerce.com/ |
18 |
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot |
19 |
BuildArchitectures: noarch |
20 |
BuildRequires: e-smith-devtools |
21 |
Requires: e-smith-base, e-smith-release >= 7 |
22 |
|
23 |
%description |
24 |
This RPM is an unofficial addon for the SME Server 7.x. |
25 |
osCommerce is an Open Source based online shop e-commerce solution that is available for free under the GNU General Public License. |
26 |
It features a rich set of out-of-the-box online shopping cart functionality that allows store owners to setup, run, and maintain |
27 |
their online stores with minimum effort and with no costs, fees, or limitations involved. |
28 |
http://yourdomain.com/oscommerce |
29 |
|
30 |
%changelog |
31 |
* Thu Feb 07 2008 Jonathan Martens <smeserver-contribs@snetram.nl> |
32 |
- 2.2rc1-3 |
33 |
- Removed version number from spec file filename |
34 |
- Fixed control commands for httpd-e-smith |
35 |
|
36 |
* Mon Oct 15 2007 Sylvain Gomez <sylvaingomez@free.fr> |
37 |
- 2.2rc1-2 |
38 |
- Fixed forced https redirection |
39 |
- Fixed Apache template for better compatibility with SME 8.0 |
40 |
- Better integration in SME |
41 |
|
42 |
* Sun Aug 12 2007 Sylvain Gomez <sylvaingomez@free.fr> |
43 |
- 2.2rc1-1 |
44 |
- Original version |
45 |
|
46 |
%prep |
47 |
rm -rf $RPM_BUILD_ROOT |
48 |
|
49 |
%setup |
50 |
|
51 |
%build |
52 |
|
53 |
%install |
54 |
/bin/rm -rf $RPM_BUILD_ROOT |
55 |
(/usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT) |
56 |
/bin/rm -f %{name}-%{version}-filelist |
57 |
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist |
58 |
|
59 |
%files -f %{name}-%{version}-filelist |
60 |
|
61 |
%defattr(-,root,root) |
62 |
|
63 |
%clean |
64 |
rm -rf $RPM_BUILD_ROOT |
65 |
|
66 |
%pre |
67 |
|
68 |
%post |
69 |
# Adding oscommerce to SME's db |
70 |
/etc/e-smith/events/actions/initialize-default-databases |
71 |
echo " " |
72 |
|
73 |
# Variables |
74 |
OSCOMPASS=$(/sbin/e-smith/db configuration getprop oscommerce DbPassword) |
75 |
DOMAIN=$(/sbin/e-smith/db configuration get DomainName) |
76 |
|
77 |
echo "Decompressing files..." |
78 |
cd /opt |
79 |
tar xfz oscommerce.tar.gz |
80 |
rm oscommerce.tar.gz |
81 |
|
82 |
echo "Creating MySQL user and DataBase..." |
83 |
mysqladmin -u root create oscommerce |
84 |
mysql -e " grant select, insert, update, delete on oscommerce.* to 'oscommerce'@'localhost' " |
85 |
mysql -u root -e " SET PASSWORD FOR oscommerce@localhost = PASSWORD( '$OSCOMPASS' ) " |
86 |
mysqladmin flush-privileges |
87 |
|
88 |
echo "Importing MySQL DataBase..." |
89 |
mysql oscommerce < /opt/oscommerce.sql |
90 |
rm -f /opt/oscommerce.sql |
91 |
|
92 |
# Changing password and domain-name in both configure.php |
93 |
sed -e "s/yourdomain.com/$DOMAIN/" /opt/oscommerce/catalog/includes/configure.php >/opt/oscommerce/catalog/includes/configure.php.new |
94 |
sed -e "s/yourdomain.com/$DOMAIN/" /opt/oscommerce/catalog/admin/includes/configure.php >/opt/oscommerce/catalog/admin/includes/configure.php.new |
95 |
sed 's.yourdbpassword.'$OSCOMPASS'.g' /opt/oscommerce/catalog/includes/configure.php.new >/opt/oscommerce/catalog/includes/configure.php |
96 |
sed 's.yourdbpassword.'$OSCOMPASS'.g' /opt/oscommerce/catalog/admin/includes/configure.php.new >/opt/oscommerce/catalog/admin/includes/configure.php |
97 |
rm -f /opt/oscommerce/catalog/includes/configure.php.new |
98 |
rm -f /opt/oscommerce/catalog/admin/includes/configure.php.new |
99 |
|
100 |
echo "Applying modifications to httpd..." |
101 |
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf |
102 |
/usr/sbin/sv t httpd-e-smith |
103 |
|
104 |
echo " " |
105 |
echo "-------------------------------------------------------------------------------" |
106 |
echo "osCommerce Installation finished." |
107 |
echo "URL of the website : http://$DOMAIN/oscommerce" |
108 |
echo "URL of the adminpanel: https://$DOMAIN/oscommerce/admin" |
109 |
echo " " |
110 |
echo "Please change first the admin password!" |
111 |
echo "User: admin" |
112 |
echo "Pass: admin" |
113 |
echo " " |
114 |
/sbin/e-smith/config show oscommerce |
115 |
echo "-------------------------------------------------------------------------------" |
116 |
|
117 |
%preun |
118 |
|
119 |
%postun |
120 |
echo "Restarting Apache..." |
121 |
/sbin/e-smith/expand-template etc/httpd/conf/httpd.conf |
122 |
/usr/sbin/sv t httpd-e-smith |
123 |
|
124 |
echo "Deleting MySQL user and DataBase..." |
125 |
mysql -u root -e "DROP DATABASE oscommerce" |
126 |
mysql -u root -e "REVOKE ALL PRIVILEGES ON oscommerce.* FROM 'oscommerce'@'localhost';" |
127 |
mysql -u root -e "DROP USER oscommerce@localhost;" |
128 |
/sbin/e-smith/config delete oscommerce |
129 |
|
130 |
echo "Removing install directory..." |
131 |
rm -rf /opt/oscommerce |