SHA256
allow all commands of proxmox-backup-client and improve help
This commit is contained in:
@@ -1,24 +1,46 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
function usage() {
|
function usage() {
|
||||||
|
full=${1:-false}
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Usage: $SCRIPT COMMAND
|
Usage: $SCRIPT [-h] [-H] [-c config] command [OPTIONS]
|
||||||
|
|
||||||
Helper script for proxmox-backup-client.
|
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.
|
Commands:
|
||||||
backup-cron Run backup and suppress output on success.
|
|
||||||
list List groups, latest snapshots and archives.
|
backup run backup and print output to screen
|
||||||
snapshot-list [GROUP] List snapshots, sizes and archives.
|
backup-cron run backup and suppress output on success
|
||||||
catalog-shell [SNAPSHOT [ARCHIVE]] Run interactive shell to explore arhive contents
|
list list groups, latest snapshots and archives
|
||||||
and restore files/dirs selectively.
|
snapshot-list [group] list snapshots, sizes and archives
|
||||||
mount [SNAPSHOT [ARCHIVE [TARGET]]] Mount snapshot archive locally.
|
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
|
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() {
|
function pbc-version() {
|
||||||
@@ -189,9 +211,6 @@ while [ -n "$1" ]; do
|
|||||||
shift
|
shift
|
||||||
if [ -z "$action" ]; then
|
if [ -z "$action" ]; then
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
backup|backup-cron|list|snapshot-list|catalog-shell|mount|install)
|
|
||||||
action=$opt
|
|
||||||
;;
|
|
||||||
-c|--config)
|
-c|--config)
|
||||||
cfgfile=$1
|
cfgfile=$1
|
||||||
shift
|
shift
|
||||||
@@ -201,17 +220,34 @@ while [ -n "$1" ]; do
|
|||||||
usage
|
usage
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
*)
|
-H|--full-help)
|
||||||
|
full_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
echo "Error: invalid option: $opt" >&2
|
||||||
|
echo
|
||||||
usage
|
usage
|
||||||
exit 255
|
exit 255
|
||||||
;;
|
;;
|
||||||
|
*)
|
||||||
|
action=$opt
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
elif [ "$action" == "install" ]; then
|
elif [ "$action" == "install" ]; then
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
-u|--update)
|
-u|--update)
|
||||||
args+=('true')
|
args+=('true')
|
||||||
;;
|
;;
|
||||||
|
-*)
|
||||||
|
echo "Error: invalid option: $opt" >&2
|
||||||
|
echo
|
||||||
|
usage
|
||||||
|
exit 255
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
|
echo "Error: invalid argument: $opt" >&2
|
||||||
|
echo
|
||||||
usage
|
usage
|
||||||
exit 255
|
exit 255
|
||||||
;;
|
;;
|
||||||
@@ -362,7 +398,6 @@ case "$action" in
|
|||||||
echo "$action successful!"
|
echo "$action successful!"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
usage
|
"$PBC" "$action" "${args[@]}" || exit $?
|
||||||
exit 1
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Reference in New Issue
Block a user