|
|
@ -2,9 +2,7 @@ |
|
|
|
|
|
|
|
|
# CONSTANTS |
|
|
# CONSTANTS |
|
|
|
|
|
|
|
|
#FIXME: source from functions.bash |
|
|
|
|
|
if [[ ! -v DESTINATION && ! -v MAIN_TAR_GZ_URL ]]; then |
|
|
|
|
|
readonly DESTINATION=/opt |
|
|
|
|
|
|
|
|
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 |
|
|
fi |
|
|
|
|
|
|
|
|
@ -12,30 +10,21 @@ fi |
|
|
|
|
|
|
|
|
#FIXME: source from functions.bash |
|
|
#FIXME: source from functions.bash |
|
|
function bootstrap { |
|
|
function bootstrap { |
|
|
if [[ ! -d "$DESTINATION/miaou-bash" ]]; then |
|
|
|
|
|
local temp_dir |
|
|
|
|
|
temp_dir=$(mktemp -d) |
|
|
|
|
|
pushd "$temp_dir" >/dev/null || return 2 |
|
|
|
|
|
curl -s -O $MAIN_TAR_GZ_URL |
|
|
|
|
|
tar -xzf main.tar.gz --directory "$DESTINATION" |
|
|
|
|
|
echo "directory: miaou-bash successfully deployed to $DESTINATION" |
|
|
|
|
|
popd >/dev/null || return 3 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
cd "$(mktemp -d)" || exit 4 |
|
|
|
|
|
curl -s -O $MAIN_TAR_GZ_URL |
|
|
|
|
|
tar -xzf main.tar.gz --directory "$MIAOU_BASH_DIR/.." |
|
|
|
|
|
|
|
|
local source_bin="$DESTINATION/miaou-bash/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 "executable: /usr/bin/miaou-bash freshly created" |
|
|
|
|
|
|
|
|
echo "/usr/bin/miaou-bash updated" |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
export MIAOU_BASH_DIR="$DESTINATION/miaou-bash" |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# MAIN |
|
|
# MAIN |
|
|
|
|
|
|
|
|
[[ "$UID" -ne 0 ]] && echo 'root privilege required' && exit 1 |
|
|
[[ "$UID" -ne 0 ]] && echo 'root privilege required' && exit 1 |
|
|
[[ ! -v MIAOU_BASH_DIR ]] && export MIAOU_BASH_DIR="$DESTINATION/miaou-bash" |
|
|
|
|
|
current=$(miaou-bash --version) |
|
|
current=$(miaou-bash --version) |
|
|
latest=$("$MIAOU_BASH_DIR/tools/wget_semver" artcode miaou/miaou-bash) |
|
|
latest=$("$MIAOU_BASH_DIR/tools/wget_semver" artcode miaou/miaou-bash) |
|
|
|
|
|
|
|
|
|