diff --git a/README.md b/README.md index e167c9f..c3f2ecc 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,17 @@ curl -fsSL https://git.ccc-rheintal.ch/spacefreak/pbc/raw/branch/master/install. This installs the newest tagged version to `/usr/local/bin/pbc`, installs the dependencies, and puts an example config at `/etc/pbc/config.example`. +### Installing a specific version + +Set `PBC_GIT_TAG` to install that tag instead of the newest one: + +```bash +curl -fsSL https://git.ccc-rheintal.ch/spacefreak/pbc/raw/branch/master/install.sh | sudo PBC_GIT_TAG=v1.0.0 bash +``` + +`sudo` drops the environment, so set the variable on the `sudo` command itself (or use +`sudo -E`), not before `curl`. Any Git ref works, e.g. a branch name for testing. + ### Updating Run the same command again to update `pbc` itself: @@ -32,7 +43,7 @@ curl -fsSL https://git.ccc-rheintal.ch/spacefreak/pbc/raw/branch/master/install. ``` It fetches the newest tag and overwrites `/usr/local/bin/pbc`. Your `/etc/pbc/config` is -left untouched. +left untouched. `PBC_GIT_TAG` works here too, to pin or roll back to a given version. To update only the `proxmox-backup-client` binary: diff --git a/install.sh b/install.sh index 6832462..acbfc6b 100755 --- a/install.sh +++ b/install.sh @@ -13,7 +13,7 @@ function cleanup_work_dir() { function download_files() { local path rc local query_params='' - [ -n "$GIT_TAG" ] && query_params="?ref=$GIT_TAG" + [ -n "$PBC_GIT_TAG" ] && query_params="?ref=$PBC_GIT_TAG" while (( $# > 0 )); do path=$1 @@ -26,9 +26,9 @@ function download_files() { done } -GIT_TAG=$(curl -fsSL "$API_ENDPOINT/tags" | grep -o '{"name":"[^"]*"' | sed 's/^{"name":"//;s/"$//' | grep -E '^v[0-9]+' | sort --version-sort | tail -n 1) -if [ -n "$GIT_TAG" ]; then - echo "Info: installing pbc version $GIT_TAG" +[ -z "$PBC_GIT_TAG" ] && PBC_GIT_TAG=$(curl -fsSL "$API_ENDPOINT/tags" | grep -o '{"name":"[^"]*"' | sed 's/^{"name":"//;s/"$//' | grep -E '^v[0-9]+' | sort --version-sort | tail -n 1) +if [ -n "$PBC_GIT_TAG" ]; then + echo "Info: installing pbc version $PBC_GIT_TAG" else echo "Warning: no Git tag found, installing from repository default branch" >&2 fi