You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e7478d3
Browse filesBrowse the repository at this point in the historyBrowse files
Add install.sh script for automated VectraCtl installation
Introduced a Bash script to automate downloading, verifying, and installing the VectraCtl CLI tool. The script detects system architecture, checks for curl or wget, fetches the latest or specified release from GitHub, handles installation to /usr/local/bin (with sudo if needed), and provides user feedback and error handling.
#23
# Most linux distro needs root permission to copy the file to /usr/local/bin
32
+
if [[ "$OS"=="linux"||"$OS"=="darwin" ]] && [[ "VECTRACTL_INSTALL_DIR"=="/usr/local/bin" ]];then
33
+
USE_SUDO="true"
34
+
fi
35
+
}
36
+
37
+
verifySupported() {
38
+
releaseTag=$1
39
+
local supported=(darwin-x64 linux-x64 linux-arm linux-arm64)
40
+
local current_osarch="${OS}-${ARCH}"
41
+
42
+
forosarchin"${supported[@]}";do
43
+
if [[ "$osarch"=="$current_osarch" ]];then
44
+
echo"Your system is ${OS}_${ARCH}"
45
+
return
46
+
fi
47
+
done
48
+
49
+
if [[ "$current_osarch"=="darwin-arm64" ]];then
50
+
if isReleaseAvailable $releaseTag;then
51
+
return
52
+
else
53
+
echo"The darwin_arm64 arch has no native binary for this version of VectraCtl, however you can use the amd64 version so long as you have rosetta installed"
54
+
echo"Use 'softwareupdate --install-rosetta' to install rosetta if you don't already have it"
55
+
ARCH="x64"
56
+
return
57
+
fi
58
+
fi
59
+
60
+
echo"No prebuilt binary for ${current_osarch}"
61
+
exit 1
62
+
}
63
+
64
+
runAsRoot() {
65
+
local CMD="$*"
66
+
67
+
if [[ $EUID-ne 0 &&$USE_SUDO="true" ]];then
68
+
CMD="sudo $CMD"
69
+
fi
70
+
71
+
$CMD|| {
72
+
echo"Please visit https://github.com/cortexiumlabs/vectractl for instructions on how to install without sudo."
73
+
exit 1
74
+
}
75
+
}
76
+
77
+
checkHttpRequestVectraCtl() {
78
+
iftype"curl"> /dev/null;then
79
+
HTTP_REQUEST_VECTRACTL=curl
80
+
eliftype"wget"> /dev/null;then
81
+
HTTP_REQUEST_VECTRACTL=wget
82
+
else
83
+
echo"Either curl or wget is required"
84
+
exit 1
85
+
fi
86
+
}
87
+
88
+
checkExistingVectraCtl() {
89
+
if [[ -f"$VECTRACTL_FILE" ]];then
90
+
echo -e "\nVectraCtl is detected:"
91
+
$VECTRACTL_FILE --version
92
+
echo -e "Reinstalling VectraCtl...\n"
93
+
else
94
+
echo -e "Installing VectraCtl...\n"
95
+
fi
96
+
}
97
+
98
+
getLatestRelease() {
99
+
local vectrActlReleaseUrl="https://api.github.com/repos/${GITHUB_ORG}/${GITHUB_REPO}/releases"
0 commit comments