commit
6f4e97bbae
16 changed files with 301 additions and 0 deletions
@ -0,0 +1,12 @@ |
||||
#!/usr/bin/perl -w |
||||
|
||||
use esmith::Build::CreateLinks qw(:all); |
||||
|
||||
|
||||
my $event = 'webapps-update'; |
||||
templates2events("/usr/share/vtigercrm/config.php", qw(webapps-update bootstrap-console-save)); |
||||
templates2events("/etc/e-smith/sql/init/80vtigercrm_mysql.sql", $event); |
||||
|
||||
safe_symlink("/etc/e-smith/templates-default/template-begin-php", "root/etc/e-smith/templates/usr/share/vtigercrm/config.php/template-begin"); |
||||
safe_symlink("/etc/e-smith/templates-default/template-end-php", "root/etc/e-smith/templates/usr/share/vtigercrm/config.php/template-end"); |
||||
|
@ -0,0 +1 @@ |
||||
url |
@ -0,0 +1 @@ |
||||
vtiger,crm |
@ -0,0 +1 @@ |
||||
vtigercrmdb |
@ -0,0 +1 @@ |
||||
vtigercrmuser |
@ -0,0 +1 @@ |
||||
enabled |
@ -0,0 +1 @@ |
||||
private |
@ -0,0 +1 @@ |
||||
enabled |
@ -0,0 +1 @@ |
||||
service |
@ -0,0 +1,33 @@ |
||||
{ |
||||
my $rec = $DB->get('vtigercrm') |
||||
|| $DB->new_record('vtigercrm', {type => 'service'}); |
||||
my $pw = $rec->prop('DbPassword'); |
||||
if (not $pw or length($pw) < 57) |
||||
{ |
||||
use MIME::Base64 qw(encode_base64); |
||||
|
||||
$pw = "not set due to error"; |
||||
if ( open( RANDOM, "/dev/urandom" ) ) |
||||
{ |
||||
my $buf; |
||||
# 57 bytes is a full line of Base64 coding, and contains |
||||
# 456 bits of randomness - given a perfectly random /dev/random |
||||
if ( read( RANDOM, $buf, 57 ) != 57 ) |
||||
{ |
||||
warn("Short read from /dev/random: $!"); |
||||
} |
||||
else |
||||
{ |
||||
$pw = encode_base64($buf); |
||||
chomp $pw; |
||||
} |
||||
close RANDOM; |
||||
} |
||||
else |
||||
{ |
||||
warn "Could not open /dev/urandom: $!"; |
||||
} |
||||
$rec->set_prop('DbPassword', $pw); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,22 @@ |
||||
{ |
||||
if (($vtigercrm{'CronJobs'} || 'disabled') eq 'enabled'){ |
||||
$OUT .=<<"HERE"; |
||||
|
||||
# Vtiger Cron Jobs |
||||
*/5 * * * * www wget --no-check-certificate https://localhost/vtigercrm/cron/intimateTaskStatus.php -O /dev/null 2> /dev/null |
||||
*/5 * * * * www wget --no-check-certificate https://localhost/vtigercrm/vtigercron.php?service=MailScanner -O /dev/null 2> /dev/null |
||||
*/5 * * * * www wget --no-check-certificate https://localhost/vtigercrm/vtigercron.php?service=RecurringInvoice -O /dev/null 2> /dev/null |
||||
*/5 * * * * www wget --no-check-certificate https://localhost/vtigercrm/vtigercron.php?service=com_vtiger_workflow -O /dev/null 2> /dev/null |
||||
*/5 * * * * www wget --no-check-certificate https://localhost/vtigercrm/SendReminder.php -O /dev/null 2> /dev/null |
||||
*/5 * * * * www wget --no-check-certificate https://localhost/vtigercrm/SendSupportNotification.php -O /dev/null |
||||
|
||||
HERE |
||||
|
||||
} |
||||
else{ |
||||
$OUT .= "\n\n# VtigerCRM Cron Jobs are disabled\n" . |
||||
"# To enable them:\n" . |
||||
"# db configuration setprop vtigercrm CronJobs enabled\n" . |
||||
"# signal-event webapps-update"; |
||||
} |
||||
} |
@ -0,0 +1,59 @@ |
||||
# Vtiger CRM MySQL init template |
||||
# |
||||
# This files creates/updates Vtiger CRM MySQL database infos |
||||
|
||||
|
||||
USE mysql; |
||||
|
||||
CREATE DATABASE IF NOT EXISTS { $vtigercrm{DbName} } DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; |
||||
|
||||
REPLACE INTO user ( |
||||
host, |
||||
user, |
||||
password) |
||||
VALUES ( |
||||
'localhost', |
||||
'{ $vtigercrm{DbUser} }', |
||||
PASSWORD ('{ $vtigercrm{DbPassword} }')); |
||||
|
||||
REPLACE INTO user ( |
||||
host, |
||||
user, |
||||
password) |
||||
VALUES ( |
||||
'%', |
||||
'{ $vtigercrm{DbUser} }', |
||||
PASSWORD ('{ $vtigercrm{DbPassword} }')); |
||||
|
||||
REPLACE INTO db ( |
||||
host, |
||||
db, |
||||
user, |
||||
select_priv, insert_priv, update_priv, delete_priv, |
||||
create_priv, alter_priv, index_priv, drop_priv, create_tmp_table_priv, |
||||
grant_priv, lock_tables_priv, references_priv) |
||||
VALUES ( |
||||
'localhost', |
||||
'{ $vtigercrm{DbName} }', |
||||
'{ $vtigercrm{DbUser} }', |
||||
'Y', 'Y', 'Y', 'Y', |
||||
'Y', 'Y', 'Y', 'Y', 'Y', |
||||
'N', 'Y', 'Y'); |
||||
|
||||
REPLACE INTO db ( |
||||
host, |
||||
db, |
||||
user, |
||||
select_priv, insert_priv, update_priv, delete_priv, |
||||
create_priv, alter_priv, index_priv, drop_priv, create_tmp_table_priv, |
||||
grant_priv, lock_tables_priv, references_priv) |
||||
VALUES ( |
||||
'%', |
||||
'{ $vtigercrm{DbName} }', |
||||
'{ $vtigercrm{DbUser} }', |
||||
'Y', 'Y', 'Y', 'Y', |
||||
'Y', 'Y', 'Y', 'Y', 'Y', |
||||
'N', 'Y', 'Y'); |
||||
|
||||
FLUSH PRIVILEGES; |
||||
|
@ -0,0 +1,53 @@ |
||||
Alias /vtigercrm /usr/share/vtigercrm |
||||
{ |
||||
|
||||
foreach my $alias (split (/[,;]/, ($vtigercrm{'Alias'} || '') )){ |
||||
$OUT .= "Alias /$alias /usr/share/vtigercrm\n"; |
||||
} |
||||
} |
||||
|
||||
<Directory /usr/share/vtigercrm> |
||||
Options None |
||||
AllowOverride None |
||||
|
||||
AddType application/x-httpd-php .php .php3 |
||||
php_admin_value memory_limit 64M |
||||
php_admin_value max_execution_time 600 |
||||
php_admin_flag allow_call_time_reference on |
||||
php_admin_flag register_globals off |
||||
php_admin_value error_reporting "E_WARNING & ~E_NOTICE" |
||||
{ |
||||
if ((${'vtigercrm'}{'InstallMode'} || 'disabled') eq 'enabled'){ |
||||
$OUT .= " php_admin_flag display_errors On\n". |
||||
" php_admin_flag log_errors Off"; |
||||
} |
||||
} |
||||
|
||||
Order Deny,Allow |
||||
{ |
||||
my $access = (${'vtigercrm'}{'access'} || 'private') eq 'public' ? |
||||
'all':"$localAccess $externalSSLAccess"; |
||||
$OUT .= " Allow from $access\n"; |
||||
} |
||||
<FilesMatch "install.php|migrate.php"> |
||||
Order allow,deny |
||||
{ |
||||
$OUT .= (${'vtigercrm'}{'InstallMode'} || 'disabled') eq 'enabled' ? |
||||
"Allow from $localAccess $externalSSLAccess\n":"Deny from all\n"; |
||||
} |
||||
</FilesMatch> |
||||
</Directory> |
||||
|
||||
|
||||
<Directory /usr/share/vtigercrm/install> |
||||
# 15" should be enough for migration in most case |
||||
php_value max_execution_time 900 |
||||
php_value memory_limit 128M |
||||
Order Allow,Deny |
||||
{ |
||||
$OUT .= (${'vtigercrm'}{'InstallMode'} || 'disabled') eq 'enabled' ? |
||||
" Allow from $localAccess $externalSSLAccess\n":" Deny from all\n"; |
||||
} |
||||
</Directory> |
||||
|
||||
|
@ -0,0 +1,17 @@ |
||||
{ |
||||
|
||||
my $p = $modSSL{'TCPPort'} || '443'; |
||||
|
||||
if ($port ne $p){ |
||||
|
||||
## Redirect Web Address to Secure Address |
||||
my @urls = split (/[,;]/, ($vtigercrm{'Alias'} || '')); |
||||
push (@urls, 'vtigercrm'); |
||||
$OUT .= "\tRewriteEngine on\n"; |
||||
foreach my $url (@urls){ |
||||
$OUT .= "\tRewriteRule ^/$url(/.*|\$) https://%{HTTP_HOST}/$url\$1 \[L,R\]\n"; |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
@ -0,0 +1,36 @@ |
||||
|
||||
/********************************************************************************* |
||||
* The contents of this file are subject to the SugarCRM Public License Version 1.1.2 |
||||
* ("License"); You may not use this file except in compliance with the |
||||
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL |
||||
* Software distributed under the License is distributed on an "AS IS" basis, |
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for |
||||
* the specific language governing rights and limitations under the License. |
||||
* The Original Code is: SugarCRM Open Source |
||||
* The Initial Developer of the Original Code is SugarCRM, Inc. |
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.; |
||||
* All Rights Reserved. |
||||
* Contributor(s): ______________________________________. |
||||
********************************************************************************/ |
||||
|
||||
/** |
||||
* The configuration file for FHS system |
||||
* is located at /etc/vtigercrm directory. |
||||
*/ |
||||
|
||||
|
||||
include('config.inc.php'); |
||||
|
||||
$dbconfig['db_server'] = 'localhost'; |
||||
$dbconfig['db_port'] = ':3306'; |
||||
$dbconfig['db_username'] = '{$vtigercrm{'DbUser'};}'; |
||||
$dbconfig['db_password'] = '{$vtigercrm{'DbPassword'};}'; |
||||
$dbconfig['db_name'] = '{$vtigercrm{'DbName'};}'; |
||||
$dbconfig['db_type'] = 'mysql'; |
||||
$dbconfig['db_status'] = 'true'; |
||||
|
||||
// TODO: test if port is empty |
||||
// TODO: set db_hostname dependending on db_type |
||||
$dbconfig['db_hostname'] = $dbconfig['db_server'].$dbconfig['db_port']; |
||||
|
||||
|
@ -0,0 +1,61 @@ |
||||
# $Id: smeserver-vtigercrm.spec,v 1.0 2009/09/30 16:20:28 slords Exp $ |
||||
# Authority: VIP-ire |
||||
# Name: Daniel B. |
||||
|
||||
Summary: Vtiger CRM for SME Server |
||||
%define name smeserver-vtigercrm |
||||
Name: %{name} |
||||
%define version 0.1 |
||||
%define release 0 |
||||
Version: %{version} |
||||
Release: %{release}%{?dist} |
||||
License: GPL |
||||
Group: Mitel/addon |
||||
Source: %{name}-%{version}.tar.gz |
||||
|
||||
#Patch0: smeserver-vtigercrm-0.1-foo.patch |
||||
|
||||
|
||||
URL: http://www.vtiger.com/ |
||||
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot |
||||
BuildArchitectures: noarch |
||||
Requires: e-smith-base |
||||
Requires: vtigercrm >= 5.1.0 |
||||
Requires: smeserver-webapps-common |
||||
BuildRequires: e-smith-devtools >= 1.13.1-03 |
||||
|
||||
%description |
||||
Integration package of Vtiger CRM for SME Server |
||||
|
||||
%changelog |
||||
* Wed Sep 30 2009 Daniel B. <daniel@firewall-services.com> 0.1-0 |
||||
- Initial rpm |
||||
|
||||
%prep |
||||
|
||||
%setup |
||||
#%patch0 -p1 |
||||
|
||||
%build |
||||
perl createlinks |
||||
|
||||
%install |
||||
/bin/rm -rf $RPM_BUILD_ROOT |
||||
(cd 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 |
||||
|
||||
%post |
||||
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf |
||||
sv t /service/httpd-e-smith |
||||
|
||||
%postun |
||||
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf |
||||
sv t /service/httpd-e-smith |
||||
|
Loading…
Reference in new issue