Created
April 2, 2013 10:13
-
-
Save reetp/5291227 to your computer and use it in GitHub Desktop.
smeserver-vtiger-opt spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[builder@test ~]$ cat smeserver-vtiger-5.0.2-1.spec | |
%define name smeserver-vtiger | |
%define version 5.0.2 | |
%define release 1 | |
%define rpmver 4.0.4 | |
Summary: vtiger CRM Suite Web Application for SME Server 7.x based on vtiger 5.0.2 | |
Name: %{name} | |
Version: %{version} | |
Release: %{release} | |
Copyright: GPL | |
Group: /Web/Applications | |
Source: %{name}-%{version}.tar.gz | |
Packager: Dietmar Berteld <[email protected]> | |
URL: http://www.egroupware.org | |
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot | |
BuildArchitectures: noarch | |
Requires: e-smith-base, e-smith-release >= 7 | |
%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 CRM package. vtiger CRM is an enterprise-ready Open Source | |
CRM software mainly for small and medium businesses. vtiger CRM is | |
built over proven, fast, and reliable LAMP/WAMP (Linux/Windows, Apache, | |
MySQL, and PHP) technologies and other open source projects. | |
After installation open your webbrowser your local site | |
https://your_e-smith-server_adress/vtiger | |
%changelog | |
* Thu May 31 2007 Dietmar Berteld <[email protected]> | |
- [5.0.2-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=vTiger | |
URL=vtiger | |
WORKDIR=/root | |
HTMLDIR=/opt/vtigercrm | |
MYSQLDB=vtiger | |
MYSQLUSER=vtigeruser | |
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) | |
# Creating the database | |
/etc/e-smith/events/actions/initialize-default-databases | |
mysqladmin -u root create $MYSQLDB | |
mysql $MYSQLDB < $MYSQLDB.sql | |
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 | |
# Decompressing files | |
echo "Decompressing files..." | |
cd /opt | |
tar xfz vtigercrm.tar.gz | |
rm vtigercrm.tar.gz | |
# Change config settings | |
cd $HTMLDIR | |
sed -e 's!'vtigerpassword'!'$MYSQLPASS'!' config.inc.php > config.inc.php.new | |
sed -e 's!yourdomain!'$DOMAINE'!' config.inc.php.new > config.inc.php | |
case "$LANG" in | |
de_DE) sed -e "s/\$default_language = 'en_us';/\$default_language = 'de_de';/" config.inc.php >config.inc.php.new ;; | |
en_US) sed -e "s/\$default_language = 'en_us';/\$default_language = 'en_us';/" config.inc.php >config.inc.php.new ;; | |
es_ES) sed -e "s/\$default_language = 'en_us';/\$default_language = 'es_es';/" config.inc.php >config.inc.php.new ;; | |
fr_FR) sed -e "s/\$default_language = 'en_us';/\$default_language = 'fr_fr';/" config.inc.php >config.inc.php.new ;; | |
it_IT) sed -e "s/\$default_language = 'en_us';/\$default_language = 'it_it';/" config.inc.php >config.inc.php.new ;; | |
sv_FI) sed -e "s/\$default_language = 'en_us';/\$default_language = 'sv_FI';/" config.inc.php >config.inc.php.new ;; | |
esac | |
mv config.inc.php.new config.inc.php | |
rm -rf config.php.new | |
chown root.root config.inc.php | |
chmod 444 config.inc.php | |
# Delete some files | |
rm -rf /vtiger.sql | |
rm -rf /smeserver-vtiger* | |
# Custom template fragment | |
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf | |
/etc/rc7.d/S86httpd-e-smith sigusr1 | |
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 | |
APP=vTiger | |
URL=vtiger | |
WORKDIR=/root | |
HTMLDIR=/opt/vtigercrm | |
MYSQLDB=vtiger | |
MYSQLUSER=vtigeruser | |
# 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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment