Commit 692651c0a6c0bdcf6c0134bd69a66ecbcd3bf1ff

Authored by Joenio Costa
1 parent b6c5e7ac

fix quick-install to run on a clean system

* add new dependency for java
* add /var/lib/gems to the PATH variable
* check for --force-install before create database
* do not try create database if database.yml already exists

(ActionItem2949)
script/install-dependencies/debian-squeeze.sh
1 # needed to run noosfero 1 # needed to run noosfero
2 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') 2 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')
  3 +run sudo apt-get update
3 run sudo apt-get -y install $runtime_dependencies 4 run sudo apt-get -y install $runtime_dependencies
4 sudo apt-get -y install iceweasel || sudo apt-get -y install firefox 5 sudo apt-get -y install iceweasel || sudo apt-get -y install firefox
5 6
6 # needed for development 7 # needed for development
7 -run sudo apt-get -y install libtidy-ruby libhpricot-ruby libmocha-ruby imagemagick po4a xvfb libxml2-dev libxslt-dev postgresql 8 +run sudo apt-get -y install libtidy-ruby libhpricot-ruby libmocha-ruby imagemagick po4a xvfb libxml2-dev libxslt-dev postgresql openjdk-6-jre
8 gem which bundler >/dev/null 2>&1 || gem_install bundler 9 gem which bundler >/dev/null 2>&1 || gem_install bundler
9 setup_rubygems_path 10 setup_rubygems_path
10 run bundle install 11 run bundle install
script/quick-start
@@ -30,6 +30,10 @@ gem_install() { @@ -30,6 +30,10 @@ gem_install() {
30 } 30 }
31 31
32 setup_rubygems_path() { 32 setup_rubygems_path() {
  33 + local dir="$(ruby -rubygems -e 'puts Gem.dir')/bin"
  34 + if [ -d "$dir" ]; then
  35 + export PATH="$dir:$PATH"
  36 + fi
33 local dir="$(ruby -rubygems -e 'puts Gem.user_dir')/bin" 37 local dir="$(ruby -rubygems -e 'puts Gem.user_dir')/bin"
34 if [ -d "$dir" ]; then 38 if [ -d "$dir" ]; then
35 export PATH="$dir:$PATH" 39 export PATH="$dir:$PATH"
@@ -67,25 +71,16 @@ else @@ -67,25 +71,16 @@ else
67 fi 71 fi
68 72
69 # create the database with sample data 73 # create the database with sample data
70 -if test -e config/database.yml; then 74 +if test -e config/database.yml && test "$force_install" = 'false'; then
71 say 'Not updating existent database.yml.' 75 say 'Not updating existent database.yml.'
72 say 'If you wish to automatic reconfigure your database connection, you can delete config/database.yml and run this script again.' 76 say 'If you wish to automatic reconfigure your database connection, you can delete config/database.yml and run this script again.'
73 else 77 else
74 say 'Configuring Noosfero to use PostgreSQL, with your user.' 78 say 'Configuring Noosfero to use PostgreSQL, with your user.'
75 run cp config/database.yml.pgsql config/database.yml 79 run cp config/database.yml.pgsql config/database.yml
76 sed -ri "s/username: noosfero/username: $USER/" config/database.yml 80 sed -ri "s/username: noosfero/username: $USER/" config/database.yml
77 - sudo -u postgres createuser $USER --no-superuser --createdb --no-createrole  
78 -fi  
79 -DB_USER="$(  
80 - grep username: config/database.yml | head -n1 | sed -r 's/.*:\s*([^ ]+).*/\1/'  
81 -)"  
82 -if test -n "$DB_USER"; then  
83 - say "DB user: $DB_USER"  
84 -else  
85 - say 'It looks like your database.yml have no user defined'  
86 - DB_USER=$USER 81 + sudo su - postgres -c "createuser $USER --no-superuser --createdb --no-createrole"
  82 + sudo su - postgres -c "createdb noosfero_development -O $USER"
87 fi 83 fi
88 -sudo -u postgres createdb noosfero_development -O $DB_USER  
89 run rake db:schema:load 84 run rake db:schema:load
90 run rake db:data:minimal 85 run rake db:data:minimal
91 run rake db:test:prepare 86 run rake db:test:prepare