premier commit

tags/0.0.1
Daniel Berteaud 12 years ago
commit c2eb423c1c
  1. 7
      createlinks
  2. 1
      root/etc/e-smith/db/configuration/defaults/mozilla-sync/DbName
  3. 1
      root/etc/e-smith/db/configuration/defaults/mozilla-sync/DbUser
  4. 1
      root/etc/e-smith/db/configuration/defaults/mozilla-sync/status
  5. 1
      root/etc/e-smith/db/configuration/defaults/mozilla-sync/type
  6. 27
      root/etc/e-smith/db/configuration/migrate/mozilla-sync-database
  7. 43
      root/etc/e-smith/templates/etc/e-smith/sql/init/mozillasyncdb
  8. 2
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/20LoadModule97py26ModWsgi
  9. 27
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/97MozillaSync
  10. 10
      root/etc/e-smith/templates/etc/mozilla-sync-server/mozilla-sync-server.conf/000Setup
  11. 3
      root/etc/e-smith/templates/etc/mozilla-sync-server/mozilla-sync-server.conf/010global
  12. 7
      root/etc/e-smith/templates/etc/mozilla-sync-server/mozilla-sync-server.conf/020captcha
  13. 20
      root/etc/e-smith/templates/etc/mozilla-sync-server/mozilla-sync-server.conf/030storage
  14. 14
      root/etc/e-smith/templates/etc/mozilla-sync-server/mozilla-sync-server.conf/040auth
  15. 10
      root/etc/e-smith/templates/etc/mozilla-sync-server/mozilla-sync-server.conf/050nodes
  16. 6
      root/etc/e-smith/templates/etc/mozilla-sync-server/mozilla-sync-server.conf/060smtp
  17. 9
      root/etc/e-smith/templates/etc/mozilla-sync-server/mozilla-sync-server.conf/070cef
  18. 57
      smeserver-mozilla-sync-server.spec

@ -0,0 +1,7 @@
#!/usr/bin/perl -w
use esmith::Build::CreateLinks qw(:all);
templates2events("/etc/mozilla-sync-server/mozilla-sync-server.conf", qw(webapps-update bootstrap-console-save));
templates2events("/etc/e-smith/sql/init/mozillasyncdb", qw(webapps-update bootstrap-console-save));

@ -0,0 +1,27 @@
{
my $rec = $DB->get('mozilla-sync')
|| $DB->new_record('mozilla-sync', {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,43 @@
{
my $db = ${'mozilla-sync'}{'DbName'} || 'mozillasyncdb';
my $user = ${'mozilla-sync'}{'DbUser'} || 'mozillasync';
my $pass = ${'mozilla-sync'}{'DbPassword'} || 'secret';
$OUT .= <<"END";
#! /bin/sh
if [ ! -d /var/lib/mysql/$db ]; then
/usr/bin/mysql -e 'create database $db'
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
}

@ -0,0 +1,2 @@
# Load mod_wsgi for Mozilla Sync Server
LoadModule wsgi_module modules/python26-mod_wsgi.so

@ -0,0 +1,27 @@
{
if ((${'mozilla-sync'}{'status'} || 'disabled') eq 'enabled') {
my $access = ((${'mozilla-sync'}{'access'} || 'private') eq 'public') ? "all":"$localAccess $externalSSLAccess";
$OUT .=<<"EOF";
WSGIDaemonProcess localhost user=www group=www processes=2 threads=25
WSGIScriptAlias /mozilla-sync /usr/share/mozilla-sync-server/mozilla-sync-server.wsgi
WSGISocketPrefix /var/run/mozilla-sync-server.pid
<Location /mozilla-sync/>
Order deny,allow
Deny from all
Allow from $access
SSLRequireSSL on
WSGIProcessGroup localhost
WSGIPassAuthorization On
</Location>
EOF
}
else{
$OUT .= "# Mozilla Sync server is disabled";
}
}

@ -0,0 +1,10 @@
{
our $db = ${'mozilla-sync'}{'DbName'} || 'mozillasyncdb';
our $user = ${'mozilla-sync'}{'DbUser'} || 'mozillasync';
our $pass = ${'mozilla-sync'}{'DbPassword'} || 'secret';
our $quota = ${'mozilla-sync'}{'UserQuota'} || '102400';
our $useQuota = ($quota =~ m/^\d+$/) ? 'true':'false';
}

@ -0,0 +1,7 @@
[captcha]
use = false
public_key = 6Le8OLwSAAAAAK-wkjNPBtHD4Iv50moNFANIalJL
private_key = 6Le8OLwSAAAAAEKoqfc-DmoF4HNswD7RNdGwxRij
use_ssl = false

@ -0,0 +1,20 @@
{
$OUT .=<<"EOF";
[storage]
backend = syncstorage.storage.sql.SQLStorage
sqluri = mysql://$user:$pass@localhost/$db
standard_collections = false
use_quota = $useQuota
quota_size = $quota
pool_size = 20
pool_recycle = 3600
reset_on_return = true
display_config = true
create_tables = true
EOF
}

@ -0,0 +1,14 @@
{
$OUT .=<<"EOF";
[auth]
backend = services.user.sql.SQLUser
sqluri = mysql://$user:$pass@localhost/$db
pool_size = 20
pool_recycle = 3600
create_tables = true
EOF
}

@ -0,0 +1,10 @@
{
$OUT .=<<"EOF";
[nodes]
fallback_node = https://$SystemName.$DomainName/mozilla-sync/
EOF
}

@ -0,0 +1,6 @@
[smtp]
host = localhost
port = 25
sender = weave@{$DomainName}

@ -0,0 +1,9 @@
[cef]
use = true
file = syslog
vendor = mozilla
version = 0
device_version = 1.3
product = weave

@ -0,0 +1,57 @@
# Authority: vip-ire
# Name: Daniel Berteaud
%define name smeserver-mozilla-sync-server
%define version 0.0.1
%define release 0.beta1
Summary: sme server integration of Firefox Sync Server
Name: %{name}
Version: %{version}
Release: %{release}%{?dist}
License: GNU GPL
URL: https://wiki.mozilla.org/Firefox_Sync
Group: SMEserver/addon
Source: %{name}-%{version}.tar.gz
BuildArchitectures: noarch
BuildRequires: e-smith-devtools
BuildRoot: /var/tmp/%{name}-%{version}
Requires: e-smith-base >= 5.2.0-56
Requires: mozilla-sync-server
Requires: python26-wsgiproxy
Requires: python26-mysqldb
Requires: smeserver-webapps-common
%description
smserver integration of Firefox Sync Server.
The Firefox Sync Server (formelly known as Weave) lets you
sync history, settings, passwords, tabs etc... between several
devices or computers
%changelog
* Sun Sep 2 2012 Daniel Berteaud <daniel@firewall-services.com> 0.0.1
- Initial 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
echo "%doc CHANGELOG.git" >> %{name}-%{version}-filelist
%files -f %{name}-%{version}-filelist
%defattr(-,root,root)
%clean
rm -rf $RPM_BUILD_ROOT
%postun
Loading…
Cancel
Save