From 149b1d38feb3a46e49479a47b90983a2fec2f27f Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Fri, 24 Aug 2012 16:27:38 -0300 Subject: [PATCH] Enhanced quick-script while boostrapping an empty system --- script/install-dependencies/debian-squeeze.sh | 5 +++-- script/quick-start | 28 +++++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/script/install-dependencies/debian-squeeze.sh b/script/install-dependencies/debian-squeeze.sh index 2183c53..921a13b 100644 --- a/script/install-dependencies/debian-squeeze.sh +++ b/script/install-dependencies/debian-squeeze.sh @@ -1,9 +1,10 @@ # needed to run noosfero runtime_dependencies=$(sed -e '1,/^Depends:/d; /^Recommends:/,$ d; s/([^)]*)//g; s/,\s*/\n/g' debian/control | grep -v 'memcached\|debconf\|dbconfig-common\|postgresql\|misc:Depends\|adduser\|mail-transport-agent') run sudo apt-get -y install $runtime_dependencies +sudo apt-get -y install iceweasel || sudo apt-get -y install firefox # needed for development run sudo apt-get -y install libtidy-ruby libhpricot-ruby libmocha-ruby imagemagick po4a xvfb libxml2-dev libxslt-dev -gem which bundler >/dev/null 2>&1 || run gem install bundler -which bundle >/dev/null 2>&1 || export PATH="$(ruby -rubygems -e 'puts Gem.bindir'):$PATH" +gem which bundler >/dev/null 2>&1 || gem_install bundler +setup_rubygems_path run bundle install diff --git a/script/quick-start b/script/quick-start index 1078f66..3c50bbc 100755 --- a/script/quick-start +++ b/script/quick-start @@ -21,6 +21,22 @@ run() { fi } +gem_install() { + if [ -w "$(ruby -rubygems -e 'puts Gem.dir')" ]; then + run gem install $@ + else + run gem install --user-install $@ + fi +} + +setup_rubygems_path() { + local dir="$(ruby -rubygems -e 'puts Gem.user_dir')/bin" + if [ -d "$dir" ]; then + export PATH="$dir:$PATH" + fi +} + + force_install=false if test "$1" = '--force-install'; then force_install=true @@ -28,9 +44,15 @@ fi if gem which system_timer >/dev/null 2>&1 && which xvfb-run >/dev/null 2>&1 && test "$force_install" = 'false'; then say "Assuming dependencies are already installed. Pass --force-install to force their installation" else - if !which lsb_release >/dev/null 2>&1; then - complain "E: lsb_release not available! (Try installing the lsb-release package)" - exit 1 + if ! which lsb_release >/dev/null 2>&1; then + # special case Debian-based systems; in others people will have to install + # lsb-release by themselves + if which apt-get >/dev/null 2>&1; then + sudo apt-get -y install lsb-release + else + complain "E: lsb_release not available! (Try installing the lsb-release package)" + exit 1 + fi fi system=$(echo $(lsb_release -sic) | awk '{print(tolower($1) "-" tolower($2))}') install_script="$(dirname $0)/install-dependencies/${system}.sh" -- libgit2 0.21.2