Merge branch 'master' of github.com:diaspora/diaspora

This commit is contained in:
Raphael 2010-11-01 11:59:10 -07:00
commit 354f6d13c2
18 changed files with 641 additions and 352 deletions

View file

@ -8,6 +8,7 @@ sv:
errors:
messages:
not_found: "kan ej hitta"
already_confirmed: "är redan bekräftad"
not_locked: "var ej låst"
devise:
@ -15,11 +16,16 @@ sv:
unauthenticated: 'Du måste logga in innan du kan fortsätta.'
unconfirmed: 'Du måste verifiera ditt konto innan du kan fortsätta.'
locked: 'Ditt konto är låst.'
invalid: 'Felaktig användare eller lösenord.'
invalid: 'Felaktigt användarnamn eller lösenord.'
invalid_token: 'Ogiltig identifiering.'
timeout: 'Din session är avslutad, var vänlig logga in igen.'
inactive: 'Ditt konto är inte aktiverat.'
sessions:
new:
login: 'Logga in'
username: 'Användarnamn'
password: 'Lösenord'
sign_in: 'Logga in'
signed_in: 'Inloggning ok.'
signed_out: 'Utloggning ok.'
passwords:
@ -40,6 +46,16 @@ sv:
invitation_token_invalid: 'Denna inbjudan är ej giltig!'
updated: 'Ditt lösenord är nu inställt och du är inloggad.'
mailer:
confirmation_instructions: 'Instruktioner för att verifiera ditt konto.'
reset_password_instructions: 'Instruktioner för att återställa ditt lösenord.'
unlock_instructions: 'Instruktioner för att låsa upp ditt konto.'
confirmation_instructions:
subject: 'Instruktioner för att verifiera ditt konto.'
reset_password_instructions:
subject: 'Instruktioner för att återställa ditt lösenord.'
unlock_instructions:
subject: 'Instruktioner för att låsa upp ditt konto.'
invitation:
subject: 'En vän vill att du ska gå med i Diaspora!'
shared:
links:
sign_in: 'Logga in'
sign_up: 'Registrera dig'
forgot_your_password: 'Glömt ditt lösenord?'

View file

