latest_tag
This commit is contained in:
+12
-9
@@ -1,11 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
## CONSTANTS
|
## CONSTANTS
|
||||||
|
|
||||||
#TODO: LATEST_TAG
|
BASE_URL='https://git.artcode.re/miaou/miaou-bash/archive'
|
||||||
# LATEST_TAG=$(curl -s https://git.artcode.re/api/v1/repos/miaou/miaou-bash/tags|grep -oPm1 '{"name":".*?",' | head -n1 | cut -d'"' -f4)
|
|
||||||
# https://git.artcode.re/miaou/miaou-bash/archive/0.3.109.tar.gz
|
|
||||||
|
|
||||||
MAIN_TAR_GZ_URL="https://git.artcode.re/miaou/miaou-bash/archive/main.tar.gz"
|
|
||||||
|
|
||||||
## FUNCTIONS
|
## FUNCTIONS
|
||||||
|
|
||||||
@@ -16,10 +13,16 @@ function upgrade {
|
|||||||
|
|
||||||
function install {
|
function install {
|
||||||
echo INSTALL
|
echo INSTALL
|
||||||
|
local latest_tag
|
||||||
|
latest_tag=$(curl -s https://git.artcode.re/api/v1/repos/miaou/miaou-bash/tags |
|
||||||
|
grep -oPm1 '{"name":".*?",' |
|
||||||
|
head -n1 |
|
||||||
|
cut -d'"' -f4)
|
||||||
|
|
||||||
local tempfile
|
echo "latest_tag=$latest_tag"
|
||||||
tempfile="/tmp/$(basename "$MAIN_TAR_GZ_URL")"
|
|
||||||
curl -so "$tempfile" $MAIN_TAR_GZ_URL
|
local tempfile='/tmp/miaou-bash-latest.tar.gz'
|
||||||
|
curl -so "$tempfile" "${BASE_URL}/${latest_tag}.tar.gz"
|
||||||
sudo tar -xzf "$tempfile" --directory "$(dirname "$MIAOU_BASH_DIR")"
|
sudo tar -xzf "$tempfile" --directory "$(dirname "$MIAOU_BASH_DIR")"
|
||||||
rm "$tempfile"
|
rm "$tempfile"
|
||||||
execute_miaou_lib initiate
|
execute_miaou_lib initiate
|
||||||
@@ -62,7 +65,7 @@ if [[ ! -v MIAOU_BASH_DIR ]]; then
|
|||||||
export MIAOU_BASH_DIR
|
export MIAOU_BASH_DIR
|
||||||
fi
|
fi
|
||||||
|
|
||||||
deployment_type_adjective="${1:-installed}" # self-upgrade provides 'upgrade'
|
deployment_type_adjective="${1:-installed}" # `miaou-bash --self-upgrade` provides the 'upgrade' term
|
||||||
if once_installed; then upgrade; else install; fi
|
if once_installed; then upgrade; else install; fi
|
||||||
if [[ $deployment_type_adjective == 'installed' ]]; then
|
if [[ $deployment_type_adjective == 'installed' ]]; then
|
||||||
exec bash -l
|
exec bash -l
|
||||||
|
|||||||
Reference in New Issue
Block a user