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