@ -27,6 +27,8 @@ sv:
models:
user:
attributes:
person:
invalid: "är ogiltigt"
username:
taken: "är redan taget"
email:
@ -35,7 +37,6 @@ sv:
attributes:
diaspora_handle:
taken: "är redan taget"
hello: "Hej världen!"
application:
helper:
@ -54,7 +55,10 @@ sv:
people_on_pod_are_aware_of: " personer på denna plats är medvetna om att"
layouts:
application:
view_profile: "visa profil"
edit_profile: "ändra profil"
account_settings: "kontoinstallningar"
search: "Search"
logout: "logga ut"
shared:
aspect_nav:
@ -81,8 +85,10 @@ sv:
updated: "uppdaterad"
by: "av"
edit:
album_name: "Namn på fotoalbum"
editing: "Ändrar"
updated: "uppdaterad"
update_album: "Uppdatera fotoalbum"
are_you_sure: "Är du säker?"
delete_album: "Ta bort fotoalbum"
cancel: "Avbryt"
@ -117,6 +123,7 @@ sv:
ignore_remove: "Ignorera/Ta bort"
new_aspect:
add_a_new_aspect: "Lägg till ny sida"
name: "Namn"
create: "Skapa"
create:
success: "Klicka på plustecknet till höger för att välja vilka som kan se din nya sida."
@ -137,19 +144,26 @@ sv:
users:
edit:
editing_profile: "Ändrar profil"
profile:
invite_friends: "Bjud in en vän"
are_you_sure: "Är du säker?"
export_data: "Exportera data"
close_account: "Stäng kontot"
change_language: "Ändra språk"
change_password: "Ändra lösenord"
new_password: "Nytt lösenord"
password_confirmation: "Bekräfta lösenord"
settings: "Inställningar"
profile: "Profil"
account: "Konto"
services: "Tjänster"
cancel: "Avbryt"
update_profile: "Uppdatera Profil"
home: "Hem"
diaspora_username: "Diaspora-användarnamn:"
info: "Info"
picture: "Profilbild"
editing_profile: "Ändrar profil"
albums: "Album"
you_dont_have_any_photos: "Du har inga foton! Gå till"
page_to_upload_some: "sidan för att ladda upp några."
or: "eller"
destroy: "Ditt konto är nu stängt."
getting_started:
'step_1':
albums: "Fotoalbum"
you_dont_have_any_photos: "Du har inga foton! Gå till"
page_to_upload_some: "sidan för att ladda upp några."
or: "eller"
comments:
comment:
ago: "sedan"
@ -189,6 +203,13 @@ sv:
registrations:
new:
sign_up: "Registrera dig"
sign_up_for_diaspora: "Gå med i Diaspora"
upload_existing_account: "Ladda upp ett befintligt Diaspora-konto"
upload: "Ladda upp"
username: "Användarnamn"
email: "E-post address"
password: "Lösenord"
password_confirmation: "Bekräfta lösenord"
create:
success: "Du har nu gått med i Diaspora!"
invitations:
@ -232,10 +253,6 @@ sv:
new:
new_person: "Ny person"
back_to_list: "Tillbaka till listan"
edit:
cancel: "Avbryt"
or: "eller"
update_profile: "Uppdatera profil"
show:
last_seen: "senast sedd: %{how_long_ago}"
friends_since: "vänner sedan: %{how_long_ago}"
@ -243,12 +260,39 @@ sv:
are_you_sure: "Är du säker?"
remove_friend: "ta bort vän"
no_posts: "ingenting att visa!"
add_friend: "lägg till en vän"
edit:
settings: "Inställningar"
your_profile: "Din profil"
your_name: "Ditt namn"
first_name: "Förnamn"
last_name: "Efternamn"
your_gender: "Ditt kön"
your_birthday: "Din födelsedag"
your_bio: "Din biografi"
fill_me_out: "Fyll i mig"
your_photo: "Ditt foto"
profile: "Profil"
account: "Konto"
services: "Tjänster"
cancel: "Avbryt"
update_profile: "Uppdatera profil"
home: "Hem"
diaspora_username: "Användarnamn:"
info: "Info"
picture: "Foto"
editing_profile: "Ändrar profil"
albums: "Fotoalbum"
you_dont_have_any_photos: "Du har inga foton! Gå till"
page_to_upload_some: "sidan för att ladda upp några."
or: "eller"
requests:
new_request:
add_a_new_friend_to: "Lägg till en vän till"
enter_a_diaspora_username: "Ange ett användarnamn:"
your_diaspora_username_is: "Din Diaspora-adress är: %{diaspora_handle}"
friends_username: "Vännens Diaspora-adress"
create_request: "Skapa förfrågan"
destroy:
success: "Ni är nu vänner."
error: "Var god välj en aspekt!"
@ -261,6 +305,12 @@ sv:
already_friends: "Du är redan vän med %{destination_url}!"
success: "En vänförfrågan har skickats till %{destination_url}."
horribly_wrong: "Nu gick något rejält fel här."
services:
index:
settings: "Inställningar"
profile: "Profil"
account: "Konto"
services: "Tjänster"
# The following is from the rails-i18n project at http://github.com/svenfuchs/rails-i18n

2
pkg/.gitignore vendored Normal file
View file

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

13
pkg/README.md Normal file
View file

