diff --git a/README.md b/README.md index a8cba04..946038d 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,26 @@ Install for the current user under `~/.local`: The installer adds the required packages automatically: `base-devel`, `git`, `curl`, and `jq`. +## Upgrade + +Already installed (preferred): + +```bash +miaur self-update --noconfirm +``` + +One-line reinstall from GitHub (same as install; overwrites the current prefix): + +```bash +bash <(curl -fsSL https://raw.githubusercontent.com/WHC2006/miaur/main/install.sh) +``` + +User install: + +```bash +bash <(curl -fsSL https://raw.githubusercontent.com/WHC2006/miaur/main/install.sh) --user +``` + ## Usage ```bash diff --git a/install.sh b/install.sh index f80d8d5..376b092 100644 --- a/install.sh +++ b/install.sh @@ -22,9 +22,11 @@ for arg in "$@"; do cat <<'EOF' Usage: install.sh [--user] [--uninstall] - (default) Install system-wide to /usr/local (needs sudo) - --user Install to ~/.local (no sudo for the link) + (default) Install or upgrade system-wide to /usr/local (needs sudo) + --user Install or upgrade to ~/.local (no sudo for the link) --uninstall Remove installed miaur + +Re-running this script upgrades an existing install in place. EOF exit 0 ;; @@ -108,7 +110,11 @@ do_install() { [[ -f $SRC/miaur && -d $SRC/lib ]] || die "incomplete source tree: $SRC" - echo "==> Installing to ${SHARE_DIR}" + if [[ -e $BIN_LINK || -d $SHARE_DIR ]]; then + echo "==> Updating existing install at ${SHARE_DIR}" + else + echo "==> Installing to ${SHARE_DIR}" + fi $SUDO mkdir -p "$SHARE_DIR" "${PREFIX}/bin" $SUDO rm -rf "$SHARE_DIR" $SUDO mkdir -p "$SHARE_DIR"