diff options
| -rwxr-xr-x | install/ishtar-delete-instance | 25 | ||||
| -rwxr-xr-x | install/ishtar-install | 71 | ||||
| -rwxr-xr-x | install/ishtar-prepare-instance | 38 | 
3 files changed, 89 insertions, 45 deletions
| diff --git a/install/ishtar-delete-instance b/install/ishtar-delete-instance index f67770d4d..de54154d2 100755 --- a/install/ishtar-delete-instance +++ b/install/ishtar-delete-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_delete_instance() {      NGINX_AVAILABLE_PATH='/etc/nginx/sites-available'      NGINX_ENABLE_PATH='/etc/nginx/sites-enabled' @@ -14,7 +31,7 @@ do_delete_instance() {      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 ""; @@ -26,7 +43,7 @@ do_delete_instance() {      INSTANCES_FILE=$CONFIG_PATH/instances      if [ ! -f $INSTANCES_FILE ]; then          echo ""; -        echo "No instance installated. Exiting." +        cecho r "No instance installed. Exiting."          echo "";          exit 1;      fi @@ -54,8 +71,8 @@ EOF          fi      done      echo "" -    echo "Are you really sure to delete configuration, database and media attached to the " -    echo "instance "$to_delete"?" +    cecho r "Are you really sure to delete configuration, database and media attached to the " +    cecho r "instance "$to_delete"?"      echo ""      read -p "* Type DELETE if you are sure: " choice      if [ "$choice" != "DELETE" ]; then diff --git a/install/ishtar-install b/install/ishtar-install index c376e05f2..2b01c4e8e 100755 --- a/install/ishtar-install +++ b/install/ishtar-install @@ -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" +} +  command_exists() {      command -v "$@" > /dev/null 2>&1  } @@ -55,10 +72,8 @@ 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 @@ -153,12 +168,10 @@ EOF          ubuntu|debian)              ;;          *) -            cat >&2 <<-'EOF' - -  Sorry. Either your platform is not easily detectable or not supported by -  this installer. - -EOF +            echo "" +            cecho r " Sorry. Either your platform is not easily detectable or not supported by" +            cecho r " this installer." +            echo ""              exit 1      esac @@ -224,8 +237,9 @@ EOF      etc_path="/etc/ishtar/"      if [ -d "$etc_path" ]; then          echo "" -        echo "ERROR: it seems that "$etc_path" already exists. If this is a remnant " -        echo "of an old installation please delete this path before installing." +        cecho r "ERROR: it seems that "$etc_path" already exists. If this is a remnant " +        cecho r "of an old installation please delete this path before installing." +        echo ""          exit 1      fi @@ -253,8 +267,9 @@ EOF      full_install_path=$install_path'/ishtar/'      if [ -d "$full_install_path" ]; then          echo "" -        echo "ERROR: it seems that "$full_install_path" already exists. If this is a " -        echo "remnant of an old installation please delete this directory before installing." +        cecho r "ERROR: it seems that "$full_install_path" already exists. If this is a " +        cecho r "remnant of an old installation please delete this directory before installing." +        echo ""          exit 1      fi @@ -266,11 +281,9 @@ EOF      case "$lsb_dist" in          ubuntu|debian)              if [ "$dist_version" != "jessie" ] && [ "$dist_version" != "wheezy" ]; then -                cat >&2 <<-'EOF' - -  Sorry this script cannot manage your version of Debian/Ubuntu. - -EOF +                echo "" +                cecho r " Sorry this script cannot manage your version of Debian/Ubuntu." +                echo ""                  exit 1              fi @@ -332,14 +345,12 @@ EOF              if [ "$dist_version" == "jessie" ]; then                  if [ "$backports_activated" != 'true' ]; then -                    cat >&2 <<-'EOF' - -      In order to install Ishtar you have to activate Debian backports. To do that: - -      echo "deb http://ftp.debian.org/debian jessie-backports main contrib non-free" >> "/etc/apt/sources.list" - -      Run again Ishtar installation script after that. -EOF +                    echo "" +                    cecho p "  In order to install Ishtar you have to activate Debian backports. To do that:" +                    echo "" +                    echo "    echo "deb http://ftp.debian.org/debian jessie-backports main contrib non-free" >> "/etc/apt/sources.list" +                    echo "" +                    cecho p "  Run again Ishtar installation script after that."                      exit 1                  fi @@ -386,10 +397,10 @@ EOF      echo ""      echo "*******************************************************************************";      echo ""; -    echo "Installation done. Base configuration stored in "$etc_path"config file." -    echo "You can edit "$etc_path"extra_settings.py to add settings to all new instances." +    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."      echo ""; -    echo "Next you'll have to create an instance with ishtar-prepare-instance script." +    cecho g "Next you'll have to create an instance with ishtar-prepare-instance script."      echo "";  } 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' | 
