Too many things in diaspora repo! Moving pkg/ out to a seperate

diaspora-packages repo.  We should have a bash (curl (script_url))
install like rvm does.  I think the ubuntu install script needs to have
'clone' added to the line which is supposed to clone.
This commit is contained in:
Raphael 2010-11-03 10:23:45 -07:00
parent c8a8849518
commit 5c6c43ca4e
33 changed files with 0 additions and 2265 deletions

2
pkg/.gitignore vendored
View file

@ -1,2 +0,0 @@
dist
*.log

View file

@ -1,99 +0,0 @@
abstract: Ruby
actionmailer: MIT
actionpack: MIT
activemodel: MIT
activerecord: MIT
activeresource: ? (Other distros uses MIT, "Ruby-alike", no pointers)
activesupport: MIT
addressable: MIT
arel: MIT
aws MIT
bcrypt-ruby: MIT
builder: MIT
bunny: MIT
capistrano: MIT
capybara: MIT
chef: ASL 2.0
childprocess: MIT
columnize: GPLv2
crack: MIT
cucumber: MIT
cucumber-rails: MIT
culerity: MIT
daemons: Ruby+MIT
database_cleaner: MIT
devise: MIT
devise_invitable MIT
diff Ruby+GPLv2+ Artistic 2.0
em-websocket: MIT
eribus: MIT
event-machine: Ruby+GPLv2
extlib: MIT
factory_girls MIT
factory_girls_rails: MIT
ffi MIT
haml MIT
http_connection: MIT
gherkin: MIT
hashie: MIT
highline GPLv2+Ruby
json: Ruby
json-pure: Ruby
launchy: MIT
linecache: GPLv2
mail: MIT
mime-types: GPLv2+Ruby+Artistic 2.0
mini_magick: MIT
mini_fb: ?
mixlib-authentication: ASL 2.0
mixlib-cli ASL 2.0
mixlib-config ASL 2.0
mixlib-log ASL 2.0
mocha Ruby+MIT
moneta: MIT
mongo: ASL 2.0
net-scp: MIT
net-sftp: MIT
net-ssh: MIT
net-ssh-gatawey: MIT
ohai: ASL 2.0
plucky: MIT
polyglot. MIT
pubsubhubbub: ASL 2.0 http://code.google.com/p/pubsubhubbub/
rake: MIT
rack-mount: MIT
rack-test: MIT
railties: MIT
rest-client: MIT
rspec-core: MIT
rspec-expectations: MIT
rspec-mocks: MIT
rspec-rails: MIT
rack: MIT
rack-mount: MIT
ruby-debug: MIT
ruby-debug-base: MIT
rubyzip: Ruby
selenium-webdriver: ASL 2.0
subexec: MIT
term-ansicolor: GPLv2
textile. MIT
textile-warden: MIT
thin: MIT
thor: MIT
treetop: MIT
tx-info: MIT
uutdtools: MIT
iwarden: MIT
webmock: MIT
will-paginate MIT

View file

@ -1,15 +0,0 @@
## Diaspora install and packaging tools
This directory contains stuff to install and run diaspora.
- ubuntu-setup.bash: script which installs all of Diasporas
dependencies and starts the server.
- bootstrap-fedora-diaspora.sh. does the same for Fedora.
- source: stuff to package Diaspora into traditional tarballs
which can be installed.
- ubuntu: Scripts and tools to install generic tarballs on Ubuntu
- fedora: Scripts and tools to create fedora RPMS:s from tarballs

View file

@ -1,129 +0,0 @@
#!/bin/bash
#
# Install diaspora, its dependencies and start.
#
# Usage: pkg/bootstrap-fedora-diaspora.sh [external hostname]
#
# Synopsis, install:
# $ git clone 'http://github.com/diaspora/diaspora.git'
# $ cd diaspora
# $ sudo pkg/bootstrap-fedora-diaspora.sh
#
# New start:
# $ sudo su - diaspora
# $ cd diaspora
# $ script/server
#
# Unless already existing, the diaspora user is created.
# The directory the scripts is invoked from is copied to
# diasporas's home dir, populated and configured and finally
# acts as a base for running diaspora servers.
#
# Script is designed not to make any changes in invoking
# caller's environment.
#
# Must run as root
GIT_REPO=${GIT_REPO:-'http://github.com/diaspora/diaspora.git'}
DIASPORA_HOSTNAME=${1:-'mumin.dnsalias.net'}
test $UID = "0" || {
echo "You need to be root to do this, giving up"
exit 2
}
[[ -d config && -d script ]] || {
echo Error: "this is not a diaspora base directory"
exit 3
}
yum install -y git bison sqlite-devel gcc-c++ patch \
readline-devel zlib-devel libyaml-devel libffi-devel \
ImageMagick libxslt-devel libxml2-devel \
openssl-devel mongodb-server wget \
make autoconf automake
getent group diaspora >/dev/null || groupadd diaspora
getent passwd diaspora >/dev/null || {
useradd -g diaspora -s /bin/bash -m diaspora
echo "Created user diaspora"
}
service mongod start
su - diaspora << EOF
#set -x
[ -e diaspora ] && {
echo "Moving existing diaspora out of the way"
mv diaspora diaspora.$$
}
git clone $GIT_REPO
cd diaspora
[ -e "\$HOME/.rvm/scripts/rvm" ] || {
echo '#### Installing rvm ####'
wget http://rvm.beginrescueend.com/releases/rvm-install-head
bash < rvm-install-head && rm rvm-install-head
if [[ -s "\$HOME/.rvm/scripts/rvm" ]]; then
. "\$HOME/.rvm/scripts/rvm"
else
echo "Error: rvm installation failed";
exit 1;
fi
touch \$HOME/.bashrc
grep -q "rvm/scripts/rvm" \$HOME/.bashrc || {
echo '[[ -s "\$HOME/.rvm/scripts/rvm" ]] && \
source "\$HOME/.rvm/scripts/rvm"' \
>> \$HOME/.bashrc
}
}
source \$HOME/.bashrc
ruby=\$(which ruby) || ruby=""
if [[ -z "\$ruby" || ("\${ruby:0:4}" == "/usr") ]]; then
echo '#### Installing ruby (will take forever) ... ####'
rvm install ruby-1.8.7-p302
rvm --default ruby-1.8.7
echo "#### Installing bundler ... ####"
gem install bundler
fi
bundle install
#bundle exec jasmine init
#Configure diaspora
cp config/app_config.yml.example config/app_config.yml
source pkg/source/funcs.sh
init_appconfig config/app_config.yml "$DIASPORA_HOSTNAME"
echo "Setting up DB..."
if bundle exec rake db:seed:dev ; then
cat <<- EOM
DB ready. Logins -> tom and korth, password -> evankorth.
More details ./diaspora/db/seeds/tom.rb. and ./diaspora/db/seeds/dev.rb.
EOM
else
cat <<- EOM
Database config failed. You might want to remove all db files with
'rm -rf /var/lib/mongodb/*' and/or reset the config file by
'cp config/app_config.yml.example config/app_config.yml' before
making a new try. Also, make sure the mongodb server is running
e. g., by running 'service mongodb status'.
EOM
fi
echo "Starting server"
script/server -d
pidfile="~diaspora/diaspora/log/diaspora-wsd.pid"
echo " To stop server: pkill thin; kill $(cat $pidfile)"
echo 'To restart server: sudo su - diaspora -c "diaspora/script/server -d"'
EOF

View file

@ -1,4 +0,0 @@
TODO
dist
.stgit*
vendor

View file

