From 43db02b7d0c2f57086fa22cbeaac4e178a6fa36b Mon Sep 17 00:00:00 2001 From: albert Date: Wed, 24 Aug 2011 17:04:26 -0400 Subject: [PATCH] script fixes --- INSTALL.debian | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/INSTALL.debian b/INSTALL.debian index 677e65499..e015cc11c 100644 --- a/INSTALL.debian +++ b/INSTALL.debian @@ -1,6 +1,6 @@ #!/bin/bash -if [[ "$(whoami)" != "root" ] ; then +if [[ "$(whoami)" != "root" ]] ; then echo "You must run this script as root" exit 1 fi @@ -36,7 +36,8 @@ apt-get -y install build-essential automake openssl libssl-dev libyaml-dev libxm apt-get -y install python-software-properties add-apt-repository ppa:pitti/postgresql apt-get update -apt-get install postgresql-9.1 libpq-dev +apt-get install -y postgresql-9.1 libpq-dev +POSTGRESQL_EXIT=$? # Install RVM echo "Installing RVM..." @@ -52,6 +53,7 @@ gem install --no-ri --no-rdoc capistrano # Install Passenger gem install --no-ri --no-rdoc -v 3.0.8 passenger rvm exec passenger-install-nginx-module +RVM_EXIT=$? # Setup nginx curl -s https://raw.github.com/ascarter/nginx-ubuntu-rvm/master/nginx > /etc/init.d/nginx @@ -60,15 +62,25 @@ update-rc.d -f nginx defaults mkdir -p /opt/nginx/sites curl -s https://raw.github.com/r888888888/danbooru/master/script/install/nginx.conf > /opt/nginx/conf/nginx.conf curl -s https://raw.github.com/r888888888/danbooru/master/script/install/nginx.danbooru.conf > /opt/nginx/conf/sites/danbooru.conf -/etc/init.d/nginx start + +if [ $RVM_EXIT -ne 0 ] ; then + echo "Passenger installation failed; not starting nginx" +else + /etc/init.d/nginx start +fi # Create user account # useradd -m danbooru PG_HBA_FILE="/etc/postgresql/9.1/main/pg_hba.conf" echo "local all postgres,danbooru trust" > $PG_HBA_FILE echo "host all postgres,danbooru 127.0.0.1/32 trust" >> $PG_HBA_FILE -/etc/init.d/postgresql-9.1 restart -sudo -u postgres createuser -s danbooru + +if [ $POSTGRESQL_EXIT -ne 0 ]; then + echo "PostgreSQL installation failed; not starting server" +else + /etc/init.d/postgresql-9.1 restart + sudo -u postgres createuser -s danbooru +fi echo echo "I'm done!"