From a4977de824b4d1ff4963c3cf033c9827fef620cb Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Mon, 18 Nov 2013 19:32:28 +0100 Subject: [PATCH] First commit --- createlinks | 10 ++++ .../e-smith/db/configuration/defaults/dl/status | 1 + root/etc/e-smith/db/configuration/defaults/dl/type | 1 + root/etc/e-smith/templates.metadata/etc/dl.php | 3 ++ root/etc/e-smith/templates/etc/dl.php/10Url | 14 ++++++ root/etc/e-smith/templates/etc/dl.php/15From | 1 + root/etc/e-smith/templates/etc/dl.php/20Spool | 1 + root/etc/e-smith/templates/etc/dl.php/25Locale | 5 ++ root/etc/e-smith/templates/etc/dl.php/30Defaults | 4 ++ root/etc/e-smith/templates/etc/dl.php/35ConfVer | 4 ++ root/etc/e-smith/templates/etc/dl.php/40Logs | 1 + root/etc/e-smith/templates/etc/dl.php/45Auth | 1 + root/etc/e-smith/templates/etc/dl.php/50Database | 1 + .../templates/etc/httpd/conf/httpd.conf/98Dl | 58 ++++++++++++++++++++++ smeserver-dl.spec | 46 +++++++++++++++++ 15 files changed, 151 insertions(+) create mode 100644 createlinks create mode 100644 root/etc/e-smith/db/configuration/defaults/dl/status create mode 100644 root/etc/e-smith/db/configuration/defaults/dl/type create mode 100644 root/etc/e-smith/templates.metadata/etc/dl.php create mode 100644 root/etc/e-smith/templates/etc/dl.php/10Url create mode 100644 root/etc/e-smith/templates/etc/dl.php/15From create mode 100644 root/etc/e-smith/templates/etc/dl.php/20Spool create mode 100644 root/etc/e-smith/templates/etc/dl.php/25Locale create mode 100644 root/etc/e-smith/templates/etc/dl.php/30Defaults create mode 100644 root/etc/e-smith/templates/etc/dl.php/35ConfVer create mode 100644 root/etc/e-smith/templates/etc/dl.php/40Logs create mode 100644 root/etc/e-smith/templates/etc/dl.php/45Auth create mode 100644 root/etc/e-smith/templates/etc/dl.php/50Database create mode 100644 root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98Dl create mode 100644 smeserver-dl.spec diff --git a/createlinks b/createlinks new file mode 100644 index 0000000..030ed9f --- /dev/null +++ b/createlinks @@ -0,0 +1,10 @@ +#!/usr/bin/perl -w + +use esmith::Build::CreateLinks qw(:all); + +# Templates to expand +templates2events("/etc/dl.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/dl.php/template-begin"); +safe_symlink("/etc/e-smith/templates-default/template-end-php", "root/etc/e-smith/templates/etc/dl.php/template-end"); diff --git a/root/etc/e-smith/db/configuration/defaults/dl/status b/root/etc/e-smith/db/configuration/defaults/dl/status new file mode 100644 index 0000000..86981e6 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/dl/status @@ -0,0 +1 @@ +enabled diff --git a/root/etc/e-smith/db/configuration/defaults/dl/type b/root/etc/e-smith/db/configuration/defaults/dl/type new file mode 100644 index 0000000..1b93c9e --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/dl/type @@ -0,0 +1 @@ +webapp diff --git a/root/etc/e-smith/templates.metadata/etc/dl.php b/root/etc/e-smith/templates.metadata/etc/dl.php new file mode 100644 index 0000000..bad4258 --- /dev/null +++ b/root/etc/e-smith/templates.metadata/etc/dl.php @@ -0,0 +1,3 @@ +PERMS=0640 +UID="root" +GID="www" diff --git a/root/etc/e-smith/templates/etc/dl.php/10Url b/root/etc/e-smith/templates/etc/dl.php/10Url new file mode 100644 index 0000000..65471fe --- /dev/null +++ b/root/etc/e-smith/templates/etc/dl.php/10Url @@ -0,0 +1,14 @@ +{ +use esmith::DomainsDB; +my $d = esmith::DomainsDB->open_ro || die "Couldn't open DomainsDB"; +my $vhost = "$SystemName.$DomainName/dl"; +foreach ($d->get_all_by_prop(type => 'domain'), $d->get_all_by_prop(type => 'vhost')){ + my $root = $_->prop('DocumentRoot') || ''; + if ($root eq '/usr/share/dl'){ + $vhost = $_->key; + last; + } +} + +$OUT .= "\$masterPath = '$vhost'"; +} diff --git a/root/etc/e-smith/templates/etc/dl.php/15From b/root/etc/e-smith/templates/etc/dl.php/15From new file mode 100644 index 0000000..fa4252c --- /dev/null +++ b/root/etc/e-smith/templates/etc/dl.php/15From @@ -0,0 +1 @@ +$fromAddr = "dl "; diff --git a/root/etc/e-smith/templates/etc/dl.php/20Spool b/root/etc/e-smith/templates/etc/dl.php/20Spool new file mode 100644 index 0000000..3c5e24a --- /dev/null +++ b/root/etc/e-smith/templates/etc/dl.php/20Spool @@ -0,0 +1 @@ +$spoolDir = "/var/lib/dl/"; diff --git a/root/etc/e-smith/templates/etc/dl.php/25Locale b/root/etc/e-smith/templates/etc/dl.php/25Locale new file mode 100644 index 0000000..9eb55ff --- /dev/null +++ b/root/etc/e-smith/templates/etc/dl.php/25Locale @@ -0,0 +1,5 @@ +{ +my $local = $sysconfig{'Language'} || 'en_US'; +$locale = (-e "/usr/share/dl/include/locale/$locale") ? "$locale":'en_US'; +$OUT .= "\$defLocale = '$locale'"; +} diff --git a/root/etc/e-smith/templates/etc/dl.php/30Defaults b/root/etc/e-smith/templates/etc/dl.php/30Defaults new file mode 100644 index 0000000..5c88319 --- /dev/null +++ b/root/etc/e-smith/templates/etc/dl.php/30Defaults @@ -0,0 +1,4 @@ +$defaultTicketTotalDays = 30; +$defaultTicketLastDlDays = 7; +$defaultTicketMaxDl = 0; +$defaultGrantTotalDays = 30; diff --git a/root/etc/e-smith/templates/etc/dl.php/35ConfVer b/root/etc/e-smith/templates/etc/dl.php/35ConfVer new file mode 100644 index 0000000..05e9310 --- /dev/null +++ b/root/etc/e-smith/templates/etc/dl.php/35ConfVer @@ -0,0 +1,4 @@ +{ +my $ver = `rpm -q --qf %{version} dl`; +$OUT .= "\$cfgVersion = '$ver';"; +} diff --git a/root/etc/e-smith/templates/etc/dl.php/40Logs b/root/etc/e-smith/templates/etc/dl.php/40Logs new file mode 100644 index 0000000..0ce861e --- /dev/null +++ b/root/etc/e-smith/templates/etc/dl.php/40Logs @@ -0,0 +1 @@ +$logFile = "dl_ticket"; diff --git a/root/etc/e-smith/templates/etc/dl.php/45Auth b/root/etc/e-smith/templates/etc/dl.php/45Auth new file mode 100644 index 0000000..fee9439 --- /dev/null +++ b/root/etc/e-smith/templates/etc/dl.php/45Auth @@ -0,0 +1 @@ +$authRealm = "dl"; diff --git a/root/etc/e-smith/templates/etc/dl.php/50Database b/root/etc/e-smith/templates/etc/dl.php/50Database new file mode 100644 index 0000000..09971b1 --- /dev/null +++ b/root/etc/e-smith/templates/etc/dl.php/50Database @@ -0,0 +1 @@ +$dsn = "sqlite:$spoolDir/data.sql"; diff --git a/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98Dl b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98Dl new file mode 100644 index 0000000..fd37f27 --- /dev/null +++ b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98Dl @@ -0,0 +1,58 @@ +{ +my $access = $dl{'access'} || 'private'; +my $allow = ($access eq 'public')?'all':"$localAccess $externalSSLAccess"; +my $auth = $dl{'Authentication'} || 'http'; +my $alias = (($dl{'AliasOnPrimary'} || 'enabled') eq 'enabled') ? + 'Alias /dl /usr/share/dl' : ''; +my $authuser = ''; +my $authadmin = ''; +if ($auth eq 'http'){ + $auth =<<'EOF'; + + SSLRequireSSL on + AuthName "dl" + AuthType Basic + AuthExternal pwauth + Require valid-user + +EOF +} +if ($dl{'status'} eq 'enabled'){ + +$OUT .=<<"END" + +# dl Configuration +$alias + + + AllowOverride Limit + AddType application/x-httpd-php .php + php_admin_value open_basedir /usr/share/dl:/etc/dl.php:/var/lib/dl + php_admin_flag file_uploads On + php_admin_flag magic_quotes Off + php_admin_flag magic_quotes_gpc Off + php_admin_value upload_max_filesize 1024M + php_admin_value post_max_size 1025M + php_admin_value memory_limit 100M + php_admin_flag output_buffering Off + php_admin_value max_execution_time 0 + php_admin_value upload_tmp_dir /var/lib/dl/tmp + php_admin_value session.save_path /var/lib/dl/tmp + php_admin_value session.gc_maxlifetime 86400 + order deny,allow + deny from all + allow from $allow +$authuser + + + Deny from all + + + Deny from all + +END +} +else{ + $OUT .= "# dl is disabled\n"; +} +} diff --git a/smeserver-dl.spec b/smeserver-dl.spec new file mode 100644 index 0000000..1563ddf --- /dev/null +++ b/smeserver-dl.spec @@ -0,0 +1,46 @@ +%define name smeserver-dl +%define version 0.1.0 +%define release 1.beta0 +Summary: sme server integration of dl +Name: %{name} +Version: %{version} +Release: %{release}%{?dist} +License: GNU GPL version 2 +URL: http://www.thregr.org/~wavexx/software/dl/ +Group: SMEserver/addon +Source: %{name}-%{version}.tar.gz + +BuildArchitectures: noarch +BuildRequires: e-smith-devtools +BuildRoot: %{_tmppath}/%{name}-%{version} +Requires: e-smith-base +Requires: dl +Requires: smeserver-webapps-common + +%description +smserver integration of dl + +%changelog +* Mon Nov 18 2013 Daniel Berteaud 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