upgraded message
This commit is contained in:
+3
-1
@@ -24,6 +24,8 @@ function assert_supported_distro {
|
||||
|
||||
set -Eeuo pipefail
|
||||
|
||||
message="${1:-installed}"
|
||||
|
||||
[[ "$UID" -ne 0 ]] && echo 'root privilege required' && exit 1
|
||||
! assert_supported_distro && echo 'unsupported distro: debian-like OR arch-like expected' && exit 2
|
||||
|
||||
@@ -33,5 +35,5 @@ if [[ -d "$MIAOU_BASH_DIR" && -L /etc/inputrc && "$(readlink /etc/inputrc)" == "
|
||||
else
|
||||
bootstrap
|
||||
. "$MIAOU_BASH_DIR"/bin/miaou-bash "$MIAOU_BASH_DIR/lib/init.bash"
|
||||
echo "miaou-bash successfully installed"
|
||||
echo "miaou-bash successfully $message"
|
||||
fi
|
||||
|
||||
+2
-15
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user