|
|
@ -2,26 +2,22 @@ |
|
|
|
|
|
|
|
|
# CONSTANTS |
|
|
# CONSTANTS |
|
|
|
|
|
|
|
|
if [[ ! -v MAIN_TAR_GZ_URL ]]; then |
|
|
|
|
|
readonly MAIN_TAR_GZ_URL="https://git.artcode.re/miaou/miaou-bash/archive/main.tar.gz" |
|
|
readonly MAIN_TAR_GZ_URL="https://git.artcode.re/miaou/miaou-bash/archive/main.tar.gz" |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
# FUNCTIONS |
|
|
# FUNCTIONS |
|
|
|
|
|
|
|
|
#FIXME: source from functions.bash |
|
|
|
|
|
function bootstrap { |
|
|
function bootstrap { |
|
|
cd "$(mktemp -d)" || exit 4 |
|
|
|
|
|
|
|
|
cd "$(mktemp -d)" || exit 3 |
|
|
curl -s -O $MAIN_TAR_GZ_URL |
|
|
curl -s -O $MAIN_TAR_GZ_URL |
|
|
tar -xzf main.tar.gz --directory "$MIAOU_BASH_DIR/.." |
|
|
|
|
|
|
|
|
tar -xzf main.tar.gz --directory "$(dirname $MIAOU_BASH_DIR)" |
|
|
|
|
|
|
|
|
local source_bin="$MIAOU_BASH_DIR/bin/miaou-bash" |
|
|
local source_bin="$MIAOU_BASH_DIR/bin/miaou-bash" |
|
|
local dest_bin="/usr/bin/miaou-bash" |
|
|
local dest_bin="/usr/bin/miaou-bash" |
|
|
if ! cmp -s "$source_bin" "$dest_bin"; then |
|
|
if ! cmp -s "$source_bin" "$dest_bin"; then |
|
|
cp -f "$source_bin" "$dest_bin" |
|
|
cp -f "$source_bin" "$dest_bin" |
|
|
echo "/usr/bin/miaou-bash updated" |
|
|
|
|
|
fi |
|
|
fi |
|
|
|
|
|
echo "miaou-bash refreshed from: $MIAOU_BASH_DIR" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# MAIN |
|
|
# MAIN |
|
|
|
|
|
|
|
|
[[ "$UID" -ne 0 ]] && echo 'root privilege required' && exit 1 |
|
|
[[ "$UID" -ne 0 ]] && echo 'root privilege required' && exit 1 |
|
|
@ -31,8 +27,10 @@ latest=$("$MIAOU_BASH_DIR/tools/wget_semver" artcode miaou/miaou-bash) |
|
|
if [[ "$current" == "$latest" ]]; then |
|
|
if [[ "$current" == "$latest" ]]; then |
|
|
echo "up-to-date version: $current" |
|
|
echo "up-to-date version: $current" |
|
|
else |
|
|
else |
|
|
|
|
|
# TODO: prevent refresh from development purpose |
|
|
rm -rf "$MIAOU_BASH_DIR" |
|
|
rm -rf "$MIAOU_BASH_DIR" |
|
|
bootstrap |
|
|
bootstrap |
|
|
|
|
|
|
|
|
miaou-bash "$MIAOU_BASH_DIR/lib/init.bash" |
|
|
miaou-bash "$MIAOU_BASH_DIR/lib/init.bash" |
|
|
echo "miaou-bash successfully updated" |
|
|
echo "miaou-bash successfully updated" |
|
|
miaou-bash --version |
|
|
miaou-bash --version |
|
|
|