File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff 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} "
You can’t perform that action at this time.
0 commit comments