Allow all commands of proxmox-backup-client, improve help and add full-help

This commit is contained in:
2026-08-22 00:42:13 +02:00
parent 2140cb688c
commit 15e245e3b4
+53 -18
View File
@@ -1,24 +1,46 @@
#!/usr/bin/env bash
function usage() {
full=${1:-false}
cat <<EOF
Usage: $SCRIPT COMMAND
Usage: $SCRIPT [-h] [-H] [-c config] command [OPTIONS]
Helper script for proxmox-backup-client.
Available commands:
Options:
-h, --help show this help message and exit
-H, --full-help show this help message and all commands of proxmox-backup-client
if it is available
-c, --config CONFIG path to config file, default: $ETC_DIR/config
backup Run backup and print output to screen.
backup-cron Run backup and suppress output on success.
list List groups, latest snapshots and archives.
snapshot-list [GROUP] List snapshots, sizes and archives.
catalog-shell [SNAPSHOT [ARCHIVE]] Run interactive shell to explore arhive contents
and restore files/dirs selectively.
mount [SNAPSHOT [ARCHIVE [TARGET]]] Mount snapshot archive locally.
Commands:
backup run backup and print output to screen
backup-cron run backup and suppress output on success
list list groups, latest snapshots and archives
snapshot-list [group] list snapshots, sizes and archives
catalog-shell [snapshot [archive]] run interactive shell to explore arhive contents
and restore files/dirs selectively
mount [snapshot [archive [target]]] mount snapshot archive locally
install [--update] install proxmox-backup-client binary and dependencies
use --update to update the currently installed binary
install [--update] Install proxmox-backup-client binary and dependencies.
Use --update to update the currently installed binary.
EOF
! $full && cat <<EOF
Other commands and options are passed to proxmox-backup-client.
See \`$SCRIPT -H\` for a full help message including all available commands.
EOF
}
function full_usage() {
usage true
[ ! -e "$PBC" ] && echo "Error: $PBC is not executable!" >&2 && return 254
echo "Commands of proxmox-backup-client:"
echo
"$PBC" help | tail -n +3
echo
return $?
}
function pbc-version() {
@@ -189,9 +211,6 @@ while [ -n "$1" ]; do
shift
if [ -z "$action" ]; then
case "$opt" in
backup|backup-cron|list|snapshot-list|catalog-shell|mount|install)
action=$opt
;;
-c|--config)
cfgfile=$1
shift
@@ -201,17 +220,34 @@ while [ -n "$1" ]; do
usage
exit 0
;;
*)
-H|--full-help)
full_usage
exit 0
;;
-*)
echo "Error: invalid option: $opt" >&2
echo
usage
exit 255
;;
*)
action=$opt
;;
esac
elif [ "$action" == "install" ]; then
case "$opt" in
-u|--update)
args+=('true')
;;
-*)
echo "Error: invalid option: $opt" >&2
echo
usage
exit 255
;;
*)
echo "Error: invalid argument: $opt" >&2
echo
usage
exit 255
;;
@@ -321,7 +357,7 @@ case "$action" in
read -r target
[ -d "$target" ] && break
echo -e "\nError: $target: no such directory\n" >&2
target=''
target=''
done
elif [ ! -d "$target" ]; then
echo "Error: $target: no such directory" >&2
@@ -362,7 +398,6 @@ case "$action" in
echo "$action successful!"
;;
*)
usage
exit 1
"$PBC" "$action" "${args[@]}" || exit $?
;;
esac