|
|
@ -1,11 +1,8 @@ |
|
|
#!/usr/bin/env bash |
|
|
#!/usr/bin/env bash |
|
|
## CONSTANTS |
|
|
|
|
|
|
|
|
|
|
|
#TODO: 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) |
|
|
|
|
|
# https://git.artcode.re/miaou/miaou-bash/archive/0.3.109.tar.gz |
|
|
|
|
|
|
|
|
## CONSTANTS |
|
|
|
|
|
|
|
|
MAIN_TAR_GZ_URL="https://git.artcode.re/miaou/miaou-bash/archive/main.tar.gz" |
|
|
|
|
|
|
|
|
BASE_URL='https://git.artcode.re/miaou/miaou-bash/archive' |
|
|
|
|
|
|
|
|
## 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) |
|
|
|
|
|
|
|
|
|
|
|
echo "latest_tag=$latest_tag" |
|
|
|
|
|
|
|
|
local tempfile |
|
|
|
|
|
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 |
|
|
|