@ -0,0 +1,13 @@
## 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.
- 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,48 +1,124 @@
#!/bin/bash
#
# Install diaspora, its dependencies and start.
#
# Usage: pkg/bootstrap-fedora-diaspora.sh [external hostname]
#
# Synopsis:
#
# $ git clone git@github.com:diaspora/diaspora.git
# $ cd diaspora
# $ sudo pkg/bootstrap-rffedora-diaspora.sh
#
# 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.
# user.
#
# Must run as root
export DIASPORADIR=`pwd`
GIT_REPO='git@github.com:leamas/diaspora.git'
DIASPORA_HOSTNAME=${1:-'mumin.dnsalias.net'}
echo "####"
echo "Installing build deps ..."
echo "####"
sleep 3
su -c "yum install git bison svn autoconf sqlite-devel gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel ImageMagick git rubygems libxslt libxslt-devel libxml2 libxml2-devel openssl-devel"
test $UID = "0" || {
echo "You need to be root to do this, giving up"
exit 2
}
echo "####"
echo "Installing RVM ..."
echo "####"
sleep 3
[[ -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
mkdir -p ~/.rvm/src/ && cd ~/.rvm/src && rm -rf ./rvm/ && git clone --depth 1 git://github.com/wayneeseguin/rvm.git && cd rvm && ./install
getent group diaspora >/dev/null || groupadd diaspora
getent passwd diaspora >/dev/null || {
useradd -g diaspora -s /bin/bash -m diaspora
echo "Created user diaspora"
}
echo "####"
echo "Installing RVM into bashrc and sourcing bash ..."
echo "####"
sleep 3
home=$( getent passwd diaspora | cut -d: -f6)
[ -e $home/diaspora ] && {
echo "Moving existing $home/diaspora out of the way"
mv $home/diaspora $home/diaspora.$$
}
mkdir $home/diaspora
cp -ar * $home/diaspora
chown -R diaspora $home/diaspora
if [[ `grep -l "rvm/scripts/rvm" $HOME/.bashrc | wc -l` -eq 0 ]]; then
echo 'if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then source "$HOME/.rvm/scripts/rvm" ; fi' >> $HOME/.bashrc
service mongod start
su - diaspora << EOF
#set -x
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
source $HOME/.bashrc
echo "####"
echo "Installing ruby (will take forever) ..."
echo "####"
sleep 3
bundle install
rvm install ruby-1.8.7-p302
rvm --default ruby-1.8.7
#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 "####"
echo "Installing bundler ..."
echo "####"
sleep 3
gem install bundler
echo "Setting up DB..."
if bundle exec rake db:seed:dev ; then
cat <<- EOM
DB ready. Login -> tom and 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
EOF
echo "####"
echo "Installing deps with bundle ..."
echo "####"
sleep 3
pushd $DIASPORADIR && bundle install && popd

View file

@ -1,13 +1,12 @@
## Diaspora RPM tools
Creates diaspora source tarballs and RPM packages
Create RPM packages
An alternative to the capistrano system, providing classic, binary RPM
packages for deployment on Fedora 13 and OS-independent source tarballs
aimed for packaging purposes.
packages for deployment on Fedora.
#### Fedora RPM synopsis
#### Synopsis
Prerequisites:
@ -18,16 +17,20 @@ Prerequisites:
- 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++ (unnecessary?):
Install g++ and gcc:
% yum install gcc-c++
Create source tarballs like dist/diaspora-0.0-1010041233_fade4231.tar.gz
and dist/diaspora-bundle-0.0-1010041233_fade4231.tar.gz:
% ./make-dist.sh source
% ./make-dist.sh bundle
Bootstrap the distribution from git:
% sudo apt-get install git-core
% git clone git://github.com/diaspora/diaspora.git
% cd diaspora/pkg/ubuntu
Setup links to tarballs from RPM source directory and create spec files:
% ./make-dist.sh prepare
Create and install the diaspora bundle and application in
diaspora/pkg/source according to
[source README](http://github.com/diaspora/diaspora/blob/master/source/fedora/README.md)
Setup links from tarballs to RPM source directory and create spec files:
% ./prepare-rpm.sh
Build rpms:
rpmbuild -ba dist/diaspora.spec
@ -51,6 +54,10 @@ apache/passenger setup. After configuration, start with:
/sbin/service diaspora-wsd start
/sbin/service httpd restart
<<<<<<< HEAD
prepare-rpm.sh prepare creates links also for all files listed in SOURCES.
Typically, this is secondary sources. *make-dist.sh source*
#### Generic source synopsis
Generate source tarball:
@ -85,41 +92,20 @@ 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 vendor/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
*make-dist prepare* creates links also for all files listed in SOURCES.
Typically, this is secondary sources. *make-dist.sh sources*
prepare-rpm.sh prepare creates links also for all files listed in SOURCES.
Typically, this is secondary sources. *make-dist.sh source*
applies all patches named *.patch in this directory after checking out
source from git.
The spec-files in dist/ are patched by *./make-dist.sh prepare* to reference
The spec-files in dist/ are patched by *./prepare-rpm.sh to reference
correct versions of diaspora and diaspora-bundle. The diaspora-bundle
is only updated if Gemfile is updated, upgrading diaspora doesn't
always require a new diaspora-bundle. Editing spec files should be done
in this directory, changes in dist/ are lost when doing *./make-dist prepare*.
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 by *make-dist source*. Write the comment in this
directory, copy-paste previous version nr. It will be updated.
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
@ -128,17 +114,6 @@ at [ftp://mumin.dnsalias.net/pub/leamas/diaspora/builds](ftp://mumin.dnsalias.ne
#### 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.
Here is also support for running the diaspora websocket service as a system
service through /sbin/service and some install scripts.
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

169
pkg/fedora/prepare-rpm.sh Executable file
View file

@ -0,0 +1,169 @@
#!/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

74
pkg/source/README.md Normal file
View file

@ -0,0 +1,74 @@
## 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.

108
pkg/source/funcs.sh Normal file
View file

@ -0,0 +1,108 @@
#
# 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,180 +1,13 @@
#!/bin/bash
# Create a diaspora distribution
# Create diaspora distribution tarballs.
#
# Usage: See function usage() at bottom.
#
GIT_REPO='http://github.com/diaspora/diaspora.git'
VERSION='0.0'
RELEASE='1'
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 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 checkout()
# Checkout last version of diaspora unless it's already there.
# 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 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 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)"
}
. ./funcs.sh
function build_git_gems()
# Usage: build_git_gems <Gemfile> <tmpdir> <gemdir>
@ -213,6 +46,38 @@ function build_git_gems()
# 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
@ -238,6 +103,7 @@ function make_docs()
}
function make_bundle()
# Create the bundle tarball
# Usage: make_bundle [ commit, defaults to HEAD]
@ -280,6 +146,7 @@ function make_bundle()
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
@ -289,65 +156,16 @@ function make_bundle()
echo "Bundle: dist/$bundle_name.tar.gz"
}
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: make-dist [options] <dist|bundle|prepare>
Usage: make-dist [options] <dist|bundle>
Options:
-h Print this message.
-c commit Use a given commit, defaults to last checked in.
-r release For prepare, mark with release nr, defaults to 1.
-u uri Git repository URI, defaults to
$GIT_REPO.
-f For bundle, fix dependencies by running 'bundle update'
@ -355,8 +173,6 @@ function usage()
source Build a diaspora application tarball.
bundle Build a bundler(1) bundle for diaspora.
prepare Symlink bundle and source tarballs to rpm source dir,
create patched rpm spec files.
All results are stored in dist/
@ -366,15 +182,13 @@ function usage()
commit='HEAD'
BUNDLE_FIX='no'
while getopts ":r:c:u:fh" opt
while getopts ":c:u:fh" opt
do
case $opt in
u) GIT_REPO="$OPTARG"
;;
c) commit="${OPTARG:0:7}"
;;
r) RELEASE="$OPTARG:"
;;
f) BUNDLE_FIX='yes'
;;
h) usage
@ -387,7 +201,7 @@ do
done
shift $(($OPTIND - 1))
typeset -r GIT_REPO RELEASE BUNDLE_FIX
typeset -r GIT_REPO BUNDLE_FIX
export LANG=C
test $# -gt 1 -o $# -eq 0 && {
@ -401,8 +215,6 @@ case $1 in
;;
'source') make_src $commit
;;
'prepare') prepare_rpm $commit $release
;;
*) usage
exit 1
;;

View file

@ -5,23 +5,20 @@ 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/blob/master/source/fedora/README.md)
Install the dependencies (a good time for a coffe break):
% sudo ./diaspora-install-deps
Create and install the diaspora bundle and application:
% ./make-dist.sh bundle
% sudo ./diaspora-bundle-install dist/diaspora-bundle-*.tar.gz
% ./make-dist.sh source
% sudo ./diaspora-install dist/diaspora-0.0*.tar.gz
Initiate and start the server;
Install, initiate and start the server;
% sudo ./diaspora-install
% sudo ./diaspora-setup
% sudo su - diaspora
% cd /usr/share/diaspora/master

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

@ -43,12 +43,20 @@ 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
ln -sf /usr/lib/diaspora-bundle/vendor/bundle master/vendor
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

1
pkg/ubuntu/dist Symbolic link
View file

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

View file

@ -1 +0,0 @@
../fedora/make-dist.sh

View file