Skip to content

Commit

Permalink
Updated lab installer
Browse files Browse the repository at this point in the history
  • Loading branch information
ziflex committed Mar 28, 2023
1 parent e572115 commit a9e9ba7
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,23 @@ validate_input() {
local location="$1"
local version="$2"

if [ -z "$location" ] || [ ! -d "$location" ]; then
if [ -z "$location" ]; then
report "Invalid location: $location"
exit 1
fi

# Check if location exists
if [ ! -d "$location" ]; then
report "Location does not exist: $location"
exit 1
fi

# Check if location is writable
if [ ! -w "$location" ]; then
report "Location is not writable: $location"
exit 1
fi

if [ "$version" != "latest" ] && [[ ! "$version" =~ [0-9]+\.[0-9]+\.[0-9]+$ ]]; then
report "Invalid version: $version"
exit 1
Expand Down Expand Up @@ -196,8 +208,6 @@ install() {

local downloaded_file="${download_dir}/${binName}"

mkdir -p "${location}"

report "Copying ${downloaded_file} to ${location}"

cp "${downloaded_file}" "${location}"
Expand Down

0 comments on commit a9e9ba7

Please sign in to comment.