- #!/bin/bash -ex
- # Set Hostname
- HOSTNAME=booktype
- echo "$HOSTNAME" > /etc/hostname
- sed -i "s|127.0.1.1 \(.*\)|127.0.1.1 $HOSTNAME|" /etc/hosts
- apt-get update
- DEBIAN_FRONTEND=noninteractive apt-get -y \
- -o DPkg::Options::=--force-confdef \
- -o DPkg::Options::=--force-confold \
- install libapache2-mod-wsgi
python-dev libxml2-dev libxslt-dev python-django build-essential
python-psycopg2 git-core python-setuptools redis-server - easy_install simplejson
- easy_install South
- easy_install pip
- pip install unidecode
- pip install pil
- ./Booktype/scripts/createbooki --database sqlite /var/www/mybooktype/
- cd /var/www/mybooktype
- . ./booki.env
- django-admin syncdb --noinput
- django-admin migrate
- django-admin loaddata documentation_licenses
- ###############
- #This interactive step needs to be automated
- #Ideally, on install of the patched ISO, user is prompted for
- #root, postgres, and django passwords
- ###############
- django-admin createsuperuser
- ###############
- #django-admin runserver 0.0.0.0:8080
- ##
- #Create a startup script to manage the service in init.d
- #Or rely on Apache2
- ###############
- # When adapted for LAPP, Add DB User
- #su -c - postgres "createuser -s booktype" && true
- #### Create Fresh Postgre DB
- #### ensure no active connections to old one
- #service apache2 stop
- #su -c - postgres "dropdb booktype" && true
- #su -c - postgres "createdb -O booktype booktype"
- #su -c - postgres "createlang plpgsql -d booktype"
# Add Role Password
#if [ ! -e "$TMP_DIR/booktype.sql" ]; then
#cat < "$TMP_DIR/booktype.sql"
#ALTER ROLE booktype WITH PASSWORD 'booktype';
#EOF
#fi
#su -c - postgres "psql -d booktype -f '$TMP_DIR/booktype.sql'"