@@ -27,9 +27,9 @@ echo " \/ \/ \/ "
27
27
echo " "
28
28
29
29
# Global variables
30
- ASTRA_CLI_VERSION=" 0.1.alpha6 "
30
+ ASTRA_CLI_VERSION=" 0.1.alpha5 "
31
31
32
- echo " Installing Astra Cli$( tput setaf 6 ) $ASTRA_CLI_VERSION $( tput setaf 7 ) please wait... "
32
+ echo " Installing Astra Cli $ASTRA_CLI_VERSION , please wait... "
33
33
34
34
ASTRA_CLI_PLATFORM=$( uname)
35
35
ASTRA_CLI_DIR=" $HOME /.astra/cli"
@@ -48,7 +48,7 @@ astra_zshrc="${ZDOTDIR:-${HOME}}/.zshrc"
48
48
astra_init_snippet=$( cat << EOF
49
49
#THIS MUST BE AT THE END OF THE FILE FOR ASTRA_CLI TO WORK!!!
50
50
export ASTRADIR="$ASTRA_CLI_DIR "
51
- [[ -s "${ASTRA_CLI_DIR} /astra-init .sh" ]] && source "${ASTRA_CLI_DIR} /astra-init .sh"
51
+ [[ -s "${ASTRA_CLI_DIR} /astra-cli-autocomplete .sh" ]] && source "${ASTRA_CLI_DIR} /astra-cli-autocomplete .sh"
52
52
EOF
53
53
)
54
54
@@ -57,38 +57,24 @@ cygwin=false;
57
57
darwin=false;
58
58
solaris=false;
59
59
freebsd=false;
60
- linux=false;
61
60
case " $( uname) " in
62
61
CYGWIN* )
63
62
cygwin=true
64
- download_url=" https://github.com/datastax/astra-cli/releases/download/${ASTRA_CLI_VERSION} /astra-cli-${ASTRA_CLI_VERSION} -windows.zip"
65
- astra_zip_file=" ${astra_tmp_folder} /astra-cli-${ASTRA_CLI_VERSION} -windows.zip"
66
63
;;
67
64
Darwin* )
68
65
darwin=true
69
- download_url=" https://github.com/datastax/astra-cli/releases/download/${ASTRA_CLI_VERSION} /astra-cli-${ASTRA_CLI_VERSION} -mac.zip"
70
- astra_zip_file=" ${astra_tmp_folder} /astra-cli-${ASTRA_CLI_VERSION} -mac.zip"
71
66
;;
72
67
SunOS* )
73
68
solaris=true
74
- download_url=" https://github.com/datastax/astra-cli/releases/download/${ASTRA_CLI_VERSION} /astra-cli-${ASTRA_CLI_VERSION} -linux.zip"
75
- astra_zip_file=" ${astra_tmp_folder} /astra-cli-${ASTRA_CLI_VERSION} -linux.zip"
76
69
;;
77
70
FreeBSD* )
78
71
freebsd=true
79
- download_url=" https://github.com/datastax/astra-cli/releases/download/${ASTRA_CLI_VERSION} /astra-cli-${ASTRA_CLI_VERSION} -linux.zip"
80
- astra_zip_file=" ${astra_tmp_folder} /astra-cli-${ASTRA_CLI_VERSION} -linux.zip"
81
- ;;
82
- Linux* )
83
- linux=true
84
- download_url=" https://github.com/datastax/astra-cli/releases/download/${ASTRA_CLI_VERSION} /astra-cli-${ASTRA_CLI_VERSION} -linux.zip"
85
- astra_zip_file=" ${astra_tmp_folder} /astra-cli-${ASTRA_CLI_VERSION} -linux.zip"
86
- ;;
87
72
esac
88
73
89
74
# Sanity checks
90
75
echo " "
91
- echo " $( tput setaf 6) Checking prerequisites:$( tput setaf 7) "
76
+ echo " Checking prerequisites:"
77
+
92
78
if [ -d " $ASTRA_DIR " ]; then
93
79
echo " "
94
80
echo " ======================================================================================================"
@@ -112,6 +98,18 @@ if ! command -v unzip > /dev/null; then
112
98
fi
113
99
echo " $( tput setaf 2) [OK]$( tput setaf 7) - unzip command is available"
114
100
101
+ if ! command -v zip > /dev/null; then
102
+ echo " Not found."
103
+ echo " ======================================================================================================"
104
+ echo " Please install zip on your system using your favourite package manager."
105
+ echo " "
106
+ echo " Restart after installing zip."
107
+ echo " ======================================================================================================"
108
+ echo " "
109
+ exit 1
110
+ fi
111
+ echo " $( tput setaf 2) [OK]$( tput setaf 7) - zip command is available"
112
+
115
113
if ! command -v curl > /dev/null; then
116
114
echo " Not found."
117
115
echo " "
126
124
echo " $( tput setaf 2) [OK]$( tput setaf 7) - curl command is available"
127
125
128
126
echo " "
129
- echo " $( tput setaf 6 ) Preparing directories:$( tput setaf 7 ) "
127
+ echo " Preparing directories:"
130
128
mkdir -p " $astra_tmp_folder "
131
129
echo " $( tput setaf 2) [OK]$( tput setaf 7) - Created $astra_tmp_folder "
132
130
mkdir -p " $ASTRA_CLI_DIR "
@@ -135,12 +133,14 @@ mkdir -p "$astra_scb_folder"
135
133
echo " $( tput setaf 2) [OK]$( tput setaf 7) - Created $astra_scb_folder "
136
134
137
135
echo " "
138
- echo " $( tput setaf 6) Downloading archive:$( tput setaf 7) "
136
+ echo " Downloading archive:"
137
+ download_url=" https://github.com/datastax/astra-cli/releases/download/${ASTRA_CLI_VERSION} /astra-cli-${ASTRA_CLI_VERSION} .zip"
138
+ astra_zip_file=" ${astra_tmp_folder} /astra-cli-${ASTRA_CLI_VERSION} .zip"
139
139
if [ -f " $astra_zip_file " ]; then
140
140
echo " $( tput setaf 2) [OK]$( tput setaf 7) - Archive is already there"
141
141
else
142
- curl --fail --location --progress-bar " $download_url " > " $astra_zip_file "
143
- echo " $( tput setaf 2) [OK]$( tput setaf 7) - File downloaded"
142
+ curl --fail --location --progress-bar " $download_url " > " $astra_zip_file "
143
+ echo " $( tput setaf 2) [OK]$( tput setaf 7) - File downloaded"
144
144
fi
145
145
146
146
# check integrity
@@ -155,13 +155,14 @@ if [[ -z "$ARCHIVE_OK" ]]; then
155
155
fi
156
156
echo " $( tput setaf 2) [OK]$( tput setaf 7) - Integrity of the archive checked"
157
157
158
+
158
159
if [[ " $cygwin " == ' true' ]]; then
159
160
astra_tmp_folder=$( cygpath -w " $astra_tmp_folder " )
160
161
astra_zip_file=$( cygpath -w " $astra_zip_file " )
161
162
fi
162
163
163
164
echo " "
164
- echo " $( tput setaf 6 ) Extracting and installation:$( tput setaf 7 ) "
165
+ echo " Extracting and installation:"
165
166
unzip -qo " $astra_zip_file " -d " $astra_tmp_folder "
166
167
echo " $( tput setaf 2) [OK]$( tput setaf 7) - Extraction is successful"
167
168
@@ -175,36 +176,27 @@ echo "$(tput setaf 2)[OK]$(tput setaf 7) - Installation cleaned up"
175
176
if [[ $darwin == true ]]; then
176
177
# Adding on MAC OS
177
178
touch " $astra_bash_profile "
178
- if [[ -z $( grep ' astra-init .sh' " $astra_bash_profile " ) ]]; then
179
+ if [[ -z $( grep ' astra-cli-autocomplete .sh' " $astra_bash_profile " ) ]]; then
179
180
echo -e " \n$astra_init_snippet " >> " $astra_bash_profile "
180
181
echo " $( tput setaf 2) [OK]$( tput setaf 7) - astra added to ${astra_bash_profile} "
181
182
fi
182
183
else
183
184
# Attempt update of interactive bash profile on regular UNIX
184
185
touch " ${astra_bashrc} "
185
- if [[ -z $( grep ' astra-init .sh' " $astra_bashrc " ) ]]; then
186
+ if [[ -z $( grep ' astra-cli-autocomplete .sh' " $astra_bashrc " ) ]]; then
186
187
echo -e " \n$astra_init_snippet " >> " $astra_bashrc "
187
188
echo " $( tput setaf 2) [OK]$( tput setaf 7) - astra added to ${astra_bashrc} "
188
189
fi
189
190
fi
190
191
191
192
touch " $astra_zshrc "
192
- if [[ -z $( grep ' astra-init .sh' " $astra_zshrc " ) ]]; then
193
+ if [[ -z $( grep ' astra-cli-autocomplete .sh' " $astra_zshrc " ) ]]; then
193
194
echo -e " \n$astra_init_snippet " >> " $astra_zshrc "
194
195
echo " $( tput setaf 2) [OK]$( tput setaf 7) - astra added to ${astra_zshrc} "
195
196
fi
196
197
197
198
echo " $( tput setaf 2) [OK]$( tput setaf 7) - Installation Successful"
198
199
echo " "
199
- if [[ " $darwin " == ' true' ]]; then
200
- echo " +---------------------------------------------------------------------+"
201
- echo " | ⚠️ Mac installation detected |"
202
- echo " | |"
203
- echo " | astra is now a binary |"
204
- echo " | Make sure to $( tput setaf 3) authorize in System Preferences$( tput setaf 7) during first usage |"
205
- echo " +---------------------------------------------------------------------+"
206
- echo " "
207
- fi
208
200
echo " Open $( tput setaf 2) A NEW TERMINAL$( tput setaf 7) and run: $( tput setaf 3) astra setup$( tput setaf 7) "
209
201
echo " "
210
202
echo " You can close this window."
0 commit comments