summaryrefslogtreecommitdiff
path: root/social/diaspora-git
diff options
context:
space:
mode:
authorNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-01-10 17:52:36 -0300
committerNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-01-10 17:52:36 -0300
commit273e5fe4a3cee61d72576d6111965bd8453274b7 (patch)
tree7c2058cae7606ec12d77895d82c40283b527d657 /social/diaspora-git
parentb7e168f500798ce86b6803d4efad59ade66e7305 (diff)
social/diaspora-postgresql-git-20120105-1
Diffstat (limited to 'social/diaspora-git')
-rw-r--r--social/diaspora-git/PKGBUILD146
-rw-r--r--social/diaspora-git/diaspora.bin13
-rw-r--r--social/diaspora-git/diaspora.rc4
3 files changed, 106 insertions, 57 deletions
diff --git a/social/diaspora-git/PKGBUILD b/social/diaspora-git/PKGBUILD
index 57459173d..4688d8abf 100644
--- a/social/diaspora-git/PKGBUILD
+++ b/social/diaspora-git/PKGBUILD
@@ -1,37 +1,37 @@
# Maintainer: fauno <fauno@kiwwwi.com.ar>
# Maintainer: Hilton Medeiros <medeiros.hilton at gmail dot com>
+# Contributor: Jonne Haß <me@mrzyx.de>
# Contributor: Splashy <splash at open-web dot fr>
# After installing, see the Diaspora wiki page for more information:
# https://wiki.archlinux.org/index.php/Diaspora
pkgbase=diaspora-git
-pkgname=('diaspora-mysql-git' 'diaspora-postgresql-git' 'diaspora-sqlite-git')
-pkgver=20111229
+pkgname=('diaspora-mysql-git' 'diaspora-postgresql-git')
+pkgver=20120105
pkgrel=1
pkgdesc="A privacy aware, personally controlled, do-it-all, open source social network"
arch=('i686' 'x86_64')
url="https://diasporafoundation.org/"
license=('AGPL3')
-depends=('ruby' 'redis' 'imagemagick' 'libxslt')
-makedepends=('git' 'ruby-headers')
+depends=('ruby' 'redis' 'imagemagick' 'libxslt' 'net-tools')
+makedepends=('git' 'libmysqlclient' 'postgresql-libs')
provides=('diaspora')
install=diaspora.install
source=('diaspora.bin'
'diaspora.rc'
'diaspora.logrotate'
- 'diaspora.pam')
-md5sums=('440ce2511485855030e74e28843a037d'
- '7bffaaee41b515247ba19a19c77dc5bf'
+ 'diaspora.pam'
+ 'diaspora.bashrc')
+md5sums=('547b0015c83da22bd739dc85fd79f9b9'
+ 'b7a893271d9ba778f74569eff4190c06'
'60f6b3972c73cbc6b1c9ab87c88fb655'
- '96f82c38f3f540b53f3e5144900acf17')
+ '96f82c38f3f540b53f3e5144900acf17'
+ '53867bfd389dd267eefcefb053fecc5b')
-_gitroot="https://github.com/diaspora/diaspora.git"
+_gitroot="git://github.com/diaspora/diaspora.git"
_gitname="diaspora"
-# I use this because I'm behind an asshole proxy
-tsocks=tsocks
-
build() {
cd "$srcdir"
@@ -39,27 +39,47 @@ build() {
if [[ -d $_gitname ]] ; then
pushd $_gitname
- $tsocks git pull origin
+ tsocks git pull origin
msg "The local files are updated."
popd
else
- $tsocks git clone $_gitroot
+ tsocks git clone $_gitroot
msg "Git clone done."
fi
msg "Start making..."
[[ -d $_gitname-build ]] && rm -fr $_gitname-build
- $tsocks git clone $_gitname $_gitname-build
+ git clone $_gitname $_gitname-build
+ cd ${srcdir}/${_gitname}-build
-# Include all gems
- export GEM_HOME="${PWD}/vendor"
- export GEM_PATH="${PWD}/vendor"
- export PATH="${PATH}:${GEM_PATH}/bin"
+ # Symlink configs
+ ln -s /etc/webapps/$_gitname/application.yml config/application.yml
+ ln -s /etc/webapps/$_gitname/database.yml config/database.yml
+ ln -s /etc/webapps/$_gitname/script_server.yml config/script_server.yml
+ ln -s /etc/webapps/$_gitname/oauth_keys.yml config/oauth_keys.yml
- cd ${srcdir}/${_gitname}-build
+ # Set version header
+ sed "s|git_cmd = \`git log -1 --pretty=\"format:%H %ci\"\`|git_cmd = \"$(git log -1 --pretty="format:%H %ci")\"|" \
+ -i config/initializers/version_header.rb
- $tsocks gem install bundler
+ # Preconfigure config/script_server.yml.example
+ sed 's|rails_env: "development"|rails_env: "production"|' \
+ -i config/script_server.yml.example
+
+ # Preconfigure right ca_file
+ sed "s|ca_file: '/etc/pki/tls/certs/ca-bundle.crt' # CentOS|ca_file: '/etc/ssl/certs/ca-certificates.crt' # Arch|" \
+ -i config/application.yml.example
+
+ # We make this now because we do not install the git history
+ # Comply with AGPLv3
+ tar czf public/source.tar.gz `git ls-tree -r master | awk '{print $4}'`
+
+ # Remove git repo
+ rm -fr .git
+
+ # Create gem cache
+ mkdir -p ${srcdir}/gem-cache
}
# Helper
@@ -71,34 +91,70 @@ _package() {
install -d "${usrdir}"
cp -a ${_gitname}-build "${usrdir}/${_gitname}"
- cd "${usrdir}/${_gitname}"
+ install -Dm755 $_gitname.bin "$pkgdir/usr/bin/$_gitname"
+ install -Dm755 $_gitname.rc "$pkgdir/etc/rc.d/$_gitname"
+ install -Dm644 $_gitname.logrotate "$pkgdir/etc/logrotate.d/$_gitname"
+ install -Dm644 $_gitname.pam "$pkgdir/etc/pam.d/$_gitname"
+ install -Dm644 $_gitname.bashrc "$usrdir/$_gitname/.bashrc"
-# Set the example config
- sed -e 's/rails_env:.*/rails_env: "production"/' \
- -e "s/db:.*/db: \"${DB}\"/" \
- -i config/script_server.yml.example
+# Set the DB in the environment
+ sed -i "s/-DB-/$DB/g" "$usrdir/$_gitname/.bashrc"
+ sed -i "s/-DB-/$_db_rc/g" "$pkgdir/etc/rc.d/$_gitname"
- ${tsocks} bundle install --local --path vendor --without development test
+ install -Dm644 $_gitname-build/config/application.yml.example "$pkgdir/etc/webapps/$_gitname/application.yml"
+ install -Dm644 $_gitname-build/config/database.yml.example "$pkgdir/etc/webapps/$_gitname/database.yml"
+ install -Dm644 $_gitname-build/config/script_server.yml.example "$pkgdir/etc/webapps/$_gitname/script_server.yml"
+ install -Dm644 $_gitname-build/config/oauth_keys.yml.example "$pkgdir/etc/webapps/$_gitname/oauth_keys.yml"
- find -type d -name ".git" -exec rm -fr '{}' \; &>/dev/null || true
-
- install -Dm755 ${_gitname}.bin "${pkgdir}/usr/bin/${_gitname}"
- install -Dm755 ${_gitname}.rc "${pkgdir}/etc/rc.d/${_gitname}"
- install -Dm644 ${_gitname}.logrotate "${pkgdir}/etc/logrotate.d/${_gitname}"
- install -Dm644 ${_gitname}.pam "${pkgdir}/etc/pam.d/${_gitname}"
+ # Include all gems
+ cd "${usrdir}/${_gitname}"
+ mkdir -p ${usrdir}/${_gitname}/vendor/ruby/1.9.1/
+ ln -s ${srcdir}/gem-cache ${usrdir}/${_gitname}/vendor/cache
+ ln -s ${srcdir}/gem-cache ${usrdir}/${_gitname}/vendor/ruby/1.9.1/cache
- install -d ${pkgdir}/usr/share/licenses/${_gitname}/
- install -Dm644 ${srcdir}/${_gitname}-build/{AUTHORS,COPYRIGHT,GNU-AGPL-3.0} \
- ${pkgdir}/usr/share/licenses/${_gitname}/
+ export GEM_HOME="${PWD}/vendor"
+ export GEM_PATH="${PWD}/vendor"
+ export PATH="${GEM_PATH}/bin:${PATH}"
+
+# TODO extract mysql2 version from Gemfile
+ case $DB in
+ mysql)
+ tsocks gem install mysql2 -v "0.2.17" -- --with-mysql-config=/usr/bin/mysql_config
+
+ ;;
+ posgres)
+ tsocks gem install pg -- --with-pg-config=/usr/bin/pg_config
+
+ # Preconfigure right subsection in database.yml.example
+ sed -e "s/<<: \*mysql/#<<: \*mysql/" \
+ -e "s/#<<: \*postgres/<<: \*postgres/" \
+ -i $_gitname-build/config/database.yml.example
+
+ # Preconfigure right db in script_server.yml
+ sed "s/db: \"mysql\"/db: \"postgres\"/" \
+ -i $_gitname-build/config/script_server.yml.example
+
+ esac
+
+ tsocks gem install bundler
+ tsocks bundle install --path ${GEM_PATH} --without development test heroku
+
+ install -d $pkgdir/usr/share/licenses/$_gitname/
+ install -Dm644 ${srcdir}/$_gitname-build/{AUTHORS,COPYRIGHT,GNU-AGPL-3.0} \
+ $pkgdir/usr/share/licenses/$_gitname/
+
+ msg "Removing gem cache"
+ rm -vr ${usrdir}/${_gitname}/vendor/{,ruby/1.9.1/}cache
}
package_diaspora-mysql-git() {
pkgdesc="A privacy aware, personally controlled, do-it-all, open source social network (MySQL version)"
provides=('diaspora-mysql' 'diaspora')
- depends=('ruby' 'redis' 'imagemagick' 'libxslt' 'mysql')
+ depends=('ruby' 'redis' 'imagemagick' 'libxslt' 'net-tools' 'mysql' 'libmysqlclient')
options=(!strip)
export DB="mysql"
+ export _db_rc="mysqld"
_package
}
@@ -106,21 +162,11 @@ package_diaspora-mysql-git() {
package_diaspora-postgresql-git() {
pkgdesc="A privacy aware, personally controlled, do-it-all, open source social network (PostgreSQL version)"
provides=('diaspora-postgresql' 'diaspora')
- depends=('ruby' 'redis' 'imagemagick' 'libxslt' 'postgresql')
- options=(!strip)
-
- export DB="postgresql"
-
- _package
-}
-
-package_diaspora-sqlite-git() {
- pkgdesc="A privacy aware, personally controlled, do-it-all, open source social network (SQLite3 version)"
- provides=('diaspora-sqlite' 'diaspora')
- depends=('ruby' 'redis' 'imagemagick' 'libxslt' 'sqlite3')
+ depends=('ruby' 'redis' 'imagemagick' 'libxslt' 'net-tools' 'postgresql')
options=(!strip)
- export DB="sqlite"
+ export DB="postgres"
+ export _db_rc="postgresql"
_package
}
diff --git a/social/diaspora-git/diaspora.bin b/social/diaspora-git/diaspora.bin
index 2168c7e7c..dfd0d026f 100644
--- a/social/diaspora-git/diaspora.bin
+++ b/social/diaspora-git/diaspora.bin
@@ -1,6 +1,9 @@
-#!/bin/bash
+#!/bin/sh
-cd /usr/share/webapps/diaspora
-export GEM_HOME=${PWD}/vendor
-
-./script/server &>>/var/log/diaspora.log
+if [ "$(whoami)" == "diaspora" ]; then
+ cd /usr/share/webapps/diaspora
+ source ./.bashrc
+ ./script/server &>>/var/log/diaspora.log
+else
+ echo 'Please run this as the "diaspora" user!'
+fi
diff --git a/social/diaspora-git/diaspora.rc b/social/diaspora-git/diaspora.rc
index bd79237ee..8464f3947 100644
--- a/social/diaspora-git/diaspora.rc
+++ b/social/diaspora-git/diaspora.rc
@@ -10,8 +10,8 @@ PID=`pgrep -u $daemon_name`
case "$1" in
start)
- #Check if mysqld and redis are running, start them if not
- ck_daemon mysqld && /etc/rc.d/mysqld start
+ #Check if db and redis are running, start them if not
+ ck_daemon -DB- && /etc/rc.d/-DB- start
ck_daemon redis && /etc/rc.d/redis start
if [ ! -e /var/log/$daemon_name.log ]; then