From b0b917fd6f200c96be643a456a6a13e6a3af116e Mon Sep 17 00:00:00 2001 From: Alec Leamas Date: Mon, 1 Nov 2010 06:59:41 +0100 Subject: [PATCH] pkg bugfixes --- pkg/bootstrap-fedora-diaspora.sh | 73 ++++++++++++++++++++------------ pkg/fedora/prepare-rpm.sh | 6 ++- pkg/source/dist/.gitkeep | 0 3 files changed, 50 insertions(+), 29 deletions(-) create mode 100644 pkg/source/dist/.gitkeep diff --git a/pkg/bootstrap-fedora-diaspora.sh b/pkg/bootstrap-fedora-diaspora.sh index 41d317a34..a8a7c2f41 100755 --- a/pkg/bootstrap-fedora-diaspora.sh +++ b/pkg/bootstrap-fedora-diaspora.sh @@ -2,21 +2,42 @@ # # Install diaspora, its dependencies and start. # -# Usage: bootstrap-fedora-diaspora.sh [external hostname] +# 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 + GIT_REPO='git@github.com:leamas/diaspora.git' -DIASPORA_HOSTNAME='mumin.dnsalias.net' +DIASPORA_HOSTNAME=${1:-'mumin.dnsalias.net'} test $UID = "0" || { echo "You need to be root to do this, giving up" exit 2 } -yum install -y git bison svn autoconf sqlite-devel gcc-c++ patch \ +[[ -d config && -d script ]] || { + echo Error: "this is not a diaspora base directory" + exit 3 +} +yum install -y git bison svn sqlite-devel gcc-c++ patch \ readline-devel zlib-devel libyaml-devel libffi-devel \ - ImageMagick git rubygems libxslt-devel libxml2-devel \ - openssl-devel mongodb-server wget openssh-clients + ImageMagick rubygems libxslt-devel libxml2-devel \ + openssl-devel mongodb-server wget openssh-clients \ + make autoconf automake getent group diaspora >/dev/null || groupadd diaspora getent passwd diaspora >/dev/null || { @@ -24,10 +45,27 @@ getent passwd diaspora >/dev/null || { echo "Created user diaspora" } -su - diaspora < .ssh/config - chmod 600 .ssh/config -} - ruby=\$(which ruby) || ruby="" if [[ -z "\$ruby" || ("\${ruby:0:4}" == "/usr") ]]; then @@ -64,22 +96,8 @@ if [[ -z "\$ruby" || ("\${ruby:0:4}" == "/usr") ]]; then gem install bundler fi -echo '### Clone diapora, install bundle. ###' -rm -rf diaspora -git clone $GIT_REPO -cd diaspora -echo "PWD: \$PWD" -echo "pkg: \$(ls pkg)" -echo "source: \$(ls pkg/source)" -source pkg/source/funcs.sh bundle install -#Configure diaspora - -cp config/app_config.yml.example config/app_config.yml -init_appconfig config/app_config.yml "$DIASPORA_HOSTNAME" - -# Install DB setup echo "Setting up DB..." if bundle exec rake db:seed:dev ; then cat <<- EOM @@ -96,7 +114,6 @@ else EOM fi -# Run appserver echo "Starting server" script/server diff --git a/pkg/fedora/prepare-rpm.sh b/pkg/fedora/prepare-rpm.sh index 5d03f8328..908c1844a 100755 --- a/pkg/fedora/prepare-rpm.sh +++ b/pkg/fedora/prepare-rpm.sh @@ -128,6 +128,8 @@ function usage() -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. @@ -140,7 +142,7 @@ function usage() commit='HEAD' BUNDLE_FIX='no' -while getopts ":r:h" opt +while getopts ":r:u:h" opt do case $opt in r) RELEASE="$OPTARG:" @@ -148,6 +150,8 @@ do h) usage exit 0 ;; + u) GIT_REPO="$OPTARG" + ;; *) usage exit 2 ;; diff --git a/pkg/source/dist/.gitkeep b/pkg/source/dist/.gitkeep new file mode 100644 index 000000000..e69de29bb