Adds access token to update command since repository is private.
This commit is contained in:
@@ -4,8 +4,13 @@ Convert Zip packages to repositories and if they exist update and tag them.
|
|||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
## Get needed access token
|
||||||
|
|
||||||
|
Get a token from [https://git.vdm.dev/user/settings/applications](https://git.vdm.dev/user/settings/applications)
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ sudo curl -L "https://git.vdm.dev/api/v1/repos/octoleo/octozipo/raw/src/octozipo" -o /usr/local/bin/octozipo
|
$ export SETUP_TOKEN="xxxxxxxxxxtokenxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
$ sudo curl -L "https://git.vdm.dev/api/v1/repos/octoleo/octozipo/raw/src/octozipo?access_token=${SETUP_TOKEN}" -o /usr/local/bin/octozipo
|
||||||
$ sudo chmod +x /usr/local/bin/octozipo
|
$ sudo chmod +x /usr/local/bin/octozipo
|
||||||
```
|
```
|
||||||
- Global **environment** file can be set at: `/home/$USER/.config/octozipo/.env`
|
- Global **environment** file can be set at: `/home/$USER/.config/octozipo/.env`
|
||||||
|
26
src/octozipo
26
src/octozipo
@@ -3,7 +3,7 @@
|
|||||||
# Program name
|
# Program name
|
||||||
PROGRAM_NAME="Octozipo"
|
PROGRAM_NAME="Octozipo"
|
||||||
PROGRAM_CODE="octozipo"
|
PROGRAM_CODE="octozipo"
|
||||||
PROGRAM_VERSION="2.0.0"
|
PROGRAM_VERSION="2.0.1"
|
||||||
PROGRAM_V="2.0"
|
PROGRAM_V="2.0"
|
||||||
# PROGRAM_URL="https://git.vdm.dev/octoleo/${PROGRAM_CODE}"
|
# PROGRAM_URL="https://git.vdm.dev/octoleo/${PROGRAM_CODE}"
|
||||||
|
|
||||||
@@ -434,7 +434,7 @@ function runUpdate() {
|
|||||||
sudo mv "/usr/local/bin/${PROGRAM_CODE}" "/usr/local/bin/${PROGRAM_CODE}.bak"
|
sudo mv "/usr/local/bin/${PROGRAM_CODE}" "/usr/local/bin/${PROGRAM_CODE}.bak"
|
||||||
fi
|
fi
|
||||||
# pull the latest version. Master is always the latest
|
# pull the latest version. Master is always the latest
|
||||||
if sudo curl --fail -L "https://git.vdm.dev/api/v1/repos/octoleo/${PROGRAM_CODE}/raw/src/${PROGRAM_CODE}?ref=${branch:-master}" -o "/usr/local/bin/${PROGRAM_CODE}" 2>/dev/null; then
|
if sudo curl --fail -L "https://git.vdm.dev/api/v1/repos/octoleo/${PROGRAM_CODE}/raw/src/${PROGRAM_CODE}?ref=${branch:-master}&access_token=${VDM_ACCESS_TOKEN}" -o "/usr/local/bin/${PROGRAM_CODE}" 2>/dev/null; then
|
||||||
# give success message
|
# give success message
|
||||||
_echo "[success] Update was successful."
|
_echo "[success] Update was successful."
|
||||||
# do we have a backup
|
# do we have a backup
|
||||||
@@ -475,6 +475,9 @@ QUIET=false
|
|||||||
DEBUG=false
|
DEBUG=false
|
||||||
GIT_DATE_FORMAT="%b %e %X %Y %z"
|
GIT_DATE_FORMAT="%b %e %X %Y %z"
|
||||||
|
|
||||||
|
# load the access token
|
||||||
|
VDM_ACCESS_TOKEN="${SETUP_TOKEN:-}"
|
||||||
|
|
||||||
# help message ʕ•ᴥ•ʔ
|
# help message ʕ•ᴥ•ʔ
|
||||||
function show_help() {
|
function show_help() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
@@ -553,6 +556,10 @@ Usage: ${PROGRAM_CODE} [OPTION...]
|
|||||||
to update your install
|
to update your install
|
||||||
example: ${PROGRAM_CODE} --update
|
example: ${PROGRAM_CODE} --update
|
||||||
======================================================
|
======================================================
|
||||||
|
-t | --access-token [********token**********]
|
||||||
|
token needed to access private repo for update
|
||||||
|
example: ${PROGRAM_CODE} --access-token='********token**********'
|
||||||
|
======================================================
|
||||||
--uninstall
|
--uninstall
|
||||||
to uninstall this script
|
to uninstall this script
|
||||||
example: ${PROGRAM_CODE} --uninstall
|
example: ${PROGRAM_CODE} --uninstall
|
||||||
@@ -704,6 +711,18 @@ while :; do
|
|||||||
_echo '[error] "--mapper=" requires a non-empty option argument.'
|
_echo '[error] "--mapper=" requires a non-empty option argument.'
|
||||||
exit 17
|
exit 17
|
||||||
;;
|
;;
|
||||||
|
-t | --access-token) # Takes an option argument; ensure it has been specified.
|
||||||
|
if [ "$2" ]; then
|
||||||
|
VDM_ACCESS_TOKEN=$2
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
_echo '[error] "--token" requires a non-empty option argument.'
|
||||||
|
exit 17
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
-t=?* | --access-token=?*)
|
||||||
|
VDM_ACCESS_TOKEN=${1#*=} # Delete everything up to "=" and assign the remainder.
|
||||||
|
;;
|
||||||
--debug)
|
--debug)
|
||||||
DEBUG=true
|
DEBUG=true
|
||||||
;;
|
;;
|
||||||
@@ -807,6 +826,9 @@ cat <<EOF
|
|||||||
======================================================
|
======================================================
|
||||||
--debug
|
--debug
|
||||||
VALUE: $DEBUG
|
VALUE: $DEBUG
|
||||||
|
======================================================
|
||||||
|
-t | --token=[token]
|
||||||
|
VALUE: $VDM_ACCESS_TOKEN
|
||||||
======================================================
|
======================================================
|
||||||
${PROGRAM_NAME} v${PROGRAM_VERSION}
|
${PROGRAM_NAME} v${PROGRAM_VERSION}
|
||||||
======================================================
|
======================================================
|
||||||
|
Reference in New Issue
Block a user