Skip to content

Commit a9e9ba7

Browse files
committed
Updated lab installer
1 parent e572115 commit a9e9ba7

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

install.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,23 @@ validate_input() {
3939
local location="$1"
4040
local version="$2"
4141

42-
if [ -z "$location" ] || [ ! -d "$location" ]; then
42+
if [ -z "$location" ]; then
4343
report "Invalid location: $location"
4444
exit 1
4545
fi
4646

47+
# Check if location exists
48+
if [ ! -d "$location" ]; then
49+
report "Location does not exist: $location"
50+
exit 1
51+
fi
52+
53+
# Check if location is writable
54+
if [ ! -w "$location" ]; then
55+
report "Location is not writable: $location"
56+
exit 1
57+
fi
58+
4759
if [ "$version" != "latest" ] && [[ ! "$version" =~ [0-9]+\.[0-9]+\.[0-9]+$ ]]; then
4860
report "Invalid version: $version"
4961
exit 1
@@ -196,8 +208,6 @@ install() {
196208

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

199-
mkdir -p "${location}"
200-
201211
report "Copying ${downloaded_file} to ${location}"
202212

203213
cp "${downloaded_file}" "${location}"

0 commit comments

Comments
 (0)