commit cde8b4d3a230296726b0622765ba5570f5a6e641 Author: Jonas Heinrich Date: Sun Mar 11 11:14:36 2018 +0100 first commit diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 0000000..54c8030 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,25 @@ +# Generated by mksrcinfo v8 +# Sun Mar 11 10:14:01 UTC 2018 +pkgbase = mozilla-firefox-sync-server + pkgdesc = Mozilla Sync Server for built-in Firefox Sync + pkgver = 1.7.0 + pkgrel = 1 + url = http://docs.services.mozilla.com/howtos/run-sync-1.5.html + install = mozilla-firefox-sync-server.install + arch = any + 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-1.7.0.tar.gz::https://github.com/mozilla-services/syncserver/archive/v1.7.0.tar.gz + source = ffsync.service + source = ffsync.tmpfiles + sha512sums = c66aed1195138f15729ed7ef3fb31837bd74f751c0df4f93d0d6c3a8b34687d7dc02e201cfb6c218aab1d769698950ea316f688b51d90b87e8c495d573b85cc3 + sha512sums = ccc56d118dce78aed3595577b489d984d1d697e6aa4cb9e2f30c7f16caaf2d2145d1e6bbabc737a867d5c5257cfa57ef0a031b11bc22c11b25523e7d889492d8 + sha512sums = a06ac68b5379de3352369c998ef73d0ff4ef4517243e8f7856435ec21937b86af6f3b5c216cce585ea6b572043b313c70b76bd183e89ed5e48916ff209d2ac30 + +pkgname = mozilla-firefox-sync-server + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..67c8e83 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,71 @@ +# Contributor: Timothée Ravier + +pkgname=mozilla-firefox-sync-server +pkgver=1.7.0 +pkgrel=1 +pkgdesc="Mozilla Sync Server for built-in Firefox Sync" +arch=('any') +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}-${pkgver}.tar.gz::https://github.com/mozilla-services/syncserver/archive/v${pkgver}.tar.gz" + 'ffsync.service' + 'ffsync.tmpfiles') +sha512sums=('c66aed1195138f15729ed7ef3fb31837bd74f751c0df4f93d0d6c3a8b34687d7dc02e201cfb6c218aab1d769698950ea316f688b51d90b87e8c495d573b85cc3' + 'ccc56d118dce78aed3595577b489d984d1d697e6aa4cb9e2f30c7f16caaf2d2145d1e6bbabc737a867d5c5257cfa57ef0a031b11bc22c11b25523e7d889492d8' + 'a06ac68b5379de3352369c998ef73d0ff4ef4517243e8f7856435ec21937b86af6f3b5c216cce585ea6b572043b313c70b76bd183e89ed5e48916ff209d2ac30') +backup=('opt/mozilla-firefox-sync-server/syncserver.ini') + +prepare() { + cd "syncserver-${pkgver}" + + # Change default sqlite database location + sed -i "s|/tmp/syncserver.db|/var/lib/ffsync/sync_storage.db|g" syncserver.ini +} + +build() { + cd "syncserver-${pkgver}" + make build + + # PostgreSQL support + # local/bin/pip install psycopg2 + + # 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 "syncserver-${pkgver}" + + #make test +} + +package() { + cd "syncserver-${pkgver}" + + # 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..39d2acc --- /dev/null +++ b/ffsync.service @@ -0,0 +1,29 @@ +[Unit] +Description=Gunicorn server running Mozilla's Firefox Sync Server - Version 1.5 +After=network.target + +[Service] +Type=simple +ExecStart=/opt/mozilla-firefox-sync-server/local/bin/gunicorn --paste /opt/mozilla-firefox-sync-server/syncserver.ini +Restart=on-abort + +User=ffsync +Group=http +UMask=007 + +NoNewPrivileges=yes + +PrivateTmp=yes +PrivateDevices=yes + +ProtectSystem=full +ProtectHome=yes + +SystemCallArchitectures=native +SystemCallFilter=~@clock @cpu-emulation @debug @keyring @module @mount @obsolete @raw-io + +CapabilityBoundingSet= +AmbientCapabilities= + +[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.install b/mozilla-firefox-sync-server.install new file mode 100644 index 0000000..03e415d --- /dev/null +++ b/mozilla-firefox-sync-server.install @@ -0,0 +1,21 @@ +post_install() { + getent group ffsync &>/dev/null || groupadd -r 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 +}