From 7205fc2642a2fcd6ad5a30811efed63fad660715 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 13 Jul 2012 14:27:52 +0200 Subject: [PATCH] premier commit --- createlinks | 16 ++++++ root/etc/e-smith/db/accounts/defaults/jappix/type | 1 + .../db/configuration/defaults/jappix/status | 1 + .../e-smith/db/configuration/defaults/jappix/type | 1 + .../templates/etc/httpd/conf/httpd.conf/98Jappix | 64 ++++++++++++++++++++++ .../conf/httpd.conf/VirtualHosts/61RedirJappix | 14 +++++ .../e-smith/templates/etc/jappix/hosts.xml/10All | 13 +++++ .../templates/etc/jappix/installed.xml/10All | 5 ++ .../e-smith/templates/etc/jappix/main.xml/10Start | 2 + .../e-smith/templates/etc/jappix/main.xml/20All | 14 +++++ .../e-smith/templates/etc/jappix/main.xml/99end | 1 + smeserver-jappix.spec | 64 ++++++++++++++++++++++ 12 files changed, 196 insertions(+) create mode 100644 createlinks create mode 100644 root/etc/e-smith/db/accounts/defaults/jappix/type create mode 100644 root/etc/e-smith/db/configuration/defaults/jappix/status create mode 100644 root/etc/e-smith/db/configuration/defaults/jappix/type create mode 100644 root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98Jappix create mode 100644 root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/61RedirJappix create mode 100644 root/etc/e-smith/templates/etc/jappix/hosts.xml/10All create mode 100644 root/etc/e-smith/templates/etc/jappix/installed.xml/10All create mode 100644 root/etc/e-smith/templates/etc/jappix/main.xml/10Start create mode 100644 root/etc/e-smith/templates/etc/jappix/main.xml/20All create mode 100644 root/etc/e-smith/templates/etc/jappix/main.xml/99end create mode 100644 smeserver-jappix.spec diff --git a/createlinks b/createlinks new file mode 100644 index 0000000..79c21cf --- /dev/null +++ b/createlinks @@ -0,0 +1,16 @@ +#!/usr/bin/perl -w + +use esmith::Build::CreateLinks qw(:all); + +# Templates to expand +foreach my $event (qw/webapps-update bootstrap-console-save/){ + templates2events("/etc/jappix/hosts.xml", $event); + templates2events("/etc/jappix/main.xml", $event); + templates2events("/etc/jappix/installed.xml", $event); +} + +# Conf are XML files +safe_touch("root/etc/e-smith/templates/etc/jappix/hosts.xml/template-begin"); +safe_touch("root/etc/e-smith/templates/etc/jappix/main.xml/template-begin"); +safe_touch("root/etc/e-smith/templates/etc/jappix/installed.xml/template-begin"); + diff --git a/root/etc/e-smith/db/accounts/defaults/jappix/type b/root/etc/e-smith/db/accounts/defaults/jappix/type new file mode 100644 index 0000000..96cdd3b --- /dev/null +++ b/root/etc/e-smith/db/accounts/defaults/jappix/type @@ -0,0 +1 @@ +url diff --git a/root/etc/e-smith/db/configuration/defaults/jappix/status b/root/etc/e-smith/db/configuration/defaults/jappix/status new file mode 100644 index 0000000..86981e6 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/jappix/status @@ -0,0 +1 @@ +enabled diff --git a/root/etc/e-smith/db/configuration/defaults/jappix/type b/root/etc/e-smith/db/configuration/defaults/jappix/type new file mode 100644 index 0000000..1b93c9e --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/jappix/type @@ -0,0 +1 @@ +webapp diff --git a/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98Jappix b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98Jappix new file mode 100644 index 0000000..9aab65f --- /dev/null +++ b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98Jappix @@ -0,0 +1,64 @@ +{ +my $access = $jappix{'access'} || 'private'; +my $allow = ($access eq 'public')?"$localAccess $externalSSLAccess":'all'; +my $maxsize = $jappix{'MaxUploadSize'} || '100'; +$maxsize=$maxsize.'M'; + +my $requiressl = (($jappix{'RequireSSL'} || 'yes') =~ /^(enabled|yes|on)$/i) ? + "SSLRequireSSL on":"# RequireSSL is disabled"; + +my $alias = (($jappix{'AliasOnPrimary'} || 'enabled') eq 'enabled') ? + 'Alias /jappix /usr/share/jappix' : ''; + +if (($jappix{'status'} || 'disabled') eq 'enabled'){ + +$OUT .=<<"END" + +# Jappix Configuration +$alias + + + Options +FollowSymlinks + AllowOverride None + $requiressl + AddType application/x-httpd-php .php + php_admin_value open_basedir /usr/share/jappix/:/etc/jappix:/var/lib/jappix:/var/log/jappix:/var/cache/jappix + php_admin_flag file_uploads on + php_admin_value upload_max_filesize $maxsize + php_admin_value post_max_size $maxsize + php_admin_value memory_limit 64M + php_admin_value max_execution_time 900 + php_admin_value allow_url_fopen on + php_admin_value upload_tmp_dir /var/lib/jappix/tmp + php_admin_value session.save_path /var/lib/jappix/tmp + order deny,allow + deny from all + allow from $allow + Satisfy all + + + + Order Deny,Allow + Deny from all + + + + Order Deny,Allow + Deny from all + + +END + +} +else{ + $OUT .=<<'EOF'; + +# Jappix is disabled +# You can enabled it with the following commands +# db configuration setprop jappix status enabled +# signal-event webapps-update + +EOF +} +} + diff --git a/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/61RedirJappix b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/61RedirJappix new file mode 100644 index 0000000..bed1f7a --- /dev/null +++ b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/61RedirJappix @@ -0,0 +1,14 @@ +{ +my $sslport = $modSSL{'TCPPort'} || '443'; +my $alias = $jappix{'AliasOnPrimary'} || 'enabled'; +my $requiressl = $jappix{'RequireSSL'} || 'yes'; + +if (($port ne $sslport) && ($requiressl !~ /^(disabled|off|no)$/i) && ($alias ne 'disabled')){ + + ## Redirect Web Address to Secure Address + $OUT .= " RewriteEngine on\n"; + $OUT .= " RewriteRule ^/jappix(/.*|\$) https://%{HTTP_HOST}/jappix\$1 \[L,R\]\n"; + +} +} + diff --git a/root/etc/e-smith/templates/etc/jappix/hosts.xml/10All b/root/etc/e-smith/templates/etc/jappix/hosts.xml/10All new file mode 100644 index 0000000..be685ae --- /dev/null +++ b/root/etc/e-smith/templates/etc/jappix/hosts.xml/10All @@ -0,0 +1,13 @@ + + +
{$jappix{'Domain'} || $DomainName}
+ {$jappix{'Server'} || $DomainName} + {$jappix{'Server'} || $DomainName} + {$jappix{'Server'} || $DomainName} + {$jappix{'Server'} || $DomainName} + {$jappix{'BoshUrl'} || 'https://' . ($jappix{'Server'} || $DomainName) . '/http-bind/'} + + + + +
diff --git a/root/etc/e-smith/templates/etc/jappix/installed.xml/10All b/root/etc/e-smith/templates/etc/jappix/installed.xml/10All new file mode 100644 index 0000000..f60b8d0 --- /dev/null +++ b/root/etc/e-smith/templates/etc/jappix/installed.xml/10All @@ -0,0 +1,5 @@ + + + true + + diff --git a/root/etc/e-smith/templates/etc/jappix/main.xml/10Start b/root/etc/e-smith/templates/etc/jappix/main.xml/10Start new file mode 100644 index 0000000..8b7f018 --- /dev/null +++ b/root/etc/e-smith/templates/etc/jappix/main.xml/10Start @@ -0,0 +1,2 @@ + + diff --git a/root/etc/e-smith/templates/etc/jappix/main.xml/20All b/root/etc/e-smith/templates/etc/jappix/main.xml/20All new file mode 100644 index 0000000..b9183ed --- /dev/null +++ b/root/etc/e-smith/templates/etc/jappix/main.xml/20All @@ -0,0 +1,14 @@ + {$jappix{'Title'} || 'Jappix'} + {$jappix{'WelcomMessage'} || 'a free social network'} + {$jappix{'Ressource'} || 'Jappix'} + {$OUT .= (($jappix{'LockServer'} || 'enabled') =~ m/^enabled|yes|on$/i) ? 'on':'off'} + {$OUT .= (($jappix{'Anonymous'} || 'disabled') =~ m/^enabled|yes|on$/i) ? 'on':'off'} + {$OUT .= (($jappix{'Registration'} || 'disabled') =~ m/^enabled|yes|on$/i) ? 'on':'off'} + off + off + on + on + off + on + off + off diff --git a/root/etc/e-smith/templates/etc/jappix/main.xml/99end b/root/etc/e-smith/templates/etc/jappix/main.xml/99end new file mode 100644 index 0000000..7a0804c --- /dev/null +++ b/root/etc/e-smith/templates/etc/jappix/main.xml/99end @@ -0,0 +1 @@ + diff --git a/smeserver-jappix.spec b/smeserver-jappix.spec new file mode 100644 index 0000000..18dc15b --- /dev/null +++ b/smeserver-jappix.spec @@ -0,0 +1,64 @@ +# Authority: vip-ire +# Name: Daniel Berteaud + +%define name smeserver-jappix +%define version 0.1 +%define release 3 +Summary: sme server integration of jappix +Name: %{name} +Version: %{version} +Release: %{release}%{?dist} +License: GNU GPL +URL: http://www.firewall-services.com +Group: SMEserver/addon +Source: %{name}-%{version}.tar.gz + +Patch0: smeserver-jappix-0.1-session_save_path.patch +Patch1: smeserver-jappix-0.1-split_main_conf_templates.patch + +BuildArchitectures: noarch +BuildRequires: e-smith-devtools +BuildRoot: /var/tmp/%{name}-%{version} +Requires: e-smith-base +Requires: jappix +Requires: smeserver-webapps-common +AutoReqProv: no + +%description +smserver integration of Jappix. +Jappix is a feature complete, web based XMPP client + +%changelog +* Tue Dec 20 2011 Daniel Berteaud 0.1-3 +- CASification ready + +* Tue Dec 20 2011 Daniel Berteaud 0.1-2 +- Set session.save_path + +* Sun Jul 10 2011 Daniel Berteaud 0.1-1 +- Initial release + +%prep +%setup +%patch0 -p1 +%patch1 -p1 + +%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 +