From 02a43384b783bb2f8166c5f9d15d59ada259bf87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Ravier?= Date: Tue, 9 Jun 2015 12:43:30 +0200 Subject: [PATCH] Imported and fixed from the AURv3 --- .SRCINFO | 24 ++++++++ PKGBUILD | 76 +++++++++++++++++++++++++ ffsync.service | 14 +++++ ffsync.tmpfiles | 1 + mozilla-firefox-sync-server-git.install | 21 +++++++ 5 files changed, 136 insertions(+) create mode 100644 .SRCINFO create mode 100644 PKGBUILD create mode 100644 ffsync.service create mode 100644 ffsync.tmpfiles create mode 100644 mozilla-firefox-sync-server-git.install diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 0000000..e1c3048 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,24 @@ +pkgbase = mozilla-firefox-sync-server-git + pkgdesc = Mozilla Sync Server for built-in Firefox Sync - 1.5 version for Firefox 29+ + pkgver = 1.5.2.r0.g3d216e9 + pkgrel = 1 + url = http://docs.services.mozilla.com/howtos/run-sync-1.5.html + install = mozilla-firefox-sync-server-git.install + arch = i686 + arch = x86_64 + license = GPL + makedepends = git + depends = python2 + depends = python-virtualenv + conflicts = mozilla-firefox-sync-server-hg + options = !debug + backup = opt/mozilla-firefox-sync-server/syncserver.ini + source = mozilla-firefox-sync-server-git::git+https://github.com/mozilla-services/syncserver + source = ffsync.service + source = ffsync.tmpfiles + sha256sums = SKIP + sha256sums = f2e69486825f43f6a288adced31a6c2e51b0dbd84483aa427b2d85699c942446 + sha256sums = 462bfdccc672339a03622dbe0a76a2df1b4293de8b240e82fe127a6befaa1a89 + +pkgname = mozilla-firefox-sync-server-git + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..c2fb548 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,76 @@ +# Maintainer: Timothée Ravier + +pkgname=mozilla-firefox-sync-server-git +pkgver=1.5.2.r0.g3d216e9 +pkgrel=1 +pkgdesc="Mozilla Sync Server for built-in Firefox Sync - 1.5 version for Firefox 29+" +arch=('i686' 'x86_64') +url='http://docs.services.mozilla.com/howtos/run-sync-1.5.html' +license=('GPL') +depends=('python2' 'python-virtualenv') +makedepends=('git') +options=(!debug) +conflicts=('mozilla-firefox-sync-server-hg') +install=${pkgname}.install +source=("${pkgname}::git+https://github.com/mozilla-services/syncserver" + 'ffsync.service' + 'ffsync.tmpfiles') +sha256sums=('SKIP' + 'f2e69486825f43f6a288adced31a6c2e51b0dbd84483aa427b2d85699c942446' + '462bfdccc672339a03622dbe0a76a2df1b4293de8b240e82fe127a6befaa1a89') +backup=('opt/mozilla-firefox-sync-server/syncserver.ini') + +pkgver() { + cd ${pkgname} + git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' +} + +prepare() { + cd ${pkgname} + + # Change default sqlite database location + sed -i "s|/tmp/syncserver.db|/var/lib/ffsync/sync_storage.db|g" syncserver.ini +} + +build() { + cd ${pkgname} + make build + + # Install gunicorn to use with nginx + local/bin/pip install gunicorn + + # There is no install target in the Makefile, so let's do some cleaning + rm -rf .git .gitignore Dockerfile Makefile MANIFEST.in README.rst setup.py \ + local/bin/pep8 local/bin/build* local/bin/easy_install* local/bin/pip* \ + local/COMPLETE + + # Remove compiled python files as they may cause issues + find . -name '*.pyc' -delete + + # Manually fix install path + find . -type f -exec sed -i "s|${srcdir}/${pkgname}|/opt/${pkgname/-git}|g" {} \; +} + +check() { + cd ${pkgname} + + #make test +} + +package() { + cd ${pkgname} + + # There is no install target in the Makefile, installing manually + install -dm 755 "${pkgdir}"/opt/${pkgname/-git} "${pkgdir}"/var/lib/ffsync + cp -a * "${pkgdir}"/opt/${pkgname/-git} + + # Manually fix permissions + cd "${pkgdir}"/opt/${pkgname/-git} + find . -exec chmod go-w {} \; + find . -type f -exec chmod a+r {} \; + + install -Dm 644 "${srcdir}"/ffsync.service "${pkgdir}"/usr/lib/systemd/system/ffsync.service + install -Dm 644 "${srcdir}"/ffsync.tmpfiles "${pkgdir}"/usr/lib/tmpfiles.d/ffsync.conf +} + +# vim: ft=sh syn=sh ts=2 sw=2 et: diff --git a/ffsync.service b/ffsync.service new file mode 100644 index 0000000..e813263 --- /dev/null +++ b/ffsync.service @@ -0,0 +1,14 @@ +[Unit] +Description=Gunicorn server running Mozilla's Firefox Sync Server - Version 1.5 +After=network.target + +[Service] +Type=simple +User=ffsync +Group=http +UMask=007 +Restart=on-abort +ExecStart=/opt/mozilla-firefox-sync-server/local/bin/gunicorn --paste /opt/mozilla-firefox-sync-server/syncserver.ini + +[Install] +WantedBy=multi-user.target diff --git a/ffsync.tmpfiles b/ffsync.tmpfiles new file mode 100644 index 0000000..8de56d1 --- /dev/null +++ b/ffsync.tmpfiles @@ -0,0 +1 @@ +D /run/ffsync 0750 ffsync http diff --git a/mozilla-firefox-sync-server-git.install b/mozilla-firefox-sync-server-git.install new file mode 100644 index 0000000..437dd22 --- /dev/null +++ b/mozilla-firefox-sync-server-git.install @@ -0,0 +1,21 @@ +post_install() { + getent group ffsync &>/dev/null || groupadd ffsync >/dev/null + getent passwd ffsync &>/dev/null || useradd -r -s /usr/bin/false \ + -g ffsync -G ffsync,http -d /var/lib/ffsync ffsync >/dev/null + + chown -R ffsync:ffsync /var/lib/ffsync + systemd-tmpfiles --create ffsync.conf +} + +post_update() { + chown -R ffsync:ffsync /var/lib/ffsync + chown -R ffsync:http /run/ffsync + + echo ">> Documentation: https://wiki.archlinux.org/index.php/Mozilla_Firefox_Sync_Server" +} + +pre_remove() { + getent passwd ffsync &>/dev/null && userdel ffsync >/dev/null + getent group ffsync &>/dev/null && groupdel ffsync >/dev/null + true +}