netbird-install-update: add --help option with usage, options, and examples
This commit is contained in:
@@ -74,8 +74,47 @@ print_step() {
|
||||
echo -e " ${DIM}•${NC} $1"
|
||||
}
|
||||
|
||||
print_usage() {
|
||||
cat <<EOF
|
||||
Usage: netbird-install-update.sh [options]
|
||||
|
||||
Install, update, and manage Netbird across single or multiple Linux hosts.
|
||||
|
||||
Options:
|
||||
-h, --help Show this help message and exit
|
||||
--ssh <host> Deploy to a single host via SSH
|
||||
--hosts-file, --file <f> Deploy to multiple hosts from a file
|
||||
--timer Install a systemd auto-update timer
|
||||
--time <schedule> Timer schedule (systemd OnCalendar format, default: daily)
|
||||
-p, --password <pass> Sudo password for remote hosts (used with --ssh or --hosts-file)
|
||||
|
||||
Hosts file format (one per line):
|
||||
hostname_or_ip [sudo_password]
|
||||
|
||||
Examples:
|
||||
# Local install/update
|
||||
sudo ./netbird-install-update.sh
|
||||
|
||||
# Deploy to a single host via SSH
|
||||
./netbird-install-update.sh --ssh user@hostname
|
||||
|
||||
# Deploy to multiple hosts from a file
|
||||
./netbird-install-update.sh --hosts-file hosts.txt
|
||||
|
||||
# Deploy with auto-update timer
|
||||
./netbird-install-update.sh --ssh user@hostname --timer --time "weekly"
|
||||
|
||||
# Multi-host deployment with default sudo password
|
||||
./netbird-install-update.sh --hosts-file hosts.txt --password "mypass"
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
print_usage
|
||||
;;
|
||||
--ssh)
|
||||
SSH_HOST="$2"
|
||||
shift 2
|
||||
|
||||
Reference in New Issue
Block a user