chore(): non root installation script

This commit is contained in:
Nicolas Carlier 2020-01-28 20:02:20 +00:00
parent e663336ecb
commit b68a3fa911

24
install.sh Normal file → Executable file
View File

@ -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."