From b68a3fa9110ebb8d277fe1f0610a5a4c9662d79d Mon Sep 17 00:00:00 2001 From: Nicolas Carlier Date: Tue, 28 Jan 2020 20:02:20 +0000 Subject: [PATCH] chore(): non root installation script --- install.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) mode change 100644 => 100755 install.sh diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 index 3b4519d..78a5981 --- a/install.sh +++ b/install.sh @@ -24,22 +24,22 @@ base_download_url=`dirname $artefact_url` download_url=$base_download_url/webhookd-$os-${arch}.tgz download_file=/tmp/webhookd-$os-${arch}.tgz -bin_target=/usr/local/bin +bin_target=${1:-$HOME/.local/bin} echo "Downloading $download_url to $download_file ..." -sudo curl -o $download_file --fail -L $download_url +curl -o $download_file --fail -L $download_url [ $? != 0 ] && die "Unable to download binary for your architecture." -echo "Extracting $download_file ..." -sudo tar xvzf ${download_file} -C /tmp/ +echo "Extracting $download_file to $bin_target ..." +[ -d $bin_target ] || mkdir -p $bin_target +tar xvzf ${download_file} -C $bin_target [ $? != 0 ] && die "Unable to extract archive." -echo "Moving binary to $bin_target ..." -sudo mv /tmp/webhookd $bin_target -[ $? != 0 ] && die "Unable to move binary." +echo "Cleaning..." +rm $download_file \ + $bin_target/LICENSE \ + $bin_target/README.md \ + $bin_target/CHANGELOG.md +[ $? != 0 ] && die "Unable to clean installation files." -echo "Making $bin_target as executable ..." -sudo chmod +x $bin_target/webhookd -[ $? != 0 ] && die "Unable to make the binary as executable." - -echo "Installation done. Type 'webhookd' to start the server." +echo "Installation done. Type '$bin_target/webhookd' to start the server."