summaryrefslogtreecommitdiff
path: root/pcr/diaspora-git
diff options
context:
space:
mode:
authorcoadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu>2014-08-27 05:07:26 -0300
committercoadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu>2014-08-27 05:07:26 -0300
commit0ff008e3c9dcc5ef088f481dfff3dcd121575598 (patch)
treed6f6cf5d6939e1f030a48d3711d3606570afd08f /pcr/diaspora-git
parented9d1c12bbfcf9cb8b3d53e886edb679df372640 (diff)
downloadabslibre-0ff008e3c9dcc5ef088f481dfff3dcd121575598.tar.gz
abslibre-0ff008e3c9dcc5ef088f481dfff3dcd121575598.tar.bz2
abslibre-0ff008e3c9dcc5ef088f481dfff3dcd121575598.zip
move some packages from [social] to [pcr] and remove unused [social]
Diffstat (limited to 'pcr/diaspora-git')
-rw-r--r--pcr/diaspora-git/PKGBUILD172
-rw-r--r--pcr/diaspora-git/diaspora.bashrc6
-rw-r--r--pcr/diaspora-git/diaspora.bin9
-rw-r--r--pcr/diaspora-git/diaspora.install28
-rw-r--r--pcr/diaspora-git/diaspora.logrotate5
-rw-r--r--pcr/diaspora-git/diaspora.pam3
-rw-r--r--pcr/diaspora-git/diaspora.rc65
7 files changed, 288 insertions, 0 deletions
diff --git a/pcr/diaspora-git/PKGBUILD b/pcr/diaspora-git/PKGBUILD
new file mode 100644
index 000000000..7d48edcb2
--- /dev/null
+++ b/pcr/diaspora-git/PKGBUILD
@@ -0,0 +1,172 @@
+# Maintainer: fauno <fauno@kiwwwi.com.ar>
+# Maintainer (Arch): Hilton Medeiros <medeiros.hilton at gmail dot com>
+# Contributor (Arch): Jonne Haß <me@mrzyx.de>
+# Contributor (Arch): 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')
+pkgver=20120105
+pkgrel=2
+pkgdesc="A privacy aware, personally controlled, do-it-all, open source social network"
+arch=('i686' 'x86_64' 'mips64el')
+url="https://diasporafoundation.org/"
+license=('AGPL3')
+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'
+ 'diaspora.bashrc')
+md5sums=('547b0015c83da22bd739dc85fd79f9b9'
+ 'b7a893271d9ba778f74569eff4190c06'
+ '60f6b3972c73cbc6b1c9ab87c88fb655'
+ '96f82c38f3f540b53f3e5144900acf17'
+ '53867bfd389dd267eefcefb053fecc5b')
+
+_gitroot="git://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
+ cd ${srcdir}/${_gitname}-build
+
+ # 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
+
+ # 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
+
+ # 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
+_package() {
+ cd "${srcdir}"
+
+ usrdir="${pkgdir}/usr/share/webapps"
+
+ install -d "${usrdir}"
+ cp -a ${_gitname}-build "${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 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"
+
+ 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"
+
+ # 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
+
+ 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)
+ gem install mysql2 -v "0.2.17" -- --with-mysql-config=/usr/bin/mysql_config
+
+ ;;
+ posgres)
+ 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
+
+ gem install bundler
+ 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' 'net-tools' 'mysql' 'libmysqlclient')
+ options=(!strip)
+
+ export DB="mysql"
+ export _db_rc="mysqld"
+
+ _package
+}
+
+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' 'net-tools' 'postgresql')
+ options=(!strip)
+
+ export DB="postgres"
+ export _db_rc="postgresql"
+
+ _package
+}
diff --git a/pcr/diaspora-git/diaspora.bashrc b/pcr/diaspora-git/diaspora.bashrc
new file mode 100644
index 000000000..b694ca0b0
--- /dev/null
+++ b/pcr/diaspora-git/diaspora.bashrc
@@ -0,0 +1,6 @@
+export GEM_HOME="${HOME}/.gems"
+export GEM_PATH="${HOME}/.gems"
+export PATH="${GEM_PATH}/bin:${PATH}"
+export RAILS_ENV="production"
+export DB="-DB-"
+
diff --git a/pcr/diaspora-git/diaspora.bin b/pcr/diaspora-git/diaspora.bin
new file mode 100644
index 000000000..dfd0d026f
--- /dev/null
+++ b/pcr/diaspora-git/diaspora.bin
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+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/pcr/diaspora-git/diaspora.install b/pcr/diaspora-git/diaspora.install
new file mode 100644
index 000000000..7833be058
--- /dev/null
+++ b/pcr/diaspora-git/diaspora.install
@@ -0,0 +1,28 @@
+
+dusr=diaspora
+dhome=/usr/share/webapps/diaspora
+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 &>/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/pcr/diaspora-git/diaspora.logrotate b/pcr/diaspora-git/diaspora.logrotate
new file mode 100644
index 000000000..bb5564a79
--- /dev/null
+++ b/pcr/diaspora-git/diaspora.logrotate
@@ -0,0 +1,5 @@
+/var/log/diaspora.log {
+ notifempty
+ copytruncate
+ missingok
+}
diff --git a/pcr/diaspora-git/diaspora.pam b/pcr/diaspora-git/diaspora.pam
new file mode 100644
index 000000000..53724d1f8
--- /dev/null
+++ b/pcr/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/pcr/diaspora-git/diaspora.rc b/pcr/diaspora-git/diaspora.rc
new file mode 100644
index 000000000..8464f3947
--- /dev/null
+++ b/pcr/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 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
+ 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