|
1 | 1 | #!/bin/bash |
2 | 2 | #------------------------------------------------------------------------------ |
3 | | -# Script: idt-installer - IBM Cloud Developer Tools CLI installer |
| 3 | +# Script: idt-installer |
4 | 4 | #------------------------------------------------------------------------------ |
5 | | -# Bluemix Developer CLI Installer script for MacOS / Linux / Win10 systems |
| 5 | +# IBM Cloud Developer Tools - CLI installer script for MacOS and Linux systems |
6 | 6 | #------------------------------------------------------------------------------ |
7 | 7 | # Copyright (c) 2017, International Business Machines. All Rights Reserved. |
8 | 8 | #------------------------------------------------------------------------------ |
9 | 9 |
|
10 | 10 | VERSION="0.8" |
11 | | -PROG="IBM Developer Tools - Installer" |
| 11 | +PROG="IBM Cloud Developer Tools - Installer" |
12 | 12 | INSTALLER_URL="https://ibm.biz/idt-installer" |
13 | 13 | GIT_URL="https://github.com/ibm-cloud-tools/idt-installer" |
14 | 14 | SLACK_URL="https://ibm.biz/IBMCloudNativeSlack" |
15 | | -IDT_INSTALL_BMX_URL="${IDT_INSTALL_BMX_URL:=https://clis.ng.bluemix.net/install}" |
| 15 | +DEFAULT_BMX_URL="https://clis.ng.bluemix.net/install" |
| 16 | + |
| 17 | +if [[ "$IDT_INSTALL_USE_PROD" != false ]]; then |
| 18 | + unset IDT_INSTALL_BMX_URL IDT_INSTALL_BMX_REPO_NAME IDT_INSTALL_BMX_REPO_URL |
| 19 | +fi |
| 20 | +IDT_INSTALL_BMX_URL="${IDT_INSTALL_BMX_URL:=$DEFAULT_BMX_URL}" |
16 | 21 | IDT_INSTALL_BMX_REPO_NAME="${IDT_INSTALL_BMX_REPO_NAME:=Bluemix}" |
17 | 22 | IDT_INSTALL_BMX_REPO_URL="${IDT_INSTALL_BMX_REPO_URL:=https://plugins.ng.bluemix.net}" |
18 | 23 |
|
@@ -120,30 +125,30 @@ function uninstall { |
120 | 125 | log "Removing Bluemix CLI..." |
121 | 126 | if [[ "${PLATFORM}" == "Darwin" && "$USEBREW" == true ]]; then |
122 | 127 | brew cask uninstall "bluemix-cli" |
123 | | - else |
124 | | - sudo rm -f /usr/local/bin/bluemix |
125 | | - sudo rm -f /usr/local/bin/bx |
126 | | - sudo rm -f /usr/local/bin/bluemix-analytics |
127 | | - sudo rm -rf /usr/local/Bluemix |
128 | | - #-- Taken from bluemix CLI brew uninstaller |
129 | | - if [[ -f /etc/profile ]]; then |
130 | | - sudo sed -E -i ".bluemix_uninstall_bak" \ |
131 | | - -e '/^### Added by the Bluemix CLI$/d' \ |
132 | | - -e '/^source \/usr\/local\/Bluemix\/bx\/bash_autocomplete$/d' \ |
133 | | - /etc/profile |
134 | | - fi |
135 | | - if [[ -f ~/.bashrc ]]; then |
136 | | - sed -E -i ".bluemix_uninstall_bak" \ |
137 | | - -e '/^### Added by the Bluemix CLI$/d' \ |
138 | | - -e '/^source \/usr\/local\/Bluemix\/bx\/bash_autocomplete$/d' \ |
139 | | - ~/.bashrc |
140 | | - fi |
141 | | - if [[ -f ~/.zshrc ]]; then |
142 | | - sed -E -i ".bluemix_uninstall_bak" \ |
143 | | - -e '/^### Added by the Bluemix CLI$/d' \ |
144 | | - -e '/^source \/usr\/local\/Bluemix\/bx\/zsh_autocomplete$/d' \ |
145 | | - ~/.zshrc |
146 | | - fi |
| 128 | + fi |
| 129 | + #-- Run the following regardless |
| 130 | + sudo rm -f /usr/local/bin/bluemix |
| 131 | + sudo rm -f /usr/local/bin/bx |
| 132 | + sudo rm -f /usr/local/bin/bluemix-analytics |
| 133 | + sudo rm -rf /usr/local/Bluemix |
| 134 | + #-- Taken from bluemix CLI brew uninstaller |
| 135 | + if [[ -f /etc/profile ]]; then |
| 136 | + sudo sed -E -i ".bluemix_uninstall_bak" \ |
| 137 | + -e '/^### Added by the Bluemix CLI$/d' \ |
| 138 | + -e '/^source \/usr\/local\/Bluemix\/bx\/bash_autocomplete$/d' \ |
| 139 | + /etc/profile |
| 140 | + fi |
| 141 | + if [[ -f ~/.bashrc ]]; then |
| 142 | + sed -E -i ".bluemix_uninstall_bak" \ |
| 143 | + -e '/^### Added by the Bluemix CLI$/d' \ |
| 144 | + -e '/^source \/usr\/local\/Bluemix\/bx\/bash_autocomplete$/d' \ |
| 145 | + ~/.bashrc |
| 146 | + fi |
| 147 | + if [[ -f ~/.zshrc ]]; then |
| 148 | + sed -E -i ".bluemix_uninstall_bak" \ |
| 149 | + -e '/^### Added by the Bluemix CLI$/d' \ |
| 150 | + -e '/^source \/usr\/local\/Bluemix\/bx\/zsh_autocomplete$/d' \ |
| 151 | + ~/.zshrc |
147 | 152 | fi |
148 | 153 | env_setup remove |
149 | 154 |
|
@@ -214,7 +219,8 @@ function install_bx { |
214 | 219 | log "Installing IBM Cloud 'Bluemix' CLI for platform '${PLATFORM}'..." |
215 | 220 | case "$PLATFORM" in |
216 | 221 | "Darwin") |
217 | | - if [[ "$USEBREW" == true ]]; then |
| 222 | + #-- Only use BREW if using default bluemix URL (not an internal url) |
| 223 | + if [[ "$USEBREW" == true && "$IDT_INSTALL_BMX_REPO_NAME" == "Bluemix" ]]; then |
218 | 224 | brew cask reinstall "caskroom/cask/bluemix-cli" |
219 | 225 | else |
220 | 226 | log "Downloading and installing Bluemix CLI from: ${IDT_INSTALL_BMX_URL}/osx" |
@@ -291,7 +297,7 @@ function env_setup { |
291 | 297 | log "The following aliases are defined to access the 'idt' tool:" |
292 | 298 | log " ${GRN}idt${NRM} : Main command line tool for IBM Cloud Native development" |
293 | 299 | log " ${GRN}idt-update${NRM} : Update your IDT tools to the latest version" |
294 | | - log " ${GRN}idt-uninstall${NRM} : Uninstall the IBM Developer Tools" |
| 300 | + log " ${GRN}idt-uninstall${NRM} : Uninstall the IBM Cloud Developer Tools" |
295 | 301 | ;; |
296 | 302 | "remove") |
297 | 303 | if [[ -n "$(grep 'alias idt="bluemix dev"' "$env_file")" ]]; then |
|
0 commit comments