summaryrefslogtreecommitdiff
path: root/install
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-05-02 13:39:49 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-05-02 13:39:49 +0200
commit4bed1cae41c8640d847a7aebfe51202fc3755ed9 (patch)
treec843db269c37cec9d0978a4a84ecaee60e02d985 /install
parent8e39428fc22e2be82ddcd66ced3a22f118c7732c (diff)
downloadIshtar-4bed1cae41c8640d847a7aebfe51202fc3755ed9.tar.bz2
Ishtar-4bed1cae41c8640d847a7aebfe51202fc3755ed9.zip
Install script: colors for everybody!
Diffstat (limited to 'install')
-rwxr-xr-xinstall/ishtar-delete-instance17
-rwxr-xr-xinstall/ishtar-install74
-rwxr-xr-xinstall/ishtar-prepare-instance46
3 files changed, 73 insertions, 64 deletions
diff --git a/install/ishtar-delete-instance b/install/ishtar-delete-instance
index 7bd233ff4..f622144fe 100755
--- a/install/ishtar-delete-instance
+++ b/install/ishtar-delete-instance
@@ -47,16 +47,13 @@ do_delete_instance() {
echo "";
exit 1;
fi
-
- cat >&2 <<-'EOF'
-
-*******************************************************************************
-++++++ Ishtar instance deletion script ++++++
-*******************************************************************************
-
- Avalaible instances:
-
-EOF
+ echo ""
+ cecho g "*******************************************************************************"
+ cecho g "++++++ Ishtar instance deletion script ++++++"
+ cecho g "*******************************************************************************"
+ echo ""
+ echo y "Avalaible instances:"
+ echo ""
cat $INSTANCES_FILE
diff --git a/install/ishtar-install b/install/ishtar-install
index 8480fdd5d..1d26e1a7b 100755
--- a/install/ishtar-install
+++ b/install/ishtar-install
@@ -54,13 +54,11 @@ EOF
do_install() {
- cat >&2 <<-'EOF'
-
-*******************************************************************************
-++++++ Ishtar installation script ++++++
-*******************************************************************************
-
-EOF
+ echo ""
+ cecho g "*******************************************************************************"
+ cecho g "++++++ Ishtar installation script ++++++"
+ cecho g "*******************************************************************************"
+ echo ""
# check user
user="$(id -un 2>/dev/null || true)"
@@ -185,7 +183,8 @@ EOF
EOF
while [ "$default_db" == '' ]
do
- read -p '* Default PostgreSQL host? [localhost] ' choice
+ cecho y '* Default PostgreSQL host? [localhost] '
+ read choice
if [ "$choice" == '' ]; then
default_db='127.0.0.1'
elif [ "$choice" == 'localhost' ]; then
@@ -207,7 +206,8 @@ EOF
MSG=""
while [ "$webserver" == '' ]
do
- read -p '* Which webserver do you want to use? ([nginx]/none) ' choice
+ cecho y '* Which webserver do you want to use? ([nginx]/none) '
+ read choice
case "$choice" in
nginx ) webserver="nginx";;
none ) webserver="none";;
@@ -226,7 +226,8 @@ EOF
EOF
while [ "$version" == '' ]
do
- read -p "* Which version would you like to use? ([develop]/master) " choice
+ cecho y "* Which version would you like to use? ([develop]/master) "
+ read choice
case "$choice" in
develop ) version="develop";;
master ) version="master";;
@@ -254,7 +255,8 @@ EOF
EOF
while [ "$install_path" == '' ]
do
- read -p "* Which base install path for Ishtar? [/srv/] " choice
+ cecho y "* Which base install path for Ishtar? [/srv/]"
+ read choice
if [ -z "$choice" ]; then
install_path='/srv'
elif [ ! -d "$choice" ]; then
@@ -274,7 +276,7 @@ EOF
fi
echo ""
- echo "*******************************************************************************"
+ cecho g "*******************************************************************************"
echo ""
# Run setup for each distro accordingly
@@ -287,43 +289,46 @@ EOF
exit 1
fi
+ echo "-------------------------------------------------------------------------------";
+ cecho y "Update debian packages cache";
+ echo "";
export DEBIAN_FRONTEND=noninteractive
( set -x; $sh_c 'sleep 3; apt-get update' )
if ! command_exists git; then
echo "-------------------------------------------------------------------------------";
- echo "Installing git...";
+ cecho y "Installing git...";
echo "";
( set -x; $sh_c 'sleep 3; apt-get install -y -q git' )
fi
if ! command_exists apg; then
echo "-------------------------------------------------------------------------------";
- echo "Installing apg...";
+ cecho y "Installing apg...";
echo "";
( set -x; $sh_c 'sleep 3; apt-get install -y -q apg' )
fi
if ! command_exists pip; then
echo "-------------------------------------------------------------------------------";
- echo "Installing pip...";
+ cecho y "Installing pip...";
echo "";
( set -x; $sh_c 'sleep 3; apt-get install -y -q python-pip' )
fi
if [ "$webserver" == 'nginx' ]; then
echo "-------------------------------------------------------------------------------";
- echo "Installing nginx and uwsgi...";
+ cecho y "Installing nginx and uwsgi...";
echo "";
( set -x; $sh_c 'sleep 3; apt-get install -y -q uwsgi uwsgi-plugin-python nginx' )
fi
- echo "-------------------------------------------------------------------------------";
-
if [ "$dist_version" == "wheezy" ]; then
if [ "$default_db" == '127.0.0.1' ]; then
+ echo "-------------------------------------------------------------------------------";
+ cecho y "Installing postgresql"
POSTGIS=postgresql-9.1-postgis
( set -x; $sh_c 'sleep 3; apt-get install -y -q postgresql '$POSTGIS )
fi
echo "-------------------------------------------------------------------------------";
- echo "Installing Ishtar dependencies"
+ cecho y "Installing Ishtar dependencies"
echo "";
( set -x; $sh_c 'sleep 3; apt-get install -y -q python python-django \
libjs-jquery libjs-jquery-ui python-pisa python-django-registration \
@@ -331,22 +336,23 @@ EOF
python-psycopg2 python-gdal gettext python-unicodecsv memcached \
python-tidylib python-django-extra-views python-memcache python-dbf' )
- echo "Installing BeautifulSoup4"
+ echo "-------------------------------------------------------------------------------";
+ cecho y "Installing BeautifulSoup4"
echo "";
( set -x; $sh_c 'pip install BeautifulSoup4==4.3.2' )
echo "-------------------------------------------------------------------------------";
- echo "Installing django-simple-history"
+ cecho y "Installing django-simple-history"
echo "";
( set -x; $sh_c 'pip install git+https://github.com/treyhunner/django-simple-history.git@0fd9b8e9c6f36b0141367b502420efe92d4e21ce' )
- echo "-------------------------------------------------------------------------------";
fi
if [ "$dist_version" == "jessie" ]; then
if [ "$backports_activated" != 'true' ]; then
echo ""
- cecho p " In order to install Ishtar you have to activate Debian backports. To do that:"
+ cecho r " In order to install Ishtar you have to activate Debian backports."
+ echo " To do that:"
echo ""
echo " echo 'deb http://ftp.debian.org/debian jessie-backports main contrib non-free' >> /etc/apt/sources.list"
echo ""
@@ -355,10 +361,13 @@ EOF
fi
if [ "$default_db" == '127.0.0.1' ]; then
+ echo "-------------------------------------------------------------------------------";
+ cecho y "Installing postgresql"
POSTGIS=postgresql-9.4-postgis-2.3
( set -x; $sh_c 'sleep 3; apt-get install -y -q postgresql '$POSTGIS )
fi
- echo "Installing Ishtar dependencies"
+ echo "-------------------------------------------------------------------------------";
+ cecho y "Installing Ishtar dependencies"
echo "";
( set -x; $sh_c 'sleep 3; apt-get install -t jessie-backports -y -q python python-django\
python-django-registration' )
@@ -367,17 +376,17 @@ EOF
python-tidylib python-lxml python-imaging python-html5lib\
python-psycopg2 python-gdal gettext python-unicodecsv memcached \
python-django-extra-views python-memcache python-dbf python-markdown' )
- echo "Installing django-simple-history"
+ echo "-------------------------------------------------------------------------------";
+ cecho y "Installing django-simple-history"
echo "";
( set -x; $sh_c 'pip install git+https://github.com/treyhunner/django-simple-history.git@1.8.2#egg=django-simple-history' )
- echo "-------------------------------------------------------------------------------";
fi
;;
esac
echo "-------------------------------------------------------------------------------";
- echo "Installing Ishtar sources"
+ cecho y "Installing Ishtar sources"
echo "";
cd $install_path
@@ -395,12 +404,15 @@ EOF
echo "ISHTAR_WEBSERVER="$webserver >> $etc_path"config"
echo "# settings added to all instances" >> $etc_path"extra_settings.py"
echo ""
- echo "*******************************************************************************";
+ cecho g "*******************************************************************************"
echo "";
- cecho g "Installation done. Base configuration stored in "$etc_path"config file."
- cecho g "You can edit "$etc_path"extra_settings.py to add settings to all new instances.";
+ cecho g "Installation done."
+ cecho g "Base configuration stored in: "$etc_path"config"
+ echo ""
+ echo "You can edit "$etc_path"extra_settings.py to add Django settings to all new"
+ echo "instances.";
echo "";
- cecho g "Next you will have to create an instance with ishtar-prepare-instance script."
+ cecho y "Next you will have to create an instance with: ishtar-prepare-instance"
echo "";
}
diff --git a/install/ishtar-prepare-instance b/install/ishtar-prepare-instance
index f9a3153e6..c86c93497 100755
--- a/install/ishtar-prepare-instance
+++ b/install/ishtar-prepare-instance
@@ -29,13 +29,11 @@ do_install_instance() {
PG_VERSION=9.4
POSTGIS_VERSION=2.3.1
- cat >&2 <<-'EOF'
-
-*******************************************************************************
-++++++ Ishtar instance installation script ++++++
-*******************************************************************************
-
-EOF
+ echo ""
+ cecho g "*******************************************************************************"
+ cecho g "++++++ Ishtar instance preparation script ++++++"
+ cecho g "*******************************************************************************"
+ echo ""
# check user
user="$(id -un 2>/dev/null || true)"
@@ -85,7 +83,7 @@ EOF
if [ -z '$INSTANCE' ]; then
if [ -d "$INSTANCE" ]; then
- cecho "Sorry, $INSTANCE already exists."
+ cecho r "Sorry, $INSTANCE already exists."
echo "Give another code name."
exit 1
fi
@@ -103,7 +101,8 @@ EOF
EOF
while [ "$INSTANCE" == '' ]
do
- read -p "* Which instance code name? [my_ishtar_instance] " choice
+ cecho y "* Which instance code name? [my_ishtar_instance] "
+ read choice
if [ -z "$choice" ]; then
INSTANCE='my_ishtar_instance'
else
@@ -129,7 +128,8 @@ EOF
EOF
while [ "$URL" == '' ]
do
- read -p "* Which url? " choice
+ cecho y "* Which url? "
+ read choice
URL=$choice
done
fi
@@ -152,7 +152,7 @@ EOF
chmod g+w "/var/log/django/ishtar-$INSTANCE.log"
- echo " * duplicate example_project into our instance"
+ cecho y " * duplicate example_project into our instance"
# Duplicate example_project into our instance:
cd $ISHTAR_PATH
cp -ra example_project $INSTANCE
@@ -206,7 +206,7 @@ EOF
### LOCAL SETTINGS
- echo " * creating config files"
+ cecho y " * creating config files"
# Set some variables to avoid changing sed calls too much compared to
# the initial install/install.sh script:
INSTALL_PATH=$DEST
@@ -273,14 +273,14 @@ EOF
"$NGINX_ENABLE_PATH/ishtar-$INSTANCE.conf"
- echo " * collect static data"
+ cecho y " * collect static data"
cd $INSTANCE
./manage.py collectstatic --noinput > /dev/null
cd -
# only language available
LOCALE=fr
- echo " * compile translations"
+ cecho y " * compile translations"
for d in archaeological_* ishtar_common; do
cd $d
../$INSTANCE/manage.py compilemessages -l $LOCALE
@@ -289,23 +289,23 @@ EOF
### DB feeding
cd $INSTANCE
- echo " * db feeding"
- echo " - migrations"
+ cecho y " * db feeding"
+ cecho y " - migrations"
./manage.py migrate
- echo " - loading fixtures"
+ cecho y " - loading fixtures"
FIXTURES="$DEST/fixtures/initial_data-auth-fr.json $DEST/ishtar_common/fixtures/initial_data-fr.json $DEST/ishtar_common/fixtures/initial_importtypes-fr.json $DEST/archaeological_operations/fixtures/initial_data-fr.json $DEST/archaeological_context_records/fixtures/initial_data-fr.json $DEST/archaeological_files/fixtures/initial_data-fr.json $DEST/archaeological_finds/fixtures/initial_data-fr.json $DEST/archaeological_warehouse/fixtures/initial_data-fr.json"
for data in $FIXTURES; do
echo $data;
./manage.py loaddata $data;
done
- echo " - create superuser"
+ cecho y " - create superuser"
./manage.py createsuperuser
- echo " - post install script"
+ cecho y " - post install script"
cd ..
- python install/post_install_script.py
+ python ./install/post_install_script.py $INSTANCE $URL
cat >&2 <<-'EOF'
@@ -318,10 +318,10 @@ EOF
cat >&2 <<-'EOF'
You should restart uwsgi and nginx:
- systemctl restart uwsgi nginx
-
- And then enjoy ishtar!
EOF
+ cecho y "systemctl restart uwsgi nginx"
+ echo ""
+ echo "And then enjoy ishtar!"
}
do_install_instance