From 5b6743d677da44209555f70451e3cca55ed98273 Mon Sep 17 00:00:00 2001 From: Alec Leamas Date: Fri, 29 Oct 2010 15:39:58 +0200 Subject: [PATCH] Bugfixes, non-interactive run possible Closes remarks in tickets 436 and 437. Still has a nasty bug 440. A little hesitant to remove the editor invocation for setting up config file. This is still possible while using parameters for non-interactive runs. But I was lazy, took the existing code, which is a little simpler although much less powerful for user. --- pkg/ubuntu-setup.bash | 68 ++++++++++++++++++++++++++++++------------- 1 file changed, 47 insertions(+), 21 deletions(-) diff --git a/pkg/ubuntu-setup.bash b/pkg/ubuntu-setup.bash index cbf42c60a..55ec1d2b7 100755 --- a/pkg/ubuntu-setup.bash +++ b/pkg/ubuntu-setup.bash @@ -8,22 +8,25 @@ # licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. -# USAGE: ./script/ubuntu-setup.bash + +# USAGE: ./pkg/ubuntu-setup.bash [external hostname] # Do NOT run this script as root. +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 +[[ "$(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 +# Check if universal repository is enabled grep -ie '^deb .*universe' /etc/apt/sources.list > /dev/null || \ { echo "Please enable universe repository" ; exit 1 ; } @@ -63,8 +66,8 @@ then then echo "Lanchpad bug https://bugs.launchpad.net/ubuntu/+source/mongodb/+bug/557024 has not been fixed using workaround:" - echo "sudo ln -s /usr/lib/xulrunner-1.9.2.10/libmozjs.so /usr/lib/libmozjs.so" - sudo ln -s /usr/lib/xulrunner-1.9.2.10/libmozjs.so /usr/lib/libmozjs.so + 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 @@ -101,13 +104,13 @@ echo "Fetching and installing ruby gems.." if [ $RELEASE == "maverick" ] then sudo apt-get install --no-install-recommends -y rubygems - sudo ln -s /var/lib/gems/1.8/bin/bundle /usr/local/bin/bundle #for PATH + 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 -s /var/lib/gems/1.8/bin/bundle /usr/local/bin/bundle #for PATH + sudo ln -sf /var/lib/gems/1.8/bin/bundle /usr/local/bin/bundle #for PATH else # Old version echo "." @@ -147,26 +150,49 @@ echo "Installed bundler.." #Configure diaspora cp config/app_config.yml.example config/app_config.yml - echo "You need to configure diaspora to tell it which URL it has. -Opening editor in 5 seconds and then continuing with install." - sleep 5 - #ensure EDITOR is set - if [ -z "${EDITOR}"] - then - EDITOR=vi + hostname=$( awk '/pod_url:/ { print $2; exit }' tom and password -> evankorth. -More details ./diaspora/db/seeds/tom.rb." + echo "Setting up DB..." + if rake db:seed:dev ; then + cat <<- EOF + DB ready. Login -> tom and 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" - bundle exec thin start + script/server )