1 # Maintainer: fauno <fauno@kiwwwi.com.ar>
2 # Maintainer: Hilton Medeiros <medeiros.hilton at gmail dot com>
3 # Contributor: Jonne Haß <me@mrzyx.de>
4 # Contributor: Splashy <splash at open-web dot fr>
6 # After installing, see the Diaspora wiki page for more information:
7 # https://wiki.archlinux.org/index.php/Diaspora
11 true && pkgname=('diaspora-mysql-git' 'diaspora-postgresql-git')
14 pkgdesc="A privacy aware, personally controlled, do-it-all, open source social network"
15 arch=('i686' 'x86_64')
16 url="https://diasporafoundation.org/"
18 depends=('ruby' 'redis' 'imagemagick' 'libxslt' 'net-tools')
19 makedepends=('git' 'libmysqlclient' 'postgresql-libs')
21 install=diaspora.install
22 source=('diaspora.bin'
27 md5sums=('547b0015c83da22bd739dc85fd79f9b9'
28 'b7a893271d9ba778f74569eff4190c06'
29 '60f6b3972c73cbc6b1c9ab87c88fb655'
30 '96f82c38f3f540b53f3e5144900acf17'
31 '53867bfd389dd267eefcefb053fecc5b')
33 _gitroot="git://github.com/diaspora/diaspora.git"
39 msg "Connecting to the Git server..."
41 if [[ -d $_gitname ]] ; then
44 msg "The local files are updated."
53 [[ -d $_gitname-build ]] && rm -fr $_gitname-build
54 git clone $_gitname $_gitname-build
55 cd ${srcdir}/${_gitname}-build
58 ln -s /etc/webapps/$_gitname/application.yml config/application.yml
59 ln -s /etc/webapps/$_gitname/database.yml config/database.yml
60 ln -s /etc/webapps/$_gitname/script_server.yml config/script_server.yml
61 ln -s /etc/webapps/$_gitname/oauth_keys.yml config/oauth_keys.yml
64 sed "s|git_cmd = \`git log -1 --pretty=\"format:%H %ci\"\`|git_cmd = \"$(git log -1 --pretty="format:%H %ci")\"|" \
65 -i config/initializers/version_header.rb
67 # Preconfigure config/script_server.yml.example
68 sed 's|rails_env: "development"|rails_env: "production"|' \
69 -i config/script_server.yml.example
71 # Preconfigure right ca_file
72 sed "s|ca_file: '/etc/pki/tls/certs/ca-bundle.crt' # CentOS|ca_file: '/etc/ssl/certs/ca-certificates.crt' # Arch|" \
73 -i config/application.yml.example
75 # We make this now because we do not install the git history
77 tar czf public/source.tar.gz `git ls-tree -r master | awk '{print $4}'`
83 mkdir -p ${srcdir}/gem-cache
90 usrdir="${pkgdir}/usr/share/webapps"
92 install -d "${usrdir}"
93 cp -a ${_gitname}-build "${usrdir}/${_gitname}"
95 install -Dm755 $_gitname.bin "$pkgdir/usr/bin/$_gitname"
96 install -Dm755 $_gitname.rc "$pkgdir/etc/rc.d/$_gitname"
97 install -Dm644 $_gitname.logrotate "$pkgdir/etc/logrotate.d/$_gitname"
98 install -Dm644 $_gitname.pam "$pkgdir/etc/pam.d/$_gitname"
99 install -Dm644 $_gitname.bashrc "$usrdir/$_gitname/.bashrc"
101 # Set the DB in the environment
102 sed -i "s/-DB-/$DB/g" "$usrdir/$_gitname/.bashrc"
103 sed -i "s/-DB-/$_db_rc/g" "$pkgdir/etc/rc.d/$_gitname"
105 install -Dm644 $_gitname-build/config/application.yml.example "$pkgdir/etc/webapps/$_gitname/application.yml"
106 install -Dm644 $_gitname-build/config/database.yml.example "$pkgdir/etc/webapps/$_gitname/database.yml"
107 install -Dm644 $_gitname-build/config/script_server.yml.example "$pkgdir/etc/webapps/$_gitname/script_server.yml"
108 install -Dm644 $_gitname-build/config/oauth_keys.yml.example "$pkgdir/etc/webapps/$_gitname/oauth_keys.yml"
111 cd "${usrdir}/${_gitname}"
112 mkdir -p ${usrdir}/${_gitname}/vendor/ruby/1.9.1/
113 ln -s ${srcdir}/gem-cache ${usrdir}/${_gitname}/vendor/cache
114 ln -s ${srcdir}/gem-cache ${usrdir}/${_gitname}/vendor/ruby/1.9.1/cache
116 export GEM_HOME="${PWD}/vendor"
117 export GEM_PATH="${PWD}/vendor"
118 export PATH="${GEM_PATH}/bin:${PATH}"
120 # TODO extract mysql2 version from Gemfile
123 gem install mysql2 -v "0.2.17" -- --with-mysql-config=/usr/bin/mysql_config
127 gem install pg -- --with-pg-config=/usr/bin/pg_config
129 # Preconfigure right subsection in database.yml.example
130 sed -e "s/<<: \*mysql/#<<: \*mysql/" \
131 -e "s/#<<: \*postgres/<<: \*postgres/" \
132 -i $_gitname-build/config/database.yml.example
134 # Preconfigure right db in script_server.yml
135 sed "s/db: \"mysql\"/db: \"postgres\"/" \
136 -i $_gitname-build/config/script_server.yml.example
141 bundle install --path ${GEM_PATH} --without development test heroku
143 install -d $pkgdir/usr/share/licenses/$_gitname/
144 install -Dm644 ${srcdir}/$_gitname-build/{AUTHORS,COPYRIGHT,GNU-AGPL-3.0} \
145 $pkgdir/usr/share/licenses/$_gitname/
147 msg "Removing gem cache"
148 rm -vr ${usrdir}/${_gitname}/vendor/{,ruby/1.9.1/}cache
151 package_diaspora-mysql-git() {
152 pkgdesc="A privacy aware, personally controlled, do-it-all, open source social network (MySQL version)"
153 provides=('diaspora-mysql' 'diaspora')
154 depends=('ruby' 'redis' 'imagemagick' 'libxslt' 'net-tools' 'mysql' 'libmysqlclient')
158 export _db_rc="mysqld"
163 package_diaspora-postgresql-git() {
164 pkgdesc="A privacy aware, personally controlled, do-it-all, open source social network (PostgreSQL version)"
165 provides=('diaspora-postgresql' 'diaspora')
166 depends=('ruby' 'redis' 'imagemagick' 'libxslt' 'net-tools' 'postgresql')
170 export _db_rc="postgresql"
174 pkgdesc="A privacy aware, personally controlled, do-it-all, open source social network"