|
|
|
@ -1,29 +1,16 @@ |
|
|
|
#!/usr/bin/env miaou-bash |
|
|
|
|
|
|
|
# CONSTANTS |
|
|
|
# |
|
|
|
[[ ! -v MAIN_TAR_GZ_URL ]] && |
|
|
|
readonly MAIN_TAR_GZ_URL="https://git.artcode.re/miaou/miaou-bash/archive/main.tar.gz" |
|
|
|
|
|
|
|
# FUNCTIONS |
|
|
|
|
|
|
|
function bootstrap { |
|
|
|
cd "$(mktemp -d)" || exit 3 |
|
|
|
curl -s -O "$MAIN_TAR_GZ_URL" |
|
|
|
tar -xzf main.tar.gz --directory "$(dirname "$MIAOU_BASH_DIR")" |
|
|
|
|
|
|
|
local source_bin="$MIAOU_BASH_DIR/bin/miaou-bash" |
|
|
|
local dest_bin="/usr/bin/miaou-bash" |
|
|
|
if ! cmp -s "$source_bin" "$dest_bin"; then |
|
|
|
cp -f "$source_bin" "$dest_bin" |
|
|
|
fi |
|
|
|
echo "miaou-bash refreshed from: $MIAOU_BASH_DIR" |
|
|
|
} |
|
|
|
|
|
|
|
function self_upgrade { |
|
|
|
mv "$MIAOU_BASH_DIR" "$MIAOU_BASH_DIR".before_upgrade |
|
|
|
"$MIAOU_BASH_DIR".before_upgrade/install.sh |
|
|
|
"$MIAOU_BASH_DIR".before_upgrade/install.sh "upgraded" |
|
|
|
rm -rf "$MIAOU_BASH_DIR".before_upgrade |
|
|
|
echo "miaou-bash successfully updated" |
|
|
|
. "$MIAOU_BASH_DIR"/bin/miaou-bash --version |
|
|
|
} |
|
|
|
|
|
|
|
|