diff options
author | Jonne Haß | 2016-09-05 20:57:59 +0200 |
---|---|---|
committer | Jonne Haß | 2016-09-05 20:57:59 +0200 |
commit | 6c59b63b07c97df3464aa2e0497c9cb99d62c753 (patch) | |
tree | 5a3c80ad63c9328a8776f02b1bbe4ed4dce76b44 | |
download | aur-6c59b63b07c97df3464aa2e0497c9cb99d62c753.tar.gz |
diaspora-postgresql-git: add
-rw-r--r-- | .SRCINFO | 43 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | PKGBUILD | 140 | ||||
-rw-r--r-- | diaspora.bash_profile | 1 | ||||
-rw-r--r-- | diaspora.bashrc | 3 | ||||
-rw-r--r-- | diaspora.install | 30 | ||||
-rw-r--r-- | diaspora.service | 15 | ||||
-rw-r--r-- | diaspora.tmpfiles.d.conf | 3 |
8 files changed, 236 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..dc3ea53fff77 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,43 @@ +# Generated by mksrcinfo v8 +# Mon Sep 5 18:53:20 UTC 2016 +pkgbase = diaspora-postgresql-git + pkgdesc = A distributed privacy aware social network (development head) (PostgreSQL) + pkgver = 0.6.0.0.r62.ga53354e + pkgrel = 1 + url = https://diasporafoundation.org + install = diaspora.install + arch = i686 + arch = x86_64 + license = AGPL3 + makedepends = nodejs + depends = ruby + depends = ruby-bundler + depends = redis + depends = imagemagick + depends = libxslt + depends = net-tools + depends = gsfonts + depends = postgresql-libs + optdepends = postgresql: Database server + conflicts = diaspora-mysql + conflicts = diaspora-postgresql + conflicts = diaspora-mysql-git + options = !strip + backup = etc/webapps/diaspora/diaspora.yml + backup = etc/webapps/diaspora/database.yml + backup = etc/webapps/diaspora/secret_token.rb + source = git+https://github.com/diaspora/diaspora.git#branch=develop + source = diaspora.install + source = diaspora.service + source = diaspora.tmpfiles.d.conf + source = diaspora.bashrc + source = diaspora.bash_profile + sha256sums = SKIP + sha256sums = aae126c4b1bcba6265d3d925dc3845bb034defa5606385c22dfb053111b57685 + sha256sums = 0d9f3aea98f4d43607eb37cbe030fbee27888f41fb8799308db33991e11d024d + sha256sums = 7128024976c95d511d8995c472907fe0b8c36fe5b45fef57fc053e3fadcae408 + sha256sums = 77cb2529eacef2d1e77aad5daf21856f67097d6342f230e5dd5057f753932bfa + sha256sums = 29cfd5116e919d8851ff70b8b82af8d4a6c8243a9d1ca555981a1a695e2d7715 + +pkgname = diaspora-postgresql-git + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..5a648a35ad6d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +diaspora/ diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..a452ea486896 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,140 @@ +# Maintainer: Jonne Haß <me@jhass.eu> +pkgname='diaspora-postgresql-git' +pkgver=0.6.0.0.r62.ga53354e +pkgrel=1 +pkgdesc="A distributed privacy aware social network (development head) (PostgreSQL)" +arch=('i686' 'x86_64') +url="https://diasporafoundation.org" +license=('AGPL3') +depends=('ruby' 'ruby-bundler' 'redis' 'imagemagick' 'libxslt' 'net-tools' 'gsfonts' 'postgresql-libs') +optdepends=('postgresql: Database server') +makedepends=('nodejs') +conflicts=('diaspora-mysql' 'diaspora-postgresql' 'diaspora-mysql-git') +options=(!strip) +backup=("etc/webapps/diaspora/diaspora.yml" + "etc/webapps/diaspora/database.yml" + "etc/webapps/diaspora/secret_token.rb") +install="diaspora.install" +source=("git+https://github.com/diaspora/diaspora.git#branch=develop" + "diaspora.install" + "diaspora.service" + "diaspora.tmpfiles.d.conf" + "diaspora.bashrc" + "diaspora.bash_profile") + + +pkgver() { + cd $srcdir/diaspora + git describe --long | sed 's/^v//;s/-/.r/; s/-/./' +} + + +# Get rid of any possible ruby version managers +# From https://github.com/postmodern/chruby +_reset_ruby() { + [[ -z "$RUBY_ROOT" ]] && return + + export PATH=":$PATH:"; export PATH=${PATH//:$RUBY_ROOT\/bin:/:} + + [[ -n "$GEM_HOME" ]] && export PATH=${PATH//:$GEM_HOME\/bin:/:} + [[ -n "$GEM_ROOT" ]] && export PATH=${PATH//:$GEM_ROOT\/bin:/:} + + export GEM_PATH=":$GEM_PATH:" + export GEM_PATH=${GEM_PATH//:$GEM_HOME:/:} + export GEM_PATH=${GEM_PATH//:$GEM_ROOT:/:} + export GEM_PATH=${GEM_PATH#:}; export GEM_PATH=${GEM_PATH%:} + unset GEM_ROOT GEM_HOME + + export PATH=${PATH#:}; export PATH=${PATH%:} + unset RUBY_ROOT RUBY_ENGINE RUBY_VERSION RUBYOPT +} + +build() { + _bundle=bundle + _ruby=ruby + _rake=rake + _builddir=$srcdir/build + + _reset_ruby + + msg "Setup build directory" + rm -rf $_builddir + mkdir -p $_builddir + cp -Rf $srcdir/diaspora/{bin,app,config,db,public,lib,script,vendor,config.ru,Gemfile,Gemfile.lock,Rakefile} $_builddir + + cd $_builddir + + msg "Bundle dependencies" + echo "gem: --no-rdoc --no-ri --no-user-install" > $_builddir/.gemrc + HOME=$_builddir $_bundle config --local build.sigar '--with-cppflags="-fgnu89-inline"' + HOME=$_builddir $_bundle install --without development test --with postgresql --deployment + + msg "Patch configuration examples" + sed -i -e "s|#certificate_authorities: '/etc/ssl/certs/ca-certificates.crt'|certificate_authorities: '/etc/ssl/certs/ca-certificates.crt'|" \ + -e "s|#rails_environment: 'production'|rails_environment: 'production'|" \ + -e "s|#listen: 'unix:tmp/diaspora.sock'|listen: '/run/diaspora/diaspora.sock'|" \ + $_builddir/config/diaspora.yml.example + sed -i -e "s|<<: \*postgresql|<<: *postgresql|" \ + -e "s|#<<: \*mysql||" \ + $_builddir/config/database.yml.example + + cp $_builddir/config/diaspora.yml{.example,} + cp $_builddir/config/database.yml{.example,} + + msg "Create secret token" + HOME=$_builddir RAILS_ENV=production $_bundle exec $_rake generate:secret_token + + msg "Precompile assets" + HOME=$_builddir RAILS_ENV=production $_bundle exec $_rake assets:precompile + + rm $_builddir/config/{diaspora,database}.yml +} + +package() { + _builddir=$srcdir/build + + msg "Copy contents to package directory" + install -dm755 $pkgdir/usr/share/webapps/diaspora + cp -Rf $_builddir/* $pkgdir/usr/share/webapps/diaspora/ + cp -Rf $_builddir/.bundle $pkgdir/usr/share/webapps/diaspora/ + install -Dm644 $_builddir/.gemrc $pkgdir/usr/share/webapps/diaspora/.gemrc + install -Dm640 $_builddir/config/initializers/secret_token.rb $pkgdir/etc/webapps/diaspora/secret_token.rb + install -Dm644 $srcdir/diaspora.service $pkgdir/usr/lib/systemd/system/diaspora.service + install -Dm644 $srcdir/diaspora.tmpfiles.d.conf $pkgdir/usr/lib/tmpfiles.d/diaspora.conf + install -Dm644 $srcdir/diaspora.bashrc $pkgdir/usr/share/webapps/diaspora/.bashrc + install -Dm644 $srcdir/diaspora.bash_profile $pkgdir/usr/share/webapps/diaspora/.bash_profile + + msg "Build source.tar.gz to conform the AGPL" + tar czf $pkgdir/usr/share/webapps/diaspora/public/source.tar.gz \ + $pkgdir/usr/share/webapps/diaspora/{app,db,lib,script,Gemfile,Gemfile.lock,Rakefile,config.ru} + + msg "Symlink ruby and bundle" + install -dm755 $pkgdir/usr/share/webapps/diaspora/bin + ln -sf /usr/bin/$_ruby $pkgdir/usr/share/webapps/diaspora/bin/ruby + ln -sf /usr/bin/$_bundle $pkgdir/usr/share/webapps/diaspora/bin/bundle + + msg "Prepare configuration files" + install -dm750 $pkgdir/etc/webapps/diaspora + install -Dm640 $_builddir/config/diaspora.yml.example $pkgdir/etc/webapps/diaspora/diaspora.yml + install -Dm640 $_builddir/config/database.yml.example $pkgdir/etc/webapps/diaspora/database.yml + + msg "Create symlinks" + install -dm755 $pkgdir/var/log/diaspora + install -dm755 $pkgdir/var/lib/diaspora/uploads + rm -Rf $pkgdir/usr/share/webapps/diaspora/log \ + $pkgdir/usr/share/webapps/diaspora/tmp \ + $pkgdir/usr/share/webapps/diaspora/public/uploads + ln -s /etc/webapps/diaspora/diaspora.yml $pkgdir/usr/share/webapps/diaspora/config/diaspora.yml + ln -s /etc/webapps/diaspora/database.yml $pkgdir/usr/share/webapps/diaspora/config/database.yml + ln -sf /etc/webapps/diaspora/secret_token.rb $pkgdir/usr/share/webapps/diaspora/config/initializers/secret_token.rb + ln -sf /var/lib/diaspora/uploads $pkgdir/usr/share/webapps/diaspora/public/uploads + ln -sf /tmp/diaspora $pkgdir/usr/share/webapps/diaspora/tmp + ln -sf /var/log/diaspora $pkgdir/usr/share/webapps/diaspora/log +} + +sha256sums=('SKIP' + 'aae126c4b1bcba6265d3d925dc3845bb034defa5606385c22dfb053111b57685' + '0d9f3aea98f4d43607eb37cbe030fbee27888f41fb8799308db33991e11d024d' + '7128024976c95d511d8995c472907fe0b8c36fe5b45fef57fc053e3fadcae408' + '77cb2529eacef2d1e77aad5daf21856f67097d6342f230e5dd5057f753932bfa' + '29cfd5116e919d8851ff70b8b82af8d4a6c8243a9d1ca555981a1a695e2d7715') diff --git a/diaspora.bash_profile b/diaspora.bash_profile new file mode 100644 index 000000000000..ab10789d9026 --- /dev/null +++ b/diaspora.bash_profile @@ -0,0 +1 @@ +source .bashrc diff --git a/diaspora.bashrc b/diaspora.bashrc new file mode 100644 index 000000000000..4164fb7ce89b --- /dev/null +++ b/diaspora.bashrc @@ -0,0 +1,3 @@ +export HOME=/usr/share/webapps/diaspora \ + RAILS_ENV=production +export PATH=$HOME/bin:$PATH diff --git a/diaspora.install b/diaspora.install new file mode 100644 index 000000000000..30d4f6167d05 --- /dev/null +++ b/diaspora.install @@ -0,0 +1,30 @@ +dusr=diaspora +dhome=/usr/share/webapps/diaspora +dlog=/var/log/diaspora +detc=/etc/webapps/diaspora +ddata=/var/lib/diaspora + +_chown() { + chown -R $dusr:$dusr $dhome $dlog $detc $ddata + systemd-tmpfiles --create diaspora.conf +} + +## arg 1: the new package version +post_install() { + getent passwd $dusr &> /dev/null || useradd -r -d $dhome -s /bin/bash $dusr + _chown + echo "Read the installation instructions at https://wiki.archlinux.org/index.php/Diaspora" +} + +post_upgrade() { + _chown + echo "Read the upgrade instructions at https://wiki.archlinux.org/index.php/Diaspora" +} + +## arg 1: the old package version +post_remove() { + getent passwd $dusr &>/dev/null && userdel -f $dusr + return 0 +} + +# vim:set ts=2 sw=2 et: diff --git a/diaspora.service b/diaspora.service new file mode 100644 index 000000000000..9fc3e09388d5 --- /dev/null +++ b/diaspora.service @@ -0,0 +1,15 @@ +[Unit] +Wants=redis.service +After=postgresql.service + +[Service] +User=diaspora +WorkingDirectory=/usr/share/webapps/diaspora +Environment=RAILS_ENV=production +ExecStart=/usr/share/webapps/diaspora/script/server +Restart=always +StandardInput=null +KillMode=control-group + +[Install] +WantedBy=multi-user.target diff --git a/diaspora.tmpfiles.d.conf b/diaspora.tmpfiles.d.conf new file mode 100644 index 000000000000..4963b3080298 --- /dev/null +++ b/diaspora.tmpfiles.d.conf @@ -0,0 +1,3 @@ +d /tmp/diaspora 0755 diaspora users - +d /tmp/diaspora/pids 0700 diaspora users - +d /run/diaspora 0755 diaspora users - |