SHA256
Compare commits
4
Commits
2fdf065017
...
master
| Author | SHA256 | Date | |
|---|---|---|---|
|
|
ef76bdd8dd
|
||
|
|
873601019a
|
||
|
|
0ade18796f
|
||
|
|
0f61e177f8
|
@@ -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:
|
||||
|
||||
|
||||
+4
-5
@@ -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
|
||||
@@ -38,7 +38,6 @@ trap cleanup_work_dir EXIT
|
||||
|
||||
! download_files config.example pbc && echo "Error downloading files!" >&2 && exit 10
|
||||
chmod +x "$WORK_DIR/pbc"
|
||||
chmod o= "$WORK_DIR/config.example"
|
||||
|
||||
"$WORK_DIR/pbc" install
|
||||
rc=$?
|
||||
|
||||
@@ -86,7 +86,6 @@ function apt_get_install() {
|
||||
return $rc
|
||||
}
|
||||
|
||||
WORK_DIR=''
|
||||
function cleanup_work_dir() {
|
||||
[ -n "$WORK_DIR" ] && [ -d "$WORK_DIR" ] && rm -r "$WORK_DIR"
|
||||
trap - EXIT
|
||||
@@ -143,7 +142,6 @@ function install_proxmox_backup_client() {
|
||||
cleanup_work_dir
|
||||
}
|
||||
|
||||
|
||||
function arr_contains() {
|
||||
local search=$1
|
||||
shift
|
||||
@@ -275,7 +273,6 @@ while (( $# > 0 )); do
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
if [ -f "$cfgfile" ]; then
|
||||
perms=$(stat -c '%a' "$cfgfile")
|
||||
(( 8#$perms & 0022 )) && echo "Error: $cfgfile is writable by group or others!" >&2 && exit 202
|
||||
@@ -405,11 +402,9 @@ case "$action" in
|
||||
fi
|
||||
|
||||
if [ -f "$SCRIPT_DIR/config.example" ]; then
|
||||
if $update_pbc || [ ! -f "$ETC_DIR/config.example" ]; then
|
||||
echo "Install example config to $ETC_DIR/config.example ..."
|
||||
! install -m 0640 "$SCRIPT_DIR/config.example" "$ETC_DIR/config.example" && echo "Error installing file!" >&2 && exit 4
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Info: successfully installed pbc dependencies"
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user