Skip to content

Commit

Permalink
add perms and creation of directory check
Browse files Browse the repository at this point in the history
  • Loading branch information
barelyhuman committed Feb 6, 2022
1 parent e14211f commit 3d1222d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions templates/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,17 @@ start() {
log_info "Building binary for $os $arch ... Please wait"
http_download $tmp "$api/binary/$pkg?os=$os&arch=$arch&version=$version&out=$out"

# check if the directory exists and also check if it requires write permissions
if [ ! -d "$prefix" ]; then
log_info "$prefix doesn't exist, attempting to create it"
if [ -w "$prefix" ]; then
mkdir -p "$prefix"
else
log_info "Permissions required for creating $prefix"
sudo mkdir -p "$prefix"
fi
fi

if [ -w "$prefix" ]; then
log_info "Installing $out to $prefix"
install "$tmp" "$prefix"
Expand Down

0 comments on commit 3d1222d

Please sign in to comment.