This repository has been archived on 2022-02-20. You can view files and clone it, but cannot push or open issues/pull-requests.
bash-shell-base/modules/github-bin-fetch.sh

31 lines
741 B
Bash
Raw Normal View History

#!/bin/bash
# if you have run into github api anonymous access limits which happens during debugging/dev then add user and token here or sourced from a separate file
# set to location for tokens in file
source ~/githubapitoken
if [ "$GITHUB_TOKEN" != "" ]; then
echo using access token with script
echo $GITHUB_USER $GITHUB_TOKEN
fi
DIR=$(dirname "$(readlink -f "$0")") || exit
ORG=$1
REPO=$2
TYPE=$3
NAME=$4
EXCLUDE=$5
URL=$(curl -s https://api.github.com/repos/$ORG/$REPO/releases/latest \
# | grep 'browser_download_url.*'$TYPE''
# | sed -n -e 's/^.*: //p' \
# | sed 's/"//g'
)
echo "Pulling $URL"
TODO put back tokens here.
# wget $URL -O $NAME.$TYPE
# chmod +x $DIR/$NAME.$TYPE
# ln -s $DIR/$NAME.$TYPE /opt/bin/$NAME