@ -1,118 +0,0 @@
## Diaspora RPM tools
Create RPM packages
An alternative to the capistrano system, providing classic, binary RPM
packages for deployment on Fedora.
#### Synopsis
Prerequisites:
- ruby-1.8, rubygem, git and rake as described in
[RPM installation Fedora](http://github.com/diaspora/diaspora/wiki/Rpm-installation-on-fedora)
or [Installing-on-CentOS-Fedora](http://github.com/diaspora/diaspora/wiki/Installing-on-CentOS-Fedora)
- A personal environment to build RPM:s, also described in
[RPM installation Fedora](http://github.com/diaspora/diaspora/wiki/Rpm-installation-on-fedora)
Install g++ and gcc:
% yum install gcc-c++
Bootstrap the distribution from git:
% sudo apt-get install git-core
% git clone git://github.com/diaspora/diaspora.git
% cd diaspora/pkg/ubuntu
Create and install the diaspora bundle and application in
diaspora/pkg/source according to
[source README](http://github.com/diaspora/diaspora/tree/master/pkg/source/)
Setup links from tarballs to RPM source directory and create spec files:
% ./prepare-rpm.sh
Build rpms:
rpmbuild -ba dist/diaspora.spec
rpmbuild -ba dist/diaspora-bundle.spec
Install (as root):
rpm -U ~/rmpbuild/rpms/i686/diaspora-bundle-0.0-1.1010042345_4343fade43.fc13.i686
rpm -U ~/rmpbuild/rpms/noarch/diaspora-0.0-1.1010042345_4343fade43.fc13.noarch
Initiate (as root).
/usr/share/diaspora/diaspora-setup
Start development server:
sudo
su - diaspora
cd /usr/share/diaspora/master
./script/server
See [Using Apache](http://github.com/diaspora/diaspora/wiki/Using-apache) for
apache/passenger setup. After configuration, start with:
/sbin/service diaspora-wsd start
/sbin/service httpd restart
prepare-rpm.sh prepare creates links also for all files listed in SOURCES.
Typically, this is secondary sources. *make-dist.sh source*
#### Notes
prepare-rpm.sh prepare creates links also for all files listed in SOURCES.
Typically, this is secondary sources.
The spec-files in dist/ are patched by *./prepare-rpm.sh to reference
correct versions of diaspora and diaspora-bundle. Editing spec files should be
done in this directory, changes in dist/ are lost when doing *./prepare-rpm.sh *.
The topmost comment's version is patched to reflect the complete version
of current specfile . Write the comment in this directory, copy-paste
previous version nr. It will be updated.
This has been confirmed to start up and provide basic functionality both using
the thin webserver and apache passenger, on 32/64 bit systems and in the
mock build environment. Irregular nightly builds are available form time to time
at [ftp://mumin.dnsalias.net/pub/leamas/diaspora/builds](ftp://mumin.dnsalias.net/pub/leamas/diaspora/builds)
#### Implementation
Diaspora files are stored in /usr/share/diaspora, and owned by root. The
bundle, containing some C extensions, is architecture-dependent and lives
in /usr/lib[64]/diaspora. Log files are in /var/log/diaspora. Symlinks in
/usr/share diaspora makes log, bundle and tmp dir available as expected by
diaspora app. This is more or less as mandated by LSB and Fedora packaging rules.
find . -type l -exec ls -l {} \; | awk '{print $9, $10, $11}'
./public/uploads -> /var/lib/diaspora/uploads
./log -> /var/log/diaspora
./tmp -> /var/lib/diaspora/tmp
./vendor/bundle -> /usr/lib/diaspora-bundle/master/vendor/bundle
#### Discussion
The 1.8.7 rebuild is a pain. However, in Fedora 14 1.8.7 is the default
ruby version.
For better or worse, this installation differs from the procedure outlined
in the original README.md:
- All configuration is done in /usr/share/diaspore. No global or user
installed bundles are involved. Easier to maintain, but a mess if there
should be parallel installations.
- Service is run under it's own uid, not root or an ordinary user account.
- Using the pre-packaged mongod server means that the DB has reasonable
permissions, not 777.
- Splitting in two packages makes sense IMHO. The bundle is not changed
that often, but is quite big: ~35M without test packages (the default) or
~55M with test packages. The application is just ~3M, and is fast to
deploy even with these tools (yes, I know, capistrano is much faster...)
- Many, roughly 50% of the packages in the bundle are already packaged
for Fedora i. e., they could be removed from the bundle and added as
dependencies instead. This is likely to make things more stable in the
long run. diaspora.spec has a list.

View file

@ -1,5 +0,0 @@
# These files will be linked to %_sourcedir by 'make-dist links'
diaspora-setup
diaspora-wsd
diaspora.logconf
make_rel_symlink.py

View file

@ -1,228 +0,0 @@
%define git_release HEAD
# Turn off java repack, this is in /usr/lib[64] anyway
%define __jar_repack %{nil}
# Turn off the brp-python-bytecompile script, *pyc/pyo causes problems
%global __os_install_post %(echo '%{__os_install_post}' |
sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
Summary: Rubygem bundle for diaspora
Name: diaspora-bundle
Version: 0.0
Release: 1.%{git_release}%{?dist}
License: Ruby
Group: Applications/Communications
URL: http://www.joindiaspora.com/
Vendor: joindiaspora.com
Source: %{name}-%{version}-%{git_release}.tar.gz
Prefix: %{_prefix}
BuildRoot: %{_tmpdir}/not-used-since-F13/
Requires(pre): shadow-utils
Requires: ruby(abi) = 1.8
%description
The ruby apps bundled with diaspora, as provided by
bundle install --package and patched for Fedora use.
%package devel
Summary: Development files (i. e., sources) for diaspora-bundle
Group: Development/Libraries
Requires: %{name} = %{version}
%description devel
Source file usede to compile native libraries in diaspora-bundle.
%prep
%setup -q -n %{name}-%{version}-%{git_release}
%build
bundle install --local --deployment --without ri rdoc
pushd vendor/bundle/ruby/1.8/gems
# In repo (2.2.4)
test -d gherkin-*/ext && {
pushd gherkin-*/ext
# Recompile all shared libraries using -O2 flag
for lexer_dir in */ ; do
pushd $lexer_dir
sed -i 's/ -O0 / -O2 /' extconf.rb
# Remove #line lines from C sources
sed -i '/^#line/d' *.c
CONFIGURE_ARGS="--with-cflags='%{optflags}'" ruby extconf.rb
make clean && make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
make install RUBYARCHDIR="../../lib"
mv ../../lib/${lexer_dir%/}.so .
pushd ../../lib
ln -sf ../ext/${lexer_dir%/}/${lexer_dir%/}.so .
popd
popd
done
popd
}
test -d ffi-0.6.3/lib && {
pushd ffi-0.6.3/lib
rm ffi_c.so
ln -s ../ext/ffi_c/ffi_c.so .
popd
}
# In repo as 1.2.5, rawhide 1.2.7
pushd thin-1.2.7/lib
rm thin_parser.so
ln -s ../ext/thin_parser/thin_parser.so .
popd
pushd bson_ext-1.1/ext/bson_ext
rm cbson.so
ln -s ../cbson/cbson.so .
popd
# In repo (0.10.4)
pushd ruby-debug-base-0.10.3/lib
rm ruby_debug.so
ln -s ../ext/ruby_debug.so .
popd
#in repo
pushd eventmachine-0.12.10/lib
rm rubyeventmachine.so
rm fastfilereaderext.so
ln -s ../ext/rubyeventmachine.so .
ln -s ../ext/fastfilereader/fastfilereaderext.so .
popd
# In repo
pushd bcrypt-ruby-2.1.2/lib
rm bcrypt_ext.so
ln -s ../ext/mri/bcrypt_ext.so .
popd
# in repo
pushd nokogiri-1.4.3.1/lib/nokogiri
rm nokogiri.so
ln -sf ../../ext/nokogiri/nokogiri.so .
popd
# in repo (rawhide)
pushd json-1.4.6/ext/json/ext/json/ext
rm generator.so
ln -s ../../generator/generator.so
rm parser.so
ln -s ../../parser/parser.so .
popd
#in repo
pushd linecache-0.43/lib/
rm trace_nums.so
ln -s ../ext/trace_nums.so .
popd
pushd ../bundler/gems/em-http-request*/lib
rm em_buffer.so
ln -s ../ext/buffer/em_buffer.so .
rm http11_client.so
ln -s ../ext/http11_client/http11_client.so .
popd
find . -name \*.css -print | xargs chmod 644
find . -name \*.js -print | xargs chmod 644
find . -name \*.treetop -print | xargs chmod 644
find . -name \*.rdoc -print | xargs chmod 644
for f in $(find . -name \*.rb); do
sed -i -e '/^#!/d' $f
chmod 0644 $f
done &> /dev/null
find . -perm /u+x -type f -print0 |
xargs --null sed -i 's|^#!/usr/local/bin/ruby|#!/usr/bin/ruby|'
chmod 755 abstract-1.0.0/abstract.gemspec || :
chmod 755 cucumber-rails-0.3.2/templates/install/script/cucumber || :
chmod 644 cucumber-rails-0.3.2/History.txt || :
chmod 644 cucumber-rails-0.3.2/templates/install/step_definitions/capybara_steps.rb.erb || :
chmod 644 ffi-0.6.3/ext/ffi_c/libffi/ltmain.sh || :
chmod 644 gherkin-2.2.4/tasks/compile.rake || :
chmod 644 i18n-0.4.1/MIT-LICENSE || :
chmod 755 linecache-0.43/Rakefile || :
chmod 755 mime-types-1.16/Rakefile || :
chmod 755 mini_magick-2.1/test/not_an_image.php || :
chmod 644 mini_magick-2.1/Rakefile || :
chmod 644 mini_magick-2.1/MIT-LICENSE || :
chmod 644 rack-1.2.1/test/cgi/lighttpd.conf || :
chmod 755 rake-0.8.7/test/data/file_creation_task/Rakefile || :
chmod 755 rake-0.8.7/test/data/statusreturn/Rakefile || :
chmod 755 ruby-debug-0.10.3/Rakefile || :
chmod 755 ruby-debug-base-0.10.3/Rakefile || :
for file in CHANGES VERSION README Rakefile; do
chmod 644 term-ansicolor-1.0.5/$file || :
done
chmod 755 thin-1.2.7/lib/thin/controllers/service.sh.erb ||:
chmod 755 thin-1.2.7/example/async_chat.ru || :
chmod 755 thin-1.2.7/example/async_tailer.ru || :
chmod 644 treetop-1.4.8/spec/compiler/test_grammar.tt || :
popd
%pre
getent group diaspora >/dev/null || groupadd -r diaspora
getent passwd diaspora >/dev/null || \
useradd -r -g diaspora \
-md /var/lib/diaspora -s /bin/bash \
-c "Diaspora daemon" diaspora
exit 0
%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -fr $RPM_BUILD_ROOT
find . -name .git | xargs rm -rf
find . -name .gitignore -delete
find . -name \*.o -delete || :
test -d vendor/bundle/ruby/1.8//gems/selenium-webdriver-0.0.* && {
pushd vendor/bundle//ruby/1.8/gems/selenium-webdriver-0.0.*/lib/selenium/webdriver/
%ifarch %ix86 x86_64
%ifarch %ix86
rm -rf firefox/native/linux/amd64
%else
rm -rf firefox/native/linux/i386
%endif
%else
rm -rf firefox/native/linux/i386
rm -rf firefox/native/linux/amd64
%endif
popd
}
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/diaspora-bundle
cp -ar vendor $RPM_BUILD_ROOT/%{_libdir}/diaspora-bundle
cp -a Gemfile Gemfile.lock $RPM_BUILD_ROOT/%{_libdir}/diaspora-bundle
find %{buildroot}/%{_libdir}/diaspora-bundle \
-type d -fprintf dirs '%%%dir "%%p"\n'
find -L %{buildroot}/%{_libdir}/diaspora-bundle -regextype posix-awk \
-type f -not -regex '.*[.]c$|.*[.]h$|.*[.]cpp$|.*Makefile$' \
-fprintf files '"%%p"\n'
find -L %{buildroot}/%{_libdir}/diaspora-bundle -regextype posix-awk \
-type f -regex '.*[.]c$|.*[.]h$|.*[.]cpp$|.*Makefile$' \
-fprintf dev-files '"%%p"\n'
sed -i -e 's|%{buildroot}||' -e 's|//|/|' files dev-files dirs
cat files >> dirs && cp dirs files
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -fr $RPM_BUILD_ROOT
%files -f files
%defattr(-, diaspora, diaspora, 0755)
%doc COPYRIGHT AUTHORS GNU-AGPL-3.0 docs
%files -f dev-files devel
%defattr(-, root, root, 0644)
%doc COPYRIGHT AUTHORS GNU-AGPL-3.0
%changelog
* Sat Oct 02 2010 Alec Leamas <leamas.alec@gmail.com> 0.0-1.1009271539_08b9aa8
- Initial attempt to create a spec file

View file

@ -1,13 +0,0 @@
#!/bin/sh
#
# Try to revert to pristine state, deleting all users and
# configuration
#
set -x
service mongod stop
service diaspora-wsd stop
rm -rf /var/lib/mongodb/*
cp /usr/share/diaspora/master/config/app_config.yml.example \
/usr/share/diaspora/master/config/app_config.yml
service mongod start

View file

@ -1,75 +0,0 @@
#!/bin/bash
#
# Do what's needed to initiate diaspora.
#
# Usage: # ./diaspora-setup [external hostname]
#
export PATH=$PATH:/usr/local/bin
arg_hostname="$1"
test $UID = "0" || {
echo "You need to be root to do this, giving up"
exit 2
}
services=$( netstat -nl | grep '[^:]:3000[ \t]')
test -n "$services" && {
echo "Warning: something is already using port 3000"
echo " $services"
}
/sbin/service mongod start || :
cd /usr/share/diaspora/master
libdir=$(rpm --eval %_libdir)
rm -rf vendor
ln -s $libdir/diaspora-bundle/vendor .
ln -sf $libdir/diaspora-bundle/Gemfile .
ln -sf $libdir/diaspora-bundle/Gemfile.lock .
test -e config/app_config.yml ||
cp config/app_config.yml.example config/app_config.yml
mv lib/tasks/jasmine.rake lib/tasks/jasmine.no-rake
if bundle exec rake db:seed:dev; then
echo "Database config OK, users tom/evankorth, korth/evankorth in place"
else
cat <<- EOF
Database config failed. You might want to remove all db files with
'rm -rf /var/lib/mongodb/*' and/or reset the config file by
'cp config/app_config.yml.example config/app_config.yml' before
making a new try. Also, make sure the mongodb server is running
e. g., using '/sbin/service mongod status'.
EOF
fi
chown -R diaspora /var/log/diaspora
sed -i '/socket_pidfile:/s|:.*|: /var/run/diaspora/diaspora-wsd.pid|' \
config/app_config.yml
hostname=$( awk '/pod_url:/ { print $2; exit }' <config/app_config.yml)
if [ -n "$arg_hostname" ]; then
sed -i "/pod_url:/s|$hostname|$arg_hostname|g" config/app_config.yml &&
echo "config/app_config.yml updated."
exit 0
fi
while : ; do
echo "Current hostname is \"$hostname\""
echo -n "Enter new hostname [$hostname] :"
read new_hostname garbage
echo -n "Use hostname \"$new_hostname\" as pod_url (Yes/No) [Yes]? :"
read yesno garbage
test "${yesno:0:1}" = 'y' -o "${yesno:0:1}" = 'Y' -o -z "$yesno" && {
sed -i "/pod_url:/s|$hostname|$new_hostname|g" config/app_config.yml &&
echo "config/app_config.yml updated."
break
}
done

View file

@ -1,103 +0,0 @@
#!/bin/bash
#
# /etc/rc.d/init.d/diaspora-wsd
#
# Starts the diaspora websocket daemon
#
# chkconfig: - 80 80
# description: Diaspora websocket daemon
### BEGIN INIT INFO
# Provides: diaspora-wsd
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Should-Start: $remote_fs
# Should-Stop: $remote_fs
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: start and stop Diaspora websocket server
# Description: The websocket server provides websocket services for
# diaspora.
### END INIT INFO
# Source function library.
. /etc/init.d/functions
if [ -f /etc/sysconfig/diaspora-wsd -a $UID -eq 0 ]; then
. /etc/sysconfig/diaspora-wsd
fi
# Note: this line is patched by installation scripts.
cd /usr/share/diaspora
RETVAL=0
prog="Diaspora websocket server"
exec="script/websocket_server.rb"
pidfile="/var/run/diaspora/diaspora-wsd"
lockfile="/var/lock/subsys/diaspora-wsd"
logfile="/var/log/diaspora/diaspora-wsd.log"
[ -n "$OPTIONS" ] && OPTIONS=" $OPTIONS"
ruby_cmd="ruby -C $PWD $exec$OPTIONS"
start() {
[ $UID -eq 0 ] || exit 4
[ -f $exec ] || exit 5
echo -n $"Starting $prog: "
daemon --pidfile $pidfile "$ruby_cmd >>$logfile 2>&1 &"
RETVAL=$?
echo
if test $RETVAL = 0; then
touch $lockfile
pgrep -f "$ruby_cmd" > $pidfile || {
echo "Warning: cannot find running diaspora-webserver"
exit 7
}
fi
}
stop() {
[ $UID -eq 0 ] || exit 4
echo -n $"Stopping $prog: "
killproc -p $pidfile $exec
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f $lockfile
echo
}
#
# See how we were called.
#
case "$1" in
start)
start
;;
stop)
stop
;;
force-reload|restart)
stop
sleep 1
start
RETVAL=$?
;;
condrestart|try-restart)
if [ -f $lockfile ]; then
stop
sleep 3
start
fi
;;
status)
status -p $pidfile $exec
RETVAL=$?
;;
*)
echo $"Usage: $0 {condrestart|try-restart|start|stop|restart|force-reload|status}"
RETVAL=2
[ "$1" = 'usage' ] && RETVAL=0
esac
exit $RETVAL

View file

@ -1,13 +0,0 @@
/var/log/diaspora/*.log {
create 755 diaspora diaspora
weekly
rotate 10
copytruncate
delaycompress
compress
notifempty
missingok
postrotate
( /sbin/service diaspora-wsd condrestart ) >/dev/null 2>&1
endscript
}

View file

@ -1,167 +0,0 @@
# Turn off the brp-python-bytecompile script
%global __os_install_post %(echo '%{__os_install_post}' | \
sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
%global debug_package %{nil}
%define git_release HEAD
Summary: A social network server
Name: diaspora
Version: 0.0
Release: 1.%{git_release}%{?dist}
License: AGPLv3
Group: Applications/Communications
URL: http://www.joindiaspora.com/
Vendor: joindiaspora.com
Source: %{name}-%{version}-%{git_release}.tar.gz
Source1: diaspora-wsd
Source2: diaspora-setup
Source3: diaspora.logconf
Source4: make_rel_symlink.py
BuildArch: noarch
BuildRoot: %{_rmpdir}/not-used-in-fedora/
Requires: mongodb-server
Requires: ruby(abi) = 1.8
Requires: diaspora-bundle = %{version}
%description
A privacy aware, personally controlled, do-it-all and
open source social network server.
%package wsd
Summary: Sys V init script for diaspora websocket daemon
Group: Applications/Communications
Requires: %{name} = %{version}
%description wsd
Tools to use the diaspora websocket daemon as a service e. g., when
using papche passenger or system-wide installed thin server to run
diaspora.
%prep
%setup -q -n %{name}-%{version}-%{git_release}
find . -perm /u+x -type f -exec \
sed -i 's|^#!/usr/local/bin/ruby|#!/usr/bin/ruby|' {} \; > /dev/null
%build
rm -rf master/vendor/bundle
%install
rm -fr $RPM_BUILD_ROOT
sed -i \
'/BUNDLE_PATH/s|:.*|: %{_libdir}/diaspora-bundle/vendor/bundle|' \
master/.bundle/config
cp master/GNU-AGPL-3.0 master/COPYRIGHT master/README.md master/AUTHORS .
cp master/pkg/fedora/README.md README-Fedora.md
mkdir -p $RPM_BUILD_ROOT/etc/init.d
cp %SOURCE1 $RPM_BUILD_ROOT/etc/init.d
sed -i '/^cd /s|.*|cd %{_datadir}/diaspora/master|' \
$RPM_BUILD_ROOT/etc/init.d/diaspora-wsd
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d
cp %SOURCE3 $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/diaspora
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/diaspora
cp -ar master $RPM_BUILD_ROOT/%{_datadir}/diaspora
cp -ar master/.bundle $RPM_BUILD_ROOT/%{_datadir}/diaspora/master
rm -rf $RPM_BUILD_ROOT/%{_datadir}/diaspora/master/vendor/*
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/uploads
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/tmp
cp %SOURCE2 $RPM_BUILD_ROOT/%{_datadir}/diaspora
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/log/diaspora
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/run/diaspora
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/uploads
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/tmp
%{SOURCE4} $RPM_BUILD_ROOT/%{_localstatedir}/log/diaspora \
$RPM_BUILD_ROOT/%{_datadir}/diaspora/master/log
%{SOURCE4} $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/uploads \
$RPM_BUILD_ROOT/%{_datadir}/diaspora/master/public/uploads
%{SOURCE4} $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/tmp \
$RPM_BUILD_ROOT/%{_datadir}/diaspora/master/tmp
find $RPM_BUILD_ROOT/%{_datadir}/diaspora -type d \
-fprintf dirs '%%%dir "%%p"\n'
find -L $RPM_BUILD_ROOT/%{_datadir}/diaspora -type f \
-fprintf files '"%%p"\n'
cat files >> dirs && mv -f dirs files
sed -i -e '\|.*/master/config.ru"$|d' \
-e '\|.*/master/config/environment.rb"$|d' \
-e '\|.*/run/diaspora"$|d' \
-e '\|.*/pkg/fedora/dist"$|d' \
-e 's|%{buildroot}||' -e 's|//|/|' -e '/""/d' \
files
%post wsd
/sbin/chkconfig --add diaspora-wsd || :
%preun wsd
if [ $1 -eq 0 ] ; then
service diaspora-wsd stop &>/dev/null || :
/sbin/chkconfig --del diaspora-wsd
fi
%clean
rm -fr $RPM_BUILD_ROOT
%files -f files
%defattr(-, root, root, 0755)
%doc AUTHORS README.md GNU-AGPL-3.0 COPYRIGHT README-Fedora.md
%attr(-, diaspora, diaspora) %{_datadir}/diaspora/master/config.ru
%attr(-, diaspora, diaspora) %{_datadir}/diaspora/master/config/environment.rb
%attr(-, diaspora, diaspora) %{_datadir}/diaspora/master/pkg/fedora/dist
%attr(-, diaspora, diaspora) %{_localstatedir}/log/diaspora
%attr(-, diaspora, diaspora) %{_localstatedir}/lib/diaspora/uploads
%attr(-, diaspora, diaspora) %{_localstatedir}/lib/diaspora/tmp
%attr(-, diaspora, diaspora) %{_localstatedir}/run/diaspora
%{_datadir}/diaspora/master/pkg/fedora/dist
%{_datadir}/diaspora/master/pkg/ubuntu/dist
%{_datadir}/diaspora/master/tmp
%{_datadir}/diaspora/master/public/uploads
%{_datadir}/diaspora/master/log
%config(noreplace) %{_sysconfdir}/logrotate.d/diaspora
%files wsd
%defattr(-, root, root, 0755)
%{_sysconfdir}/init.d/diaspora-wsd
%changelog
* Fri Sep 24 2010 Alec Leamas <leamas.alec@gmail.com> 0.0-1.1009280542_859ec2d
- Initial attempt to create a spec fi+le
# rubygem-term-ansicolor in repo (1.0.5)
# rubygem-abstract: in repo (1.0)
# rubygem-actionpack in repo (2.3.5), rawhide (2.3.8)
# rubygem-builder in repo (2.1.2)
# rubygem-columnize in repo (0.3.1)
# rubygem-crack in repo (0.1.8)
# rubygem-cucumber in repo (0.9.0)
# diff-lcs in rep (1.1.2)
# eventmachine in repo (0.12.10)
# gherkin in repo (2.2.4)
# rubygem-json in repo (1.1.9), rawhide(1.4.6)
# rubygem-linecache in repo (0.43)
# rubygem-mime-types in repo (1.16)
# rubygem-mocha in repo (0.9.8)
# rubygem-net-ssh in repo (2.0.23)
# rubygem-nokogiri in repo (1.4.3.1)
# rubygem-rake in repo (0.8.7)
# rubygem-ruby-debug in repo (0.10.4)
# rubygem-ruby-debug-base in repo (0.10.4)
# rubygem-term-ansicolor in repo (1.0.5)
# rubygem-thin in repo(1.2.5), rawhide(1.2.7)
# rubygem-uuidtools in repo(2.1.1)

View file

@ -1 +0,0 @@
../source/dist/

View file

@ -1,52 +0,0 @@
#!/usr/bin/env python
import os
import os.path
import sys
import pdb
import shutil
def relative_ln_s( from_, to_ ):
"""
This is just so dirty & boring: create a relative symlink, making the
to_ path relative to from_. No errorchecks. Both arguments must be
files, a destination directory doesn't work (I think). An existing
file in to_ will be removed.
"""
prefix = os.path.commonprefix( [ to_, from_ ] )
if prefix == '':
prefix = '/'
source = from_.split( prefix )[ 1 ]
dest = to_.split( prefix )[ 1 ]
level = len( dest.split( '/' ) ) - 1
path = ( '../' * level ) + source
return path
USAGE = 'Usage: make_rel_symlink [-p] <sourcefile> <destfile>'
just_print = False;
if sys.argv[1] == "-p":
just_print = True;
sys.argv = sys.argv[ 1:]
if len( sys.argv ) != 3:
print USAGE
sys.exit( 1 )
if os.path.isdir( sys.argv[2] ):
print "Removing link target dir:" + sys.argv[2]
shutil.rmtree( sys.argv[2])
link_path = relative_ln_s( sys.argv[1], sys.argv[2] )
if just_print:
print link_path
else:
os.chdir( os.path.dirname( sys.argv[2]))
target = os.path.basename( sys.argv[2])
if os.path.exists( target ):
os.unlink( target)
os.symlink( link_path, target)

View file

@ -1,169 +0,0 @@
#!/bin/bash
# Create RPM spec files matching diaspora tarballs
#
# Usage: See function usage() at bottom.
#
GIT_REPO='http://github.com/diaspora/diaspora.git'
VERSION='0.0'
RELEASE='1'
. ../source/funcs.sh
function fix_alphatag()
# Patch version on top comment first id line:
# Usage: fix_alphatag <file> <version> <commit_id> <release>
# Patches:\
# * Fri Sep 24 2010 name surname <email@com> 1.20100925_faf23207
{
local dist=$(rpm --eval %dist)
awk -v dist="$dist" -v version="$2" -v commit="$3" -v release="$4" \
' BEGIN { done = 0 }
/^[*]/ { if (done)
print
else
{
s = sprintf( "-%s.%s%s\n", release, commit, dist)
gsub( "-[0-9][.][^ ]*$", s)
done = 1
# add new gsub for version...
print
}
next
}
{ print }' < $1 > $1.tmp && mv -f $1.tmp $1
}
function fix_bundle_deps
# usage: fix_bundle_deps <specfile> <version> <commit>
# Patches: Requires: diaspora-bundle = 0.0-20101021-aefsf323148
{
awk -v vers="$2-$3" \
' /Requires:/ { if ($2 == "diaspora-bundle")
printf( "%s %s = %s\n", $1,$2,vers)
else
print
next
}
{ print}' \
< $1 > $1.tmp && mv -f $1.tmp $1
}
function patch()
# Patch spec-files with current version-release
# Usage: patch <version> <commit> <release>
{
sed -e "/^%define/s|HEAD|$2|" \
-e '/^Version:/s|.*|Version: '$1'|' \
<diaspora.spec >dist/diaspora.spec
fix_alphatag dist/diaspora.spec $1 $2 $3
local bundle_id=$(git_id dist/diaspora/Gemfile)
local dist_tag=$(rpm --eval %dist)
fix_bundle_deps dist/diaspora.spec $1 "$RELEASE.${bundle_id}$dist_tag"
sed -e "/^%define/s|HEAD|$bundle_id|" \
-e '/^Version:/s|.*|Version: '$1'|' \
< diaspora-bundle.spec > dist/diaspora-bundle.spec
cp dist/diaspora.spec dist/diaspora/diaspora.spec
}
function prepare_rpm()
# Usage: prepare_rpm < commit>
{
local dest=$(rpm --eval %_sourcedir)
test -z "$dest" && {
echo "Can't find RPM source directory, giving up."
exit 2
}
local commit=$( checkout $1)
echo "Release: $RELEASE.$commit"
echo "Rpm source dir: $dest"
patch $VERSION $commit $RELEASE
local src="dist/diaspora-$VERSION-$commit.tar.gz"
test -e $src ||
cat <<- EOF
Warning: $src does not exist
(last version not built?)
EOF
ln -sf $PWD/$src $dest
local bundle_commit=$( git_id dist/diaspora/Gemfile)
local bundle="dist/diaspora-bundle-$VERSION-$bundle_commit.tar.gz"
test -e $bundle ||
cat <<- EOF
Warning: $bundle does not exist
(last version not built?)
EOF
ln -sf $PWD/$bundle $dest
local file
for file in $( grep -v '^#' SOURCES); do
if [ -e "$file" ]; then
ln -sf $PWD/$file $dest/$file
else
echo "Warning: $file (listed in SOURCES) does not exist"
fi
done
( cd $dest; find . -type l -not -readable -exec rm {} \;)
echo "Source specfile: dist/diaspora.spec"
echo "Bundle specfile: dist/diaspora-bundle.spec"
}
function usage()
{
cat <<- EOF
Usage: prepare-rpm [options]
Options:
-h Print this message.
-r release For prepare, mark with release nr, defaults to 1.
-u uri Git repository URI, defaults to
$GIT_REPO.
Symlink bundle and source tarballs to rpm source dir, create
patched rpm spec files.
All results are stored in dist/
EOF
}
commit='HEAD'
BUNDLE_FIX='no'
while getopts ":r:u:h" opt
do
case $opt in
r) RELEASE="$OPTARG:"
;;
h) usage
exit 0
;;
u) GIT_REPO="$OPTARG"
;;
*) usage
exit 2
;;
esac
done
shift $(($OPTIND - 1))
typeset -r GIT_REPO RELEASE BUNDLE_FIX
export LANG=C
test $# -gt 0 && {
usage;
exit 2;
}
prepare_rpm

View file

@ -1,103 +0,0 @@
#!/bin/bash
#
# Install diaspora, its dependencies and start.
#
# Usage: pkg/bootstrap-fedora-diaspora.sh [external hostname]
#
# Synopsis, install:
# $ git clone git@github.com:diaspora/diaspora.git
# $ cd diaspora
# $ sudo pkg/bootstrap-fedora-diaspora.sh
#
# New start:
# $ sudo su - diaspora
# $ cd diaspora
# $ script/server
#
# Unless already existing, the diaspora user is created.
# A new diaspora clone is place in ~diaspora.
# This dir is populated, configured and finally
# acts as a base for running diaspora servers.
#
# Script is designed not to make any changes in invoking
# caller's environment.
#
# Must run as root
GIT_REPO='http://github.com/leamas/diaspora.git'
DIASPORA_HOSTNAME=${1:-'mumin.dnsalias.net'}
test $UID = "0" || {
echo "You need to be root to do this, giving up"
exit 2
}
[[ -d config && -d script ]] || {
echo Error: "this is not a diaspora base directory"
exit 3
}
sudo yum groupinstall -y "Development tools"
yum install -y git bison sqlite-devel \
readline-devel zlib-devel libyaml-devel libffi-devel \
ImageMagick libxslt-devel libxml2-devel \
openssl-devel mongodb-server wget \
ruby-devel ruby-libs ruby-ri ruby-irb ruby-rdoc \
rubygems compat-readline5 git
sudo gem install bundler
getent group diaspora >/dev/null || groupadd diaspora
getent passwd diaspora >/dev/null || {
useradd -g diaspora -s /bin/bash -m diaspora
echo "Created user diaspora"
}
service mongod start
su - diaspora << EOF
#set -x #used by test scripts, keep
[ -e diaspora ] && {
echo "Moving existing diaspora out of the way"
mv diaspora diaspora.$$
}
git clone $GIT_REPO
cd diaspora
bundle install --deployment
#bundle exec jasmine init
#Configure diaspora
cp config/app_config.yml.example config/app_config.yml
source pkg/source/funcs.sh
init_appconfig config/app_config.yml "$DIASPORA_HOSTNAME"
mv lib/tasks/jasmine.rake lib/tasks/jasmine.no-rake
echo "Setting up DB..."
if bundle exec rake db:seed:dev ; then
cat <<- EOM
DB ready. Logins -> tom and korth, password -> evankorth.
More details ./diaspora/db/seeds/tom.rb. and ./diaspora/db/seeds/dev.rb.
EOM
else
cat <<- EOM
Database config failed. You might want to remove all db files with
'rm -rf /var/lib/mongodb/*' and/or reset the config file by
'cp config/app_config.yml.example config/app_config.yml' before
making a new try. Also, make sure the mongodb server is running
e. g., by running 'service mongodb status'.
EOM
fi
echo "Starting server"
script/server -d
pidfile="~diaspora/diaspora/log/diaspora-wsd.pid"
echo " To stop server: pkill thin; kill $(cat $pidfile)"
echo 'To restart server: sudo su - diaspora -c "diaspora/script/server -d"'
EOF

View file

@ -1,74 +0,0 @@
## Diaspora source tarball generation
Creates diaspora source tarballs.
#### Generic source synopsis
Generate source tarball:
% ./make-dist.sh source
Using repo: http://github.com/diaspora/diaspora.git
Commit id: 1010092232_b313272
Source: dist/diaspora-0.0-1010092232_b313272.tar.gz
Required bundle: 1010081636_d1a4ee0
%
The source tarball could be used as-is, by unpacking add making a
*bundle install*. An alternative is to generate a canned bundle like:
% ./make-dist.sh bundle
[ lot's of output...]
Bundle: dist/diaspora-bundle-0.0-1010081636_d1a4ee0.tar.gz
%
This file can be installed anywhere. To use it, add a symlinks from app
to the bundle'. Reasonable defaults are to install diaspora in
/usr/share/diaspora and bundle in /usr/lib/diaspora-bundle. With these,
the link setups is
% cd /usr/share/diaspora/master
% rm -rf vendor
% ln -sf /usr/lib/diaspora-bundle/vendor vendor
% ln -sf /usr/lib/diaspora-bundle/Gemfile .
% ln -sf /usr/lib/diaspora-bundle/Gemfile.lock .
The directories tmp, log, and public/uploads needs to be writable. If using
apache passenger, read the docs on uid used and file ownership.
Note that the bundle version required is printed each time a new source
is generated.
#### Notes
The source tarball is as retrieved from diaspora with following differences:
- The .git directories are removed (freeing more than 50% of the size).
- A new file /master/config/gitversion is created.
- The file public/source.tar.gz is generated.
- The file .bundle/config is patched. Remove before doing
*bundle install*
The bundle is basically the output from 'bundle package'. The git-based
gems are also added into git-gems. Bundle also houses the two files
Gemfile and Gemfile.lock
*make-dist.sh source* applies all patches named *.patch in this directory
after checking out source from git.
./make-dist.sh bundle|source occasionally fails on bad Gemfile.lock. The
root cause is a bad Gemfile in the git repo. Possible fixes includes
using a older version known to work:
% ./make-dist.sh -c c818885b6 bundle
% ./make-dist.sh -c c818885b6 source
or forcing a complete update of Gemfile.lock using 'bundle update' (a
potentially problematic operation):
% ./make-dist.sh -f bundle
#### Implementation
'make-dist.sh source' script checks out latest version of diaspora into the
dist/diaspora directory. This content is, after some patches, the diaspora package.
'make-dir.sh bundle' makes a *bundle package* in the diaspora dir.
The resulting bundle is stored in vendor/bundle. This is, after some more
patches, the content of diaspora-bundle tarball. Target systems makes a
*bundle install --local* to use it.

View file

@ -1,11 +0,0 @@
diff --git a/.bundle/config b/.bundle/config
new file mode 100644
index 0000000..1c3e2ce
--- /dev/null
+++ b/.bundle/config
@@ -0,0 +1,5 @@
+---
+BUNDLE_FROZEN: "1"
+BUNDLE_DISABLE_SHARED_GEMS: "1"
+BUNDLE_WITHOUT: test:rdoc
+BUNDLE_PATH: vendor/bundle

View file

View file

@ -1,108 +0,0 @@
#
# Common stuff for pkg scripts
#
function git_id
#
# Echo package-friendly source id.
#
# Usage: git_id [-n] [file or directory]
#
{
local nl="\n"
local file_or_dir="$PWD"
test "$1" = '-n' && { nl=""; shift; }
test -n "$1" && file_or_dir="$1"
if [ -d $file_or_dir ]; then
local file=""
local dir=$file_or_dir
else
local file=$(basename $file_or_dir)
local dir=$(dirname $file_or_dir)
fi
(
cd $dir
git log -1 --abbrev-commit --date=iso $file |
awk -v nl="$nl" \
' BEGIN { commit = ""; d[1] = "" }
/^commit/ { if ( commit == "") commit = $2 }
/^Date:/ { if (d[1] == "") {
split( $2, d, "-")
split( $3, t, ":")
}
}
END { printf( "%s%s%s%s%s_%s%s",
substr( d[1],3), d[2], d[3],
t[1], t[2],
commit, nl)
}'
)
}
function checkout()
# Checkout last version of diaspora unless it's already there.
# Uses global GIT_REPO to determine repo url
# Usage: checkout [commit id, defaults to HEAD]
# Returns: commit for current branch's HEAD.
{
mkdir dist &>/dev/null || :
(
local last_repo=''
cd dist
test -e '.last-repo' &&
last_repo=$( cat '.last-repo')
test "$last_repo" != $GIT_REPO &&
rm -rf diaspora
test -d diaspora || {
git clone --quiet $GIT_REPO;
(
cd diaspora;
git checkout Gemfile Gemfile.lock
git remote add upstream \
git://github.com/diaspora/diaspora.git
for p in ../../*.patch; do
git apply --whitespace=fix $p > /dev/null
done &> /dev/null || :
)
}
echo -n "$GIT_REPO" > '.last-repo'
cd diaspora;
git fetch --quiet upstream
git merge --quiet upstream/master
[ -n "$1" ] && git reset --hard --quiet $1
git_id -n
)
}
function init_appconfig
# Edit pod_url in hostname
# Silently uses argumetn if present, else run dialog.
# Usage: init_appconfig <app_config.yml> [hostname]
{
config=$1
arg_hostname="$2"
hostname=$( awk '/pod_url:/ { print $2; exit }' <$config )
if [ -n "$arg_hostname" ]; then
sed -i "/pod_url:/s|$hostname|$arg_hostname|g" $config && \
echo "config/app_config.yml updated."
return 0
else
while : ; do
echo "Current hostname is \"$hostname\""
echo -n "Enter new hostname [$hostname] :"
read new_hostname garbage
echo -n "Use \"$new_hostname\" as pod_url (Yes/No) [Yes]? :"
read yesno garbage
[ "${yesno:0:1}" = 'y' -o "${yesno:0:1}" = 'Y' -o -z "$yesno" ] && {
sed -i "/pod_url:/s|$hostname|$new_hostname|g" $config &&
echo "config/app_config.yml updated."
break
}
done
fi
}

View file

@ -1,224 +0,0 @@
#!/bin/bash
# Create diaspora distribution tarballs.
#
# Usage: See function usage() at bottom.
#
GIT_REPO='http://github.com/diaspora/diaspora.git'
VERSION='0.0'
. ./funcs.sh
function build_git_gems()
# Usage: build_git_gems <Gemfile> <tmpdir> <gemdir>
# Horrible hack, in wait for bundler handling git gems OK.
{
[ -d 'gem-tmp' ] || mkdir gem-tmp
cd gem-tmp
rm -rf *
grep 'git:' ../$1 | sed 's/,/ /g' | awk '
/^.*git:\/\/.*$/ {
gsub( "=>", " ")
if ( $1 != "gem") {
print "Strange git: line (ignored) :" $0
next
}
name = $2
url=""
for (i = 3; i <= NF; i += 1) {
key = $i
i += 1
if (key == ":git")
url = $i
}
cmd = sprintf( "git clone --bare --quiet %s\n", url)
print "Running: ", cmd
system( cmd)
}'
mv devise-mongo_mapper.git devise-mongo_mapper
for dir in *; do
if [ ! -e $dir/*.gemspec ]; then
cp -ar $dir ../$2
fi
done
cd ..
# rm -rf gem-tmp
}
function make_src
# Create a distribution tarball
# Usage: make src <commit>
{
echo "Using repo: $GIT_REPO"
commit=$(checkout ${1:-'HEAD'})
echo "Commit id: $commit"
RELEASE_DIR="diaspora-$VERSION-$commit"
rm -rf dist/${RELEASE_DIR}
mkdir dist/${RELEASE_DIR}
cd dist
mkdir ${RELEASE_DIR}/master
cp -ar diaspora/* diaspora/.git* ${RELEASE_DIR}/master
(
cd ${RELEASE_DIR}/master
rm -rf vendor/bundle/* vendor/git/* vendor/cache/* gem-tmp
git show --name-only > config/gitversion
tar czf public/source.tar.gz \
--exclude='source.tar.gz' -X .gitignore *
find $PWD -name .git\* | xargs rm -rf
rm -rf .bundle
/usr/bin/patch -p1 -s <../../../add-bundle.diff
)
tar czf ${RELEASE_DIR}.tar.gz ${RELEASE_DIR} && \
rm -rf ${RELEASE_DIR}
cd ..
echo "Source: dist/${RELEASE_DIR}.tar.gz"
echo "Required bundle: $(git_id dist/diaspora/Gemfile)"
}
function make_docs()
{
local gems=$1
local dest=$2
for gem in $(ls $gems); do
local name=$(basename $gem)
[ -r "$gems/$gem/README*" ] && {
local readme=$(basename $gems/$gem/README*)
cp -a $gems/$gem/$readme $dest/$readme.$name
}
[ -r "$gems/$gem/COPYRIGHT" ] && \
cp -a $gems/$gem/COPYRIGHT $dest/COPYRIGHT.$name
[ -r "$gems/$gem/LICENSE" ] && \
cp -a $gems/$gem/LICENSE $dest/LICENSE.$name
[ -r "$gems/$gem/License" ] && \
cp -a $gems/$gem/License $dest/License.$name
[ -r "$gems/$gem/MIT-LICENSE" ] && \
cp -a $gems/$gem/MIT-LICENSE $dest/MIT-LICENSE.$name
[ -r "$gems/$gem/COPYING" ] && \
cp -a $gems/$gem/COPYING $dest/COPYING.$name
done
}
function make_bundle()
# Create the bundle tarball
# Usage: make_bundle [ commit, defaults to HEAD]
#
{
checkout ${1:-'HEAD'} >/dev/null
local bundle_id=$( git_id dist/diaspora/Gemfile)
local bundle_name="diaspora-bundle-$VERSION-$bundle_id"
test -e "dist/$bundle_name.tar.gz" || {
echo "Creating bundle $bundle_name"
cd dist
rm -rf $bundle_name
cd diaspora
rm Gemfile.lock
rm -rf .bundle
if [ "$BUNDLE_FIX" = 'yes' ]; then
bundle update
fi
[ -d 'git-repos' ] || mkdir git-repos
rm -rf git-repos/*
git checkout Gemfile
build_git_gems Gemfile git-repos
sed -i 's|git://.*/|git-repos/|g' Gemfile
# see: http://bugs.joindiaspora.com/issues/440
bundle install --path=vendor/bundle || {
bundle install --path=vendor/bundle || {
echo "bundle install failed, giving up" >&2
exit 3
}
}
bundle package
mkdir -p "../$bundle_name/docs"
mkdir -p "../$bundle_name/vendor"
cp -ar AUTHORS Gemfile Gemfile.lock GNU-AGPL-3.0 COPYRIGHT \
../$bundle_name
make_docs "vendor/bundle/ruby/1.8/gems/" "../$bundle_name/docs"
mv vendor/cache ../$bundle_name/vendor
mv vendor/gems ../$bundle_name/vendor
mv git-repos ../$bundle_name
git checkout Gemfile
cd ..
tar czf $bundle_name.tar.gz $bundle_name
mv $bundle_name/vendor/cache diaspora/vendor/cache
cd ..
}
echo
echo "Bundle: dist/$bundle_name.tar.gz"
}
function usage()
{
cat <<- EOF
Usage: make-dist [options] <dist|bundle>
Options:
-h Print this message.
-c commit Use a given commit, defaults to last checked in.
-u uri Git repository URI, defaults to
$GIT_REPO.
-f For bundle, fix dependencies by running 'bundle update'
before 'bundle install'
source Build a diaspora application tarball.
bundle Build a bundler(1) bundle for diaspora.
All results are stored in dist/
EOF
}
commit='HEAD'
BUNDLE_FIX='no'
while getopts ":c:u:fh" opt
do
case $opt in
u) GIT_REPO="$OPTARG"
;;
c) commit="${OPTARG:0:7}"
;;
f) BUNDLE_FIX='yes'
;;
h) usage
exit 0
;;
*) usage
exit 2
;;
esac
done
shift $(($OPTIND - 1))
typeset -r GIT_REPO BUNDLE_FIX
export LANG=C
test $# -gt 1 -o $# -eq 0 && {
usage;
exit 2;
}
case $1 in
"bundle") make_bundle $commit $BUNDLE_FIX
;;
'source') make_src $commit
;;
*) usage
exit 1
;;
esac

View file

@ -1,204 +0,0 @@
#!/bin/bash
# Author : hemanth.hm@gmail.com
# Site : www.h3manth.com
# Contributions from: Mackenzie Morgan (maco) and Daniel Thomas (drt24)
# This script helps to setup diaspora.
#
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
# USAGE: ./pkg/ubuntu-setup.bash [external hostname]
# Do NOT run this script as root.
GIT_REPO=${GIT_REPO:-'http://github.com/diaspora/diaspora.git'}
arg_hostname="$1"
# Set extented globbing
shopt -s extglob
# fail on error
set -e
[[ "$(whoami)" == "root" ]] && echo "Please do not run this script as root/sudo
We need to do some actions as an ordinary user. We use sudo where necessary." && exit 1
# Check if the user has sudo privileges.
sudo -v >/dev/null 2>&1 || { echo $(whoami) has no sudo privileges ; exit 1; }
# Check if universal repository is enabled
grep -ie '^deb .*universe' /etc/apt/sources.list > /dev/null || \
{ echo "Please enable universe repository" ; exit 1 ; }
# Make sure that we only install the latest version of packages
sudo apt-get update
# Check if wget is installed
test wget || { echo "Installing wget.." && sudo apt-get install wget \
&& echo "Installed wget.." ; }
# Install build tools
echo "Installing build tools.."
sudo apt-get -y --no-install-recommends install \
build-essential libxslt1.1 libxslt1-dev libxml2
echo "..Done installing build tools"
# Install Ruby 1.8.7
echo "Installing ruby-full Ruby 1.8.7.."
sudo apt-get -y --no-install-recommends install ruby-full
echo "..Done installing Ruby"
# Install Rake
echo "Installing rake.."
sudo apt-get -y --no-install-recommends install rake
echo "..Done installing rake"
#Store the release name so we can use it here and later
RELEASE=$(lsb_release -c | cut -f2)
# Get the current release and install mongodb
if [ $RELEASE == "maverick" ]
then
#mongodb does not supply a repository for maverick yet so install
# an older version from the ubuntu repositories
if [ ! -f /usr/lib/libmozjs.so ]
then
echo "Lanchpad bug https://bugs.launchpad.net/ubuntu/+source/mongodb/+bug/557024
has not been fixed using workaround:"
echo "sudo ln -sf /usr/lib/xulrunner-1.9.2.10/libmozjs.so /usr/lib/libmozjs.so"
sudo ln -sf /usr/lib/xulrunner-1.9.2.10/libmozjs.so /usr/lib/libmozjs.so
fi
sudo apt-get -y --no-install-recommends install mongodb
else
lsb=$(lsb_release -rs)
ver=${lsb//.+(0)/.}
repo="deb http://downloads.mongodb.org/distros/ubuntu ${ver} 10gen"
echo "Setting up MongoDB.."
echo "."
echo ${repo} | sudo tee -a /etc/apt/sources.list
echo "."
echo "Fetching keys.."
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
echo "."
sudo apt-get update
echo "."
sudo apt-get -y --no-install-recommends install mongodb-stable
echo "Done installing monngodb-stable.."
fi
# Install imagemagick
echo "Installing imagemagick.."
sudo apt-get -y --no-install-recommends install imagemagick libmagick9-dev
echo "Installed imagemagick.."
# Install git-core
echo "Installing git-core.."
sudo apt-get -y --no-install-recommends install git-core
echo "Installed git-core.."
# Setting up ruby gems
echo "Fetching and installing ruby gems.."
(
if [ $RELEASE == "maverick" ]
then
sudo apt-get install --no-install-recommends -y rubygems
sudo ln -sf /var/lib/gems/1.8/bin/bundle /usr/local/bin/bundle #for PATH
elif [ $RELEASE == "lucid" ]
then
sudo add-apt-repository ppa:maco.m/ruby
sudo apt-get update
sudo apt-get install --no-install-recommends -y rubygems
sudo ln -sf /var/lib/gems/1.8/bin/bundle /usr/local/bin/bundle #for PATH
else
# Old version
echo "."
cd /tmp
wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
echo "."
tar -xf rubygems-1.3.7.tgz
echo "."
cd rubygems-1.3.7
echo "."
sudo ruby setup.rb
echo "."
sudo ln -sf /usr/bin/gem1.8 /usr/bin/gem
echo "."
fi
)
echo "Done installing the gems.."
# Install bundler
echo "Installing bundler.."
sudo gem install bundler
echo "Installed bundler.."
# Take a clone of Diaspora
(
# Check if the user is already in a cloned source if not clone the source
[[ $( basename $PWD ) == "diaspora" ]] && \
echo "Already in diaspora directory" || \
{ git $GIT_REPO && cd diaspora
echo "Cloned the source.."
}
# Install extra gems
echo "Installing more gems.."
bundle install
bundle exec jasmine init
echo "Installed."
#Configure diaspora
cp config/app_config.yml.example config/app_config.yml
hostname=$( awk '/pod_url:/ { print $2; exit }' <config/app_config.yml)
if [ -n "$arg_hostname" ]; then
sed -i "/pod_url:/s|$hostname|$arg_hostname|g" config/app_config.yml &&
echo "config/app_config.yml updated."
exit 0
else
while : ; do
echo "Current hostname is \"$hostname\""
echo -n "Enter new hostname [$hostname] :"
read new_hostname garbage
echo -n "Use \"$new_hostname\" as pod_url (Yes/No) [Yes]? :"
read yesno garbage
[ "${yesno:0:1}" = 'y' -o "${yesno:0:1}" = 'Y' -o -z "$yesno" ] && {
sed -i "/pod_url:/s|$hostname|$new_hostname|g" \
config/app_config.yml &&
echo "config/app_config.yml updated."
break
}
done
fi
# Create the shared directory which is used by rake db:seed:tom
### mkdir shared
# Install DB setup
echo "Setting up DB..."
if rake db:seed:dev ; then
cat <<- EOF
DB ready. Logins -> tom or korth, password -> evankorth.
More details ./diaspora/db/seeds/tom.rb. and ./diaspora/db/seeds/dev.rb.
EOF
else
cat <<- EOF
Database config failed. You might want to remove all db files with
'rm -rf /var/lib/mongodb/*' and/or reset the config file by
'cp config/app_config.yml.example config/app_config.yml' before
making a new try. Also, make sure the mongodb server is running
EOF
fi
# Run appserver
echo "Starting server"
script/server -d
pidfile="~diaspora/diaspora/log/diaspora-wsd.pid"
echo " To stop server: pkill thin; kill $(cat $pidfile)"
echo 'To restart server: sudo su - diaspora -c "diaspora/script/server -d"'
)

View file

@ -1,3 +0,0 @@
patches-*
dist
series

View file

@ -1,82 +0,0 @@
## Package-oriented install for ubuntu.
Here are scripts to install diaspora on Ubuntu. They are designed to
work as a first step towards packaging, but should be usable as is.
### Synopsis
Bootstrap the distribution from git:
% sudo apt-get install git-core
% git clone git://github.com/diaspora/diaspora.git
% cd diaspora/pkg/ubuntu
Create and install the diaspora bundle and application in
diaspora/pkg/source according to
[source README](http://github.com/diaspora/diaspora/tree/master/pkg/source/)
Install the dependencies (a good time for a coffe break):
% sudo ./diaspora-install-deps
Install, initiate and start the server;
% sudo ./diaspora-install
% sudo ./diaspora-setup
% sudo su - diaspora
% cd /usr/share/diaspora/master
% ./script/server
### Upgrading
The normal procedure to update is to just
$ sudo su - diaspora
$ cd /usr/share/diaspora/master/pkg/ubuntu
$ ./make-dist.sh bundle
$ ./make-dist.sh source
and then use diaspora-install and diaspora-install-bundle as above.
It's necessary to always have the correct bundle. The *./make-dist.sh bundle*
above will use a cached bundle if it's still valid, else build a new.
In most cases only source will need to be built, which is fast.
### Notes
The diaspora websocket service can be comtrolled through upstart.
To start/stop:
% sudo service diaspora-wsd start
% sudo service diaspora-wsd stop
./make-dist.sh bundle|source occasionally fails on bad Gemfile.lock. The
root cause is a bad Gemfile.lock in the git repo. Possible fixes includes
using a older version known to work:
% ./make-dist.sh -c c818885b6 bundle
% ./make-dist.sh -c c818885b6 source
or forcing a complete update of Gemfile.lock using 'bundle update' (a
potentially problematic operation):
% ./make-dist.sh -f bundle
The application lives in /usr/share/diaspora/master. All writable areas
(log, uploads, tmp) are links to /var/lib/diaspora. The config file lives
in /etc/diaspora. All files in /usr/share are read-only, owned by root.
The bundle lives in /usr/lib/diaspora-bundle, readonly, owned by root.
Application finds it through the patched .bundle/config in root dir.
Once diaspora is installed, makedist.sh et. al. are available in
/usr/share/diaspora/master/pkg/ubuntu, so there's no need to checkout
the stuff using git in this case.
The user diaspora is added during install.
Tools used for building package are installed globally. All of diasporas
dependencies lives in the application - nothing is installed by user or
on system level.
This has been tested on a Ubuntu 32-bit 10.10 , clean server and on 10.04
Lucid desktop, also clean installation. Irregular nightly builds are
available from time to time at
[ftp://mumin.dnsalias.net/pub/leamas/diaspora/builds](ftp://mumin.dnsalias.net/pub/leamas/diaspora/builds)
mongodb is having problems occasionally. Sometimes the dependencies are not
installed, and mongod refuses to start. invoke */usr/bin/mongod -f
/etc/mongodb.conf* to test. The lockfile /var/lib/mongodb/mongod.conf is
also a potential problem. Remove to make it start again.

View file

@ -1,32 +0,0 @@
#!/bin/sh
test "$(perl -e 'print $>')" = "0" || {
echo "You need to be root to do this, giving up"
exit 2
}
test $# = "1" || {
echo "Usage: diaspora-bundle-install <diaspora-bundle-VERSION-RELEASE.tar.gz>"
exit 1
}
test -r "$1" || {
echo "Cannot open $1"
exit 2
}
rm -rf /usr/lib/diaspora-bundle
tar xzf $1 -C /usr/lib
cd /usr/lib
mv $(basename $1 .tar.gz) diaspora-bundle
mkdir -p /usr/share/doc/diaspora-bundle || :
cd /usr/lib/diaspora-bundle
cp -a AUTHORS GNU-AGPL-3.0 COPYRIGHT Gemfile Gemfile.lock \
/usr/share/doc/diaspora-bundle
cp -ar docs /usr/share/doc/diaspora-bundle
bundle install --local --deployment --without ri rdoc

View file

@ -1,77 +0,0 @@
#!/bin/bash
#
# Install a fedora source package
#
# Usage diaspora-install <tar package>
test "$(perl -e 'print $>')" = "0" || {
echo "You need to be root to do this, giving up"
exit 2
}
getent group diaspora >/dev/null || groupadd -r diaspora
getent passwd diaspora >/dev/null || \
useradd -r -g diaspora \
-md /var/lib/diaspora \
-s /bin/bash \
-c "Diaspora daemon" diaspora
sudo tar -C /usr/share -xzf $1
cd /usr/share;
rm -rf /usr/share/diaspora
mv $( basename $1 .tar.gz) diaspora
cd /usr/share/diaspora
find . -perm /u+x -type f -exec \
sed -i 's|^#!/usr/local/bin/ruby|#!/usr/bin/ruby|' {} \; > /dev/null
rm -rf master/vendor/bundle master/public/uploads master/tmp master/log
sed -i '/BUNDLE_PATH/s|:.*|: /usr/lib/diaspora-bundle/vendor/bundle|' \
master/.bundle/config
cp master/GNU-AGPL-3.0 master/COPYRIGHT master/README.md master/AUTHORS .
cp master/config/app_config.yml.example ./app_config.yml
cp master/pkg/ubuntu/diaspora-wsd.conf /etc/init
cp master/pkg/ubuntu/diaspora.logrotate /etc/logrotate.d/diaspora
cp master/pkg/ubuntu/diaspora-setup .
mkdir -p /var/log/diaspora
mkdir -p /var/lib/diaspora/uploads
mkdir -p /var/lib/diaspora/tmp
mkdir -p /var/run/diaspora
mkdir -p /etc/diaspora
bundle='/usr/lib/diaspora-bundle'
[ "$(arch | tr -d '\n')" = 'x86_64' ] && \
bundle='/usr/lib64/diaspora-bundle'
ln -sf /var/log/diaspora ./master/log
cp master/config/app_config.yml.example /etc/diaspora/app_config.yml
ln -sf /etc/diaspora/app_config.yml master/config/app_config.yml
ln -sf /var/lib/diaspora/uploads master/public/
ln -sf /var/lib/diaspora/tmp master
rm -rf master/vendor
ln -sf $bundle/vendor master/vendor
ln -sf $bundle/Gemfile master/Gemfile
ln -sf $bundle/Gemfile.lock master/Gemfile.lock
rm -rf /usr/share/doc/diaspora
mkdir -p /usr/share/doc/diaspora
mv AUTHORS README.md GNU-AGPL-3.0 COPYRIGHT /usr/share/doc/diaspora
find ./ -print | xargs chown root:root
rm -rf /usr/share/doc/diaspora
mkdir /usr/share/doc/diaspora
chown diaspora:diaspora /usr/share/diaspora/master/config.ru
chown diaspora:diaspora /usr/share/diaspora/master/config/environment.rb
chown diaspora:diaspora /var/log/diaspora
chown diaspora:diaspora /var/lib/diaspora/uploads
chown diaspora:diaspora /var/lib/diaspora/tmp
chown diaspora:diaspora /var/lib/diaspora
chown diaspora:diaspora /var/run/diaspora
chown diaspora:diaspora /usr/share/diaspora/master/pkg/ubuntu/dist

View file

@ -1,30 +0,0 @@
#!/bin/bash
#
# Install diaspora dependencies i. e., what apt-get will do
#
grep -v '^#' /etc/apt/sources.list | grep -q universe || {
cat <<- EOF
"Warning: it looks like you have not enabled universe in your
/etc/apt/sources.list. Most likely, this means trouble.
But I will try anyway.
EOF
sleep 2
}
release=$( lsb_release -a | awk '/Release:/ {print $2}')
sudo apt-get update
sudo apt-get install --no-install-recommends -qy\
build-essential libxslt1-dev libxml2 \
ruby-full mongodb rake python-software-properties git-core \
imagemagick libmagick9-dev
if [ "$release" = "10.04" ]; then
# See: https://bugs.launchpad.net/ubuntu/+source/mongodb/+bug/557024
sudo apt-get install xulrunner-1.9
xulversion=$( xulrunner --gre-version)
sudo ln -sf "/usr/lib/xulrunner-$xulversion/libmozjs.so" /usr/lib
fi
sudo add-apt-repository ppa:maco.m/ruby
sudo apt-get update
sudo apt-get install -qy rubygems
sudo gem install bundler --bindir /usr/local/bin

View file

@ -1,12 +0,0 @@
#!/bin/sh
#
# Try to revert to pristine state, deleting all users and
# configuration
#
set -x
service mongodb stop
rm -rf /var/lib/mongodb/*
cp /usr/share/diaspora/master/config/app_config.yml.example \
/usr/share/diaspora/master/config/app_config.yml
service mongodb start

View file

@ -1,81 +0,0 @@
#!/bin/bash
#
# Do what's needed to initiate diaspora.
#
# Usage: sudo diaspora-setup [external hostname]
#
export PATH=$PATH:/usr/local/bin
test "$( perl -e 'print $<')" = "0" || {
echo "You need to be root to do this, giving up"
exit 2
}
arg_hostname="$1"
services=$( netstat -nl | grep '[^:]:3000[ \t]')
test -n "$services" && {
echo "Warning: something is already using port 3000"
echo " $services"
}
service mongodb stop || :
rm -f /var/lib/mongodb/mongod.lock
service mongodb start || :
cd /usr/share/diaspora/master
libdir="/usr/lib"
[[ $(arch) == "x86_64" ]] && libdir="/usr/lib64"
rm -rf vendor
ln -s $libdir/diaspora-bundle/vendor .
ln -sf $libdir/diaspora-bundle/Gemfile .
ln -sf $libdir/diaspora-bundle/Gemfile.lock .
test -e config/app_config.yml ||
cp config/app_config.yml.example config/app_config.yml
mv lib/tasks/jasmine.rake lib/tasks/jasmine.no-rake
if bundle exec rake db:seed:dev; then
echo "Database config OK. Users korth/evankorth, tom/evankorth in place"
else
cat <<- EOF
Database config failed. You might want to
- Just remove the db lock file: rm /var/lib/mongodb/mongod.lock
- Remove all db files: rm -rf /var/lib/mongodb/*
- Reset the config file by
cp config/app_config.yml.example config/app_config.yml
Also, make sure the mongodb server is running e. g., using
'service mongod status'.
EOF
fi
chown -R diaspora /var/log/diaspora
sed -i '/socket_pidfile:/s|:.*|: /var/run/diaspora/diaspora-wsd.pid|' \
config/app_config.yml
hostname=$( awk '/pod_url:/ { print $2; exit }' <config/app_config.yml)
if [ -n "$arg_hostname" ]; then
sed -i "/pod_url:/s|$hostname|$arg_hostname|g" config/app_config.yml &&
echo "config/app_config.yml updated."
exit 0
fi
while : ; do
echo "Current hostname is \"$hostname\""
echo -n "Enter new hostname [$hostname] :"
read new_hostname garbage
echo -n "Use hostname \"$new_hostname\" as pod_url (Yes/No) [Yes]? :"
read yesno garbage
test "${yesno:0:1}" = 'y' -o "${yesno:0:1}" = 'Y' -o -z "$yesno" && {
sed -i "/pod_url:/s|$hostname|$new_hostname|g" config/app_config.yml &&
echo "config/app_config.yml updated."
break
}
done

View file

@ -1,17 +0,0 @@
# Ubuntu upstart file at /etc/init/diaspora-wsd.conf
start on runlevel [5]
stop on runlevel [06]
script
if [ -f /etc/default/diaspora ]; then
. /etc/default/diaspora;
fi;
cd /usr/share/diaspora/master;
start-stop-daemon --start \
--chuid diaspora:diaspora \
--chdir $PWD \
--exec "/usr/local/bin/bundle" \
-- exec ruby -C $PWD script/websocket_server.rb;
end script

View file

@ -1,13 +0,0 @@
/var/log/diaspora/*.log {
create 755 diaspora diaspora
weekly
rotate 10
copytruncate
delaycompress
compress
notifempty
missingok
postrotate
( /sbin/service diaspora-wsd condrestart ) >/dev/null 2>&1
endscript
}

View file

@ -1 +0,0 @@
../source/dist/