summaryrefslogtreecommitdiff
path: root/social/diaspora-git
diff options
context:
space:
mode:
Diffstat (limited to 'social/diaspora-git')
-rw-r--r--social/diaspora-git/PKGBUILD100
-rw-r--r--social/diaspora-git/diaspora.bin3
-rw-r--r--social/diaspora-git/diaspora.install29
-rw-r--r--social/diaspora-git/diaspora.logrotate5
-rw-r--r--social/diaspora-git/diaspora.pam3
-rw-r--r--social/diaspora-git/diaspora.rc65
6 files changed, 205 insertions, 0 deletions
diff --git a/social/diaspora-git/PKGBUILD b/social/diaspora-git/PKGBUILD
new file mode 100644
index 000000000..52a6b990e
--- /dev/null
+++ b/social/diaspora-git/PKGBUILD
@@ -0,0 +1,100 @@
+# Maintainer: fauno <fauno@kiwwwi.com.ar>
+# Maintainer: Hilton Medeiros <medeiros.hilton at gmail dot com>
+# 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
+
+pkgname=diaspora-git
+pkgver=20110208
+pkgrel=1
+pkgdesc="A privacy aware, personally controlled, do-it-all, open source social network"
+arch=('i686' 'x86_64')
+url="http://www.joindiaspora.com/"
+license=('AGPL3')
+depends=('ruby' 'mysql-ruby' 'redis' 'imagemagick' 'libxslt')
+makedepends=('git' 'ruby-headers')
+install=diaspora.install
+source=('diaspora.bin'
+ 'diaspora.rc'
+ 'diaspora.logrotate'
+ 'diaspora.pam')
+
+_gitroot="http://github.com/diaspora/diaspora.git"
+_gitname="diaspora"
+
+build() {
+ cd "$srcdir"
+
+ msg "Connecting to the Git server..."
+
+ if [[ -d $_gitname ]] ; then
+ pushd $_gitname
+ git pull origin
+ msg "The local files are updated."
+ popd
+ else
+ git clone $_gitroot
+ msg "Git clone done."
+ fi
+
+ msg "Start making..."
+
+ [[ -d $_gitname-build ]] && rm -fr $_gitname-build
+ git clone $_gitname $_gitname-build
+
+ # Recover gems cache
+ rm -fr $_gitname-gems
+ mkdir -p $_gitname-gems
+ [[ -d cache ]] && mv cache $_gitname-gems
+
+# Include all gems
+ export GEM_HOME="$srcdir/$_gitname-gems"
+ export GEM_PATH="$srcdir/$_gitname-gems"
+ export PATH="${PATH}:${GEM_PATH}/bin"
+
+ gem install bundler
+
+ # Patch ruby_core_source to not install the headers in the system
+ # Remove this if you are behind a proxy and install the ruby-headers package instead
+# gem install ruby_core_source
+# sed -i "s@^ dest_dir.*@ dest_dir = \"$srcdir/rubyhdrs/\" + ruby_dir@" \
+# $_gitname-gems/gems/ruby_core_source*/lib/ruby_core_source.rb
+
+ pushd $_gitname-build
+ bundle install --path vendor
+
+ # We make this now because we do not install the git history
+ tar czf public/source.tar.gz `git ls-tree -r master | awk '{print $4}'`
+
+ rm -fr .git
+ popd
+
+ # Keep the gems cache
+ mv $_gitname-gems/cache "$srcdir"
+}
+
+package() {
+ cd "$srcdir"
+
+ usrdir="$pkgdir/usr/share/webapps"
+
+ install -d "$usrdir"
+ cp -r $_gitname-build "$usrdir/$_gitname"
+ #cp -r $_gitname-gems "$usrdir/"
+ find "$usrdir/$_gitname-gems" \
+ -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"
+
+ install -d $pkgdir/usr/share/licenses/$_gitname/
+ install -Dm644 ${srcdir}/$_gitname-build/{AUTHORS,COPYRIGHT,GNU-AGPL-3.0} \
+ $pkgdir/usr/share/licenses/$_gitname/
+}
+md5sums=('7e7402127f9a05bc58aff0adc5057d1c'
+ '7bffaaee41b515247ba19a19c77dc5bf'
+ '60f6b3972c73cbc6b1c9ab87c88fb655'
+ '96f82c38f3f540b53f3e5144900acf17')
diff --git a/social/diaspora-git/diaspora.bin b/social/diaspora-git/diaspora.bin
new file mode 100644
index 000000000..d18a40014
--- /dev/null
+++ b/social/diaspora-git/diaspora.bin
@@ -0,0 +1,3 @@
+cd /usr/share/webapps/diaspora
+export GEM_HOME=/usr/share/webapps/diaspora-gems/
+./script/server &>>/var/log/diaspora.log
diff --git a/social/diaspora-git/diaspora.install b/social/diaspora-git/diaspora.install
new file mode 100644
index 000000000..faf2cb78f
--- /dev/null
+++ b/social/diaspora-git/diaspora.install
@@ -0,0 +1,29 @@
+
+dusr=diaspora
+dhome=/usr/share/webapps/diaspora
+dgems=/usr/share/webapps/diaspora-gems
+dlog=/var/log/diaspora.log
+
+post_install() {
+ getent passwd $dusr &>/dev/null || useradd -r -d $dhome -s /bin/bash $dusr &>/dev/null
+ chown -R $dusr:$dusr $dhome $dgems &>/dev/null
+ [[ -f $dlog ]] && chown $dusr:$dusr $dlog
+}
+
+pre_upgrade(){
+ etc/rc.d/diaspora stop &>/dev/null
+ return 0
+}
+
+post_upgrade(){
+ post_install $1
+}
+
+pre_remove(){
+ pre_upgrade $1
+}
+
+post_remove(){
+ getent passwd $dusr &>/dev/null && userdel -f $dusr
+ return 0
+}
diff --git a/social/diaspora-git/diaspora.logrotate b/social/diaspora-git/diaspora.logrotate
new file mode 100644
index 000000000..bb5564a79
--- /dev/null
+++ b/social/diaspora-git/diaspora.logrotate
@@ -0,0 +1,5 @@
+/var/log/diaspora.log {
+ notifempty
+ copytruncate
+ missingok
+}
diff --git a/social/diaspora-git/diaspora.pam b/social/diaspora-git/diaspora.pam
new file mode 100644
index 000000000..53724d1f8
--- /dev/null
+++ b/social/diaspora-git/diaspora.pam
@@ -0,0 +1,3 @@
+auth required pam_unix.so
+account required pam_unix.so
+session required pam_unix.so
diff --git a/social/diaspora-git/diaspora.rc b/social/diaspora-git/diaspora.rc
new file mode 100644
index 000000000..bd79237ee
--- /dev/null
+++ b/social/diaspora-git/diaspora.rc
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+daemon_name=diaspora
+dusr=diaspora
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+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
+ ck_daemon redis && /etc/rc.d/redis start
+
+ if [ ! -e /var/log/$daemon_name.log ]; then
+ touch /var/log/$daemon_name.log
+ chown $dusr:$dusr /var/log/$daemon_name.log
+ fi
+
+ stat_busy "Starting $daemon_name daemon"
+ [ -z "$PID" ] && /bin/su - $dusr -c "/usr/bin/$daemon_name &"
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ add_daemon $daemon_name
+ stat_done
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping $daemon_name daemon"
+ kill $PID &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ while [ ! -z "$(pgrep -u $daemon_name)" ]; do
+ sleep 1;
+ done
+ rm_daemon $daemon_name
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+
+ status)
+ stat_busy "Checking $daemon_name status"
+ ck_status $daemon_name
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|status}"
+esac
+
+exit 0
+
+# vim: syntax=sh