fix
This commit is contained in:
@@ -31,11 +31,12 @@ Any feedback would be appreciated.
|
||||
## install
|
||||
|
||||
```bash
|
||||
curl -s https://git.artcode.re/miaou/miaou-bash/raw/branch/main/install.sh | sudo bash && exec bash
|
||||
curl -s https://git.artcode.re/miaou/miaou-bash/raw/branch/main/install.sh | sudo -E bash && exec bash
|
||||
```
|
||||
|
||||
## upgrade
|
||||
|
||||
TODO: self-upgrade
|
||||
`upgrade-miaou-bash`
|
||||
|
||||
## uninstall
|
||||
|
||||
+11
-1
@@ -265,6 +265,14 @@ function on_error {
|
||||
fi
|
||||
}
|
||||
|
||||
function self_upgrade {
|
||||
sudo -E "$MIAOU_BASH_DIR/lib/self-upgrade.bash"
|
||||
}
|
||||
|
||||
function uninstall {
|
||||
echo "TODO: uninstall"
|
||||
}
|
||||
|
||||
function populate_error_arrays {
|
||||
|
||||
local source=$1 line=$2 payload=$3
|
||||
@@ -601,7 +609,7 @@ function cleanup {
|
||||
}
|
||||
|
||||
function usage {
|
||||
echo "$(basename "$0") <SCRIPT> [...SCRIPT_ARGS] | --version | --help"
|
||||
echo "$(basename "$0") <SCRIPT> [...SCRIPT_ARGS] | --version | --help | --self-upgrade | --uninstall"
|
||||
}
|
||||
|
||||
function parse_options {
|
||||
@@ -609,6 +617,8 @@ function parse_options {
|
||||
[[ $# == 1 ]] && case "$1" in
|
||||
--help) usage && builtin exit ;;
|
||||
--version) cat "$MIAOU_BASH_DIR/.semver_git_tag" && builtin exit ;;
|
||||
--self-upgrade) self_upgrade && builtin exit ;;
|
||||
--uninstall) uninstall && builtin exit ;;
|
||||
-*) >&2 echo "ERROR: option '$1' unknown!" && usage && builtin exit 2 ;;
|
||||
esac
|
||||
[[ $1 =~ ^- ]] && >&2 echo "ERROR: too many args $#, either single option or SCRIPT + args accepted!" && builtin exit 2
|
||||
|
||||
+10
-2
@@ -6,6 +6,14 @@
|
||||
|
||||
# MAIN
|
||||
|
||||
[ "$UID" -ne 0 ] && echo 'root privilege required' && exit 1
|
||||
[[ "$UID" -ne 0 ]] && echo 'root privilege required' && exit 1
|
||||
|
||||
echo TODO: self-upgrade
|
||||
current=$(miaou-bash --version)
|
||||
latest=$("$MIAOU_BASH_DIR/tools/wget_semver" artcode miaou/miaou-bash)
|
||||
|
||||
if [[ "$current" == "$latest" ]]; then
|
||||
echo "up-to-date version: $current"
|
||||
MIAOU_BASH_DIR='' source ../install.sh
|
||||
else
|
||||
MIAOU_BASH_DIR='' source ../install.sh
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user