Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix get.sh to select between --version and version subcommand #674

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions get.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ function check_connectivity() {

function install_pvsadm() {

local major=0
local minor=0
local patch=0

if [[ "$VERSION" =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
major=${BASH_REMATCH[1]}
minor=${BASH_REMATCH[2]}
patch=${BASH_REMATCH[3]}
fi

if [[ "${FORCE}" -eq 1 ]]; then
if command -v "pvsadm" &> /dev/null; then
rm -f /usr/local/bin/pvsadm
Expand All @@ -75,8 +85,7 @@ function install_pvsadm() {

if command -v "pvsadm" &> /dev/null; then
echo "pvsadm is already installed!"
# TODO: move to pvsadm --version for future releases.
pvsadm version
print_version $major $minor $patch
exit 1
fi

Expand All @@ -92,7 +101,21 @@ function install_pvsadm() {
fi

chmod +x /usr/local/bin/pvsadm
pvsadm --version
print_version $major $minor $patch
}

function print_version() {
# check if version is < 0.1.17, which uses the pvsadm subcommand
local major=$1
local minor=$2
local patch=$3
if [ $major -lt 1 ] && [ $minor -lt 2 ] && [ $patch -lt 17 ];
then
pvsadm version
# the more recent releases support the version flag
else
pvsadm --version
fi
}

function run (){
Expand Down