feat: add -I option to cwctl and modify -i option (#5045)

* feat: add -I option to cwctl and modify -i option

Modify -i option to drop support for installing specified branch
-i will always default to installing the latest stable branch(master)

Add -I option to support installing Chatwoot with a custom branch

* chore: minor fixes
This commit is contained in:
Vishnu Narayanan 2022-07-15 16:17:52 +05:30 committed by GitHub
parent a4e21f2c47
commit 18d9bd8359
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 19 deletions

View file

@ -1 +1 @@
2.0.9 2.1.0

View file

@ -2,7 +2,7 @@
# Description: Install and manage a Chatwoot installation. # Description: Install and manage a Chatwoot installation.
# OS: Ubuntu 20.04 LTS # OS: Ubuntu 20.04 LTS
# Script Version: 2.0.9 # Script Version: 2.1.0
# Run this script as root # Run this script as root
set -eu -o errexit -o pipefail -o noclobber -o nounset set -eu -o errexit -o pipefail -o noclobber -o nounset
@ -17,9 +17,9 @@ fi
# Global variables # Global variables
# option --output/-o requires 1 argument # option --output/-o requires 1 argument
LONGOPTS=console,debug,help,install:,logs:,restart,ssl,upgrade,webserver,version LONGOPTS=console,debug,help,install,Install:,logs:,restart,ssl,upgrade,webserver,version
OPTIONS=cdhi:l:rsuwv OPTIONS=cdhiI:l:rsuwv
CWCTL_VERSION="2.0.9" CWCTL_VERSION="2.1.0"
pg_pass=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 15 ; echo '') pg_pass=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 15 ; echo '')
# if user does not specify an option # if user does not specify an option
@ -41,7 +41,7 @@ fi
# read getopts output this way to handle the quoting right: # read getopts output this way to handle the quoting right:
eval set -- "$PARSED" eval set -- "$PARSED"
c=n d=n h=n i=n l=n r=n s=n u=n w=n v=n BRANCH=master SERVICE=web c=n d=n h=n i=n I=n l=n r=n s=n u=n w=n v=n BRANCH=master SERVICE=web
# Iterate options in order and nicely split until we see -- # Iterate options in order and nicely split until we see --
while true; do while true; do
case "$1" in case "$1" in
@ -51,7 +51,7 @@ while true; do
;; ;;
-d|--debug) -d|--debug)
d=y d=y
break shift
;; ;;
-h|--help) -h|--help)
h=y h=y
@ -59,6 +59,11 @@ while true; do
;; ;;
-i|--install) -i|--install)
i=y i=y
BRANCH="master"
break
;;
-I|--Install)
I=y
BRANCH="$2" BRANCH="$2"
break break
;; ;;
@ -100,7 +105,7 @@ done
# log if debug flag set # log if debug flag set
if [ "$d" == "y" ]; then if [ "$d" == "y" ]; then
echo "console: $c, debug: $d, help: $h, install: $i, BRANCH: $BRANCH, \ echo "console: $c, debug: $d, help: $h, install: $i, Install: $I, BRANCH: $BRANCH, \
logs: $l, SERVICE: $SERVICE, ssl: $s, upgrade: $u, webserver: $w" logs: $l, SERVICE: $SERVICE, ssl: $s, upgrade: $u, webserver: $w"
fi fi
@ -615,20 +620,21 @@ Example: cwctl --upgrade
Example: cwctl -c Example: cwctl -c
Installation/Upgrade: Installation/Upgrade:
-i, --install install Chatwoot with the git branch specified -i, --install Install the latest stable version of Chatwoot
-u, --upgrade upgrade Chatwoot to latest version -I Install Chatwoot from a git branch
-s, --ssl fetch and install ssl certificates using LetsEncrypt -u, --upgrade Upgrade Chatwoot to the latest stable version
-w, --webserver install and configure Nginx webserver with SSL -s, --ssl Fetch and install SSL certificates using LetsEncrypt
-w, --webserver Install and configure Nginx webserver with SSL
Management: Management:
-c, --console open ruby console -c, --console Open ruby console
-l, --logs view logs from Chatwoot. Supported values include web/worker. -l, --logs View logs from Chatwoot. Supported values include web/worker.
-r, --restart restart Chatwoot server -r, --restart Restart Chatwoot server
Miscellaneous: Miscellaneous:
-d, --debug show debug messages -d, --debug Show debug messages
-v, --version display version information and exit -v, --version Display version information
-h, --help display this help text and exit -h, --help Display this help text
Exit status: Exit status:
Returns 0 if successful; non-zero otherwise. Returns 0 if successful; non-zero otherwise.
@ -799,7 +805,7 @@ function main() {
help help
fi fi
if [ "$i" == "y" ]; then if [ "$i" == "y" ] || [ "$I" == "y" ]; then
install install
fi fi