Skip to content

Instantly share code, notes, and snippets.

@reetp
Created April 2, 2013 02:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reetp/5289414 to your computer and use it in GitHub Desktop.
Save reetp/5289414 to your computer and use it in GitHub Desktop.
smeserver-vtiger.spec
[builder@test smeserver-vtiger]$ cat smeserver-vtiger.spec
# $Id: smeserver-vtiger.spec,v 1.0 2013/03/30 03:11:22 reetp Exp $
# Authority: reetp
# Name: John Crisp
%define name smeserver-vtiger
%define version 5.4.0
%define release 1
Summary: smserver rpm to setup mysql database and web link for vtiger
Name: %{name}
Version: %{version}
Release: %{release}%{?dist}
License: GNU GPL version 2
URL: http://www.vtiger.com
Group: SMEserver/addon
Source: %{name}-%{version}.tar.gz
#Patches
#Patch0: smeserver-vtiger-1.0-rm80opt.patch
BuildArchitectures: noarch
BuildRoot: /var/tmp/%{name}-%{version}
#BuildRequires: e-smith-devtools >= 1.13.1-03
Requires: e-smith-release >= 8.0
#Requires: wordpress
AutoReqProv: no
%description
smserver rpm to setup mysql database and web link for vtiger
%changelog
* Sat Mar 30 2013 John Crisp <jcrisp@safeandsoundit.co.uk>>
- initial release
- [1.0-1]
%prep
%setup
# %patch0 -p1
%build
#only needed so it is removed afterwards
#mkdir -p root/opt/wordpress
#touch root/opt/wordpress/wp-config.php
%install
rm -rf $RPM_BUILD_ROOT
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
rm -f %{name}-%{version}-filelist
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
> %{name}-%{version}-filelist
echo "%doc COPYING" >> %{name}-%{version}-filelist
%clean
cd ..
rm -rf %{name}-%{version}
%pre
%preun
echo "delete the ibay crm through the web interface"
echo " "
echo "Enjoy every day of your life !"
echo " "
%post
echo ""
echo "see wiki.contribs.org/vtiger"
# This section creates the database, dbuser, dbpasswd and data after the
# package has been installed
# change permissions
chown -cRf admin /home/e-smith/files/ibays/crm/html
chgrp -cRf shared /home/e-smith/files/ibays/crm/html
chmod -cRf g+w /home/e-smith/files/ibays/crm/html/
echo "Creating database"
mysqladmin -u root create crm
mysql -u root -e "GRANT ALL PRIVILEGES ON crm.* TO www@localhost IDENTIFIED BY 'crm'"
mysqladmin -u root flush-privileges
# create ibay crm
##
echo "creating ibay 'crm'"
/sbin/e-smith/db accounts set crm ibay Name "crm"
minUid=$(/sbin/e-smith/db configuration get MinUid)
let "uid=minUid+1"
while grep -q :$uid:$uid: /etc/passwd
do
let uid=uid+1
done
/sbin/e-smith/db accounts setprop crm Uid $uid Gid $uid
/sbin/e-smith/db accounts setprop crm PublicAccess global
/sbin/e-smith/db accounts setprop crm UserAccess wr-group-rd-group
/sbin/e-smith/db accounts setprop crm PasswordSet no CgiBin enabled
/sbin/e-smith/db accounts setprop crm Group admin
/sbin/e-smith/db accounts setprop crm PHPBaseDir /home/e-smith/files/ibays/crm/html/:/tmp/
/sbin/e-smith/db accounts setprop crm PHPUploadDir /home/e-smith/files/ibays/crm/html/tmp/
/sbin/e-smith/signal-event ibay-create crm
echo " "
echo "go to http://your_e-smith-server/crm/index.php to finish installation"
echo " "
echo "at step 1 use the following entries"
echo " "
echo "Host Name : localhost"
echo "User Name : www"
echo "Password : crm"
echo "Database Name : crm"
echo " "
echo " "
echo " "
echo "Enjoy every day of your life !"
echo " "
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf
/sbin/e-smith/expand-template /etc/php.ini
/usr/bin/sv h /service/httpd-e-smith
%postun
#uninstall
echo "delete the ibay crm through the web interface"
echo " "
echo "Enjoy every day of your life !"
echo " "
/sbin/e-smith/db accounts delete crm
if [ $1 = 0 ] ; then
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf
/sbin/e-smith/expand-template /etc/php.ini
/usr/bin/sv h /service/httpd-e-smith
fi
%files -f %{name}-%{version}-filelist
%defattr(-,root,root)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment