diff options
Diffstat (limited to 'install/ishtar-prepare-instance')
| -rwxr-xr-x | install/ishtar-prepare-instance | 38 | 
1 files changed, 27 insertions, 11 deletions
| diff --git a/install/ishtar-prepare-instance b/install/ishtar-prepare-instance index aadb2ce76..33db4de4a 100755 --- a/install/ishtar-prepare-instance +++ b/install/ishtar-prepare-instance @@ -2,6 +2,23 @@  set -e +cecho() { +  local code="\033[" +  case "$1" in +    black  | bk) color="${code}0;30m";; +    red    |  r) color="${code}1;31m";; +    green  |  g) color="${code}1;32m";; +    yellow |  y) color="${code}1;33m";; +    blue   |  b) color="${code}1;34m";; +    purple |  p) color="${code}1;35m";; +    cyan   |  c) color="${code}1;36m";; +    gray   | gr) color="${code}0;37m";; +    *) local text="$1" +  esac +  [ -z "$text" ] && local text="$color$2${code}0m" +  echo "$text" +} +  do_install_instance() {      NGINX_PORT=${NGINX_PORT-80} @@ -30,18 +47,16 @@ EOF          elif command_exists su; then              sh_c='su -c'          else -            cat >&2 <<-'EOF' -  Error: this installer needs the ability to run commands as root. -  We are unable to find either "sudo" or "su" available to make this happen. -EOF +            cecho r "  Error: this installer needs the ability to run commands as root." +            cecho r "  We are unable to find either "sudo" or "su" available to make this happen."              exit 1          fi      fi      export LANG=fr_FR.UTF-8      if [ "$(locale 2>&1 >/dev/null|wc -l)" != 0 ]; then -        echo "Unable to set LANG=$LANG properly" -        echo "Try: 'dpkg-reconfigure locales' or install the 'locales-all' package" +        cecho r "Unable to set LANG=$LANG properly" +        cecho "Try: 'dpkg-reconfigure locales' or install the 'locales-all' package"          exit 1      fi @@ -51,7 +66,7 @@ EOF      if [ ! -f $CONFIG_PATH/config ]; then          echo ""; -        echo ""$CONFIG_PATH" is not a valid config file." +        cecho r ""$CONFIG_PATH" is not a valid config file."          echo "Have you properly install Ishtar sources?"          echo "Run ishtar-install before this script.";          echo ""; @@ -70,7 +85,8 @@ EOF      if [ -z '$INSTANCE' ]; then          if [ -d "$INSTANCE" ]; then -            echo "Sorry, $INSTANCE already exists. Give another name." +            cecho "Sorry, $INSTANCE already exists." +            echo "Give another code name."              exit 1          fi @@ -294,10 +310,10 @@ EOF      cat >&2 <<-'EOF'  ------------------------------------------------------------------------------- -    Your instance has been configured.  EOF -    echo " * instance name: "$INSTANCE -    echo " * url: "$URL +    cecho g "  Your instance has been configured." +    cecho g " * instance name: "$INSTANCE +    cecho g " * url: "$URL      cat >&2 <<-'EOF' | 
