first commit

This commit is contained in:
Daniel Berteaud 2013-11-05 16:14:47 +01:00
commit 1dcb40a8a0
22 changed files with 216 additions and 0 deletions

12
createlinks Normal file
View File

@ -0,0 +1,12 @@
#!/usr/bin/perl -w
use esmith::Build::CreateLinks qw(:all);
# Templates to expand
templates2events("/etc/e-smith/sql/init/opensondage", qw(bootstrap-console-save webapps-update));
templates2events("/etc/opensondage/variables.php", qw(bootstrap-console-save webapps-update));
# PHP header and footer
safe_symlink("/etc/e-smith/templates-default/template-begin-php", "root/etc/e-smith/templates/etc/opensondage/variables.php/template-begin");
safe_symlink("/etc/e-smith/templates-default/template-end-php", "root/etc/e-smith/templates/etc/opensondage/variables.php/template-end");

View File

@ -0,0 +1 @@
url

View File

@ -0,0 +1 @@
opensondage

View File

@ -0,0 +1 @@
opensondage

View File

@ -0,0 +1 @@
enabled

View File

@ -0,0 +1 @@
webapp

View File

@ -0,0 +1,27 @@
{
my $rec = $DB->get('opensondage')
|| $DB->new_record('opensondage', {type => 'webapp'});
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);
}
}

View File

@ -0,0 +1 @@
PERMS=0750

View File

@ -0,0 +1,47 @@
{
my $db = $opensondage{'DbName'} || 'opensondage';
my $user = $opensondage{'DbUser'} || 'opensondage';
my $pass = $opensondage{'DbPassword'} || 'secret';
my $dbstruct = `rpm -qd smeserver-opensondage | grep mysql.sql`;
$OUT .= <<"END";
#! /bin/sh
if [ ! -d /var/lib/mysql/$db ]; then
/usr/bin/mysql -e 'create database $db'
/usr/bin/mysql $db < $dbstruct
fi
/usr/bin/mysql <<EOF
USE mysql;
REPLACE INTO user (
host,
user,
password)
VALUES (
'localhost',
'$user',
PASSWORD ('$pass'));
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',
'$db',
'$user',
'Y', 'Y', 'Y', 'Y',
'Y', 'Y', 'Y', 'Y', 'Y',
'N', 'Y', 'Y');
FLUSH PRIVILEGES;
EOF
END
}

View File

@ -0,0 +1,40 @@
{
my $access = $opensondage{'access'} || 'private';
my $allow = ($access eq 'public')?'all':"$localAccess $externalSSLAccess";
my $alias = (($opensondage{'AliasOnPrimary'} || 'enabled') eq 'enabled') ?
'Alias /opensondage /usr/share/opensondage' : '';
if ($opensondage{'status'} eq 'enabled'){
$OUT .=<<"END"
# OpenSondage Configuration
$alias
<Directory /usr/share/opensondage>
AllowOverride None
AddType application/x-httpd-php .php
php_admin_value open_basedir /usr/share/opensondage:/etc/opensondage:/usr/share/php
php_admin_flag file_uploads Off
php_admin_flag magic_quotes Off
php_admin_flag magic_quotes_gpc Off
php_admin_value max_execution_time 120
order deny,allow
deny from all
allow from $allow
Satisfy all
<Files ~ "\.(txt|TXT|sql|SQL)$">
Deny from all
</Files>
</Directory>
<Directory ~ "/usr/share/opensondage/(errors|adodb|iCalcreator|locale|php2pdf|scripts)">
Deny from all
</Directory>
END
}
else{
$OUT .= "# OpenSondage is disabled\n";
}
}

View File

@ -0,0 +1 @@
define('STUDS_URL', '{$SystemName.$DomainName}');

View File

@ -0,0 +1 @@
define('NOMAPPLICATION', "{$opensondage{'Name'} || 'OpenSondage'}");

View File

@ -0,0 +1 @@
define('ADRESSEMAILADMIN', 'admin@{$DomainName}');

View File

@ -0,0 +1,5 @@
define('BASE', '{opensondage{'DbName'} || 'opensondage'}');
define('USERBASE', "{opensondage{'DbUser'} || 'opensondage'}");
define('USERPASSWD', '{opensondage{'DbPassword'} || 'secret'}');
define('SERVEURBASE', '');
define('BASE_TYPE', 'mysql');

View File

@ -0,0 +1,8 @@
{
my $lang = 'en_US';
my $syslang = $sysconfig{'Language'} || 'en_US';
if ($syslang =~ m/^(fr_FR|es_ES|de_DE)$/){
$lang = $syslang;
}
$OUT .= "define('LANGUE', '$lang');";
}

View File

@ -0,0 +1,3 @@
define('LOGOBANDEAU', '{$opensondage{'LogoRight'} || 'images/Framadate_logo.png'}');
define('LOGOLETTRE', '{$opensondage{'LogoRight'} || 'images/Framadate_logo.png'}');
define('IMAGE_TITRE', '{$opensondage{'LogoCenter'} || 'images/logo-framadate.png'}');

View File

@ -0,0 +1 @@
define('URL_PROPRE', false);

View File

@ -0,0 +1 @@
define('GOOGLE_ANALYTICS_ID', false);

View File

@ -0,0 +1 @@
define('USE_REMOTE_USER', true);

View File

@ -0,0 +1,3 @@
if (@file_exists('variables.local.php')) \{
include('variables.local.php');
\}

View File

@ -0,0 +1,8 @@
// Studs version
define('STUDS_VERSION', '0.6.7');
// Do not edit the following
$ALLOWED_LANGUAGES = array('fr_FR' => 'french',
'en_GB' => 'english',
'es_ES' => 'spanish',
'de_DE' => 'german' );

View File

@ -0,0 +1,51 @@
%define name smeserver-opensondage
%define version 0.1.0
%define release 1.beta0
Summary: sme server integration of opensondage
Name: %{name}
Version: %{version}
Release: %{release}%{?dist}
License: GNU GPL version 2
URL: https://github.com/leblanc-simon/OpenSondage
Group: SMEserver/addon
Source: %{name}-%{version}.tar.gz
BuildArchitectures: noarch
BuildRequires: e-smith-devtools
BuildRoot: /var/tmp/%{name}-%{version}
Requires: e-smith-base
Requires: opensondage
Requires: smeserver-webapps-common
AutoReqProv: no
%description
smserver integration of opensondage.
OpenSondage is a tool for making polls to schedule meetings or events,
quickly and easily.
%changelog
* Tue Nov 5 2013 Daniel Berteaud <daniel@firewall-services.com> 0.1.0-1.sme
- First release
%prep
%setup
%build
perl ./createlinks
%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
%files -f %{name}-%{version}-filelist
%defattr(-,root,root)
%clean
rm -rf $RPM_BUILD_ROOT
%postun