script fixes

This commit is contained in:
albert
2011-08-24 17:04:26 -04:00
parent 6d022d308a
commit 43db02b7d0

View File

@@ -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!"