mirror of
https://github.com/buildplan/du_setup.git
synced 2025-12-29 16:14:59 +00:00
update usage/help flag
This commit is contained in:
50
du_setup.sh
50
du_setup.sh
@@ -95,7 +95,7 @@ else
|
|||||||
PURPLE='\033[0;35m'
|
PURPLE='\033[0;35m'
|
||||||
CYAN='\033[0;36m'
|
CYAN='\033[0;36m'
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
BOLD=''
|
BOLD='\033[1m'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@@ -123,34 +123,40 @@ ID="" # This will be populated from /etc/os-release
|
|||||||
FAILED_SERVICES=()
|
FAILED_SERVICES=()
|
||||||
|
|
||||||
show_usage() {
|
show_usage() {
|
||||||
cat << EOF
|
printf "\n"
|
||||||
${CYAN}Debian/Ubuntu Server Setup and Hardening Script${NC}
|
printf "${CYAN}%s${NC}\n" "Debian/Ubuntu Server Setup & Hardening Script"
|
||||||
|
|
||||||
Usage: $(basename "$0") [OPTIONS]
|
printf "\n${BOLD}Usage:${NC}\n"
|
||||||
|
printf " %s [OPTIONS]\n" "$(basename "$0")"
|
||||||
|
|
||||||
Options:
|
printf "\n${BOLD}Description:${NC}\n"
|
||||||
--quiet Suppress verbose output
|
printf " This script provisions a fresh Debian or Ubuntu server with secure base configurations.\n"
|
||||||
--cleanup-preview Preview what cleanup would do without making changes
|
printf " It handles updates, firewall, SSH hardening, user creation, and optional tools.\n"
|
||||||
--cleanup-only Run only the provider cleanup function (for existing servers)
|
|
||||||
--skip-cleanup Skip the provider cleanup function entirely
|
|
||||||
-h, --help Display this help message
|
|
||||||
|
|
||||||
Examples:
|
printf "\n${BOLD}Operational Modes:${NC}\n"
|
||||||
# Normal interactive run (includes cleanup prompt)
|
printf " %-22s %s\n" "--cleanup-preview" "Show which provider packages/users would be cleaned without making changes."
|
||||||
sudo ./du_setup.sh
|
printf " %-22s %s\n" "--cleanup-only" "Run only the provider cleanup function (for existing servers)."
|
||||||
|
|
||||||
# Preview what cleanup would detect and remove
|
printf "\n${BOLD}Modifiers:${NC}\n"
|
||||||
sudo ./du_setup.sh --cleanup-preview
|
printf " %-22s %s\n" "--skip-cleanup" "Skip provider cleanup entirely during a full setup run."
|
||||||
|
printf " %-22s %s\n" "--quiet" "Suppress verbose output (intended for automation)."
|
||||||
|
printf " %-22s %s\n" "-h, --help" "Display this help message and exit."
|
||||||
|
|
||||||
# Run only cleanup on an existing server
|
printf "\n${BOLD}Usage Examples:${NC}\n"
|
||||||
sudo ./du_setup.sh --cleanup-only
|
printf " # Run the full interactive setup\n"
|
||||||
|
printf " ${YELLOW}sudo ./%s${NC}\n\n" "$(basename "$0")"
|
||||||
|
printf " # Preview provider cleanup actions without applying them\n"
|
||||||
|
printf " ${YELLOW}sudo ./%s --cleanup-preview${NC}\n\n" "$(basename "$0")"
|
||||||
|
printf " # Run a full setup but skip the provider cleanup step\n"
|
||||||
|
printf " ${YELLOW}sudo ./%s --skip-cleanup${NC}\n" "$(basename "$0")"
|
||||||
|
|
||||||
# Run full setup but skip cleanup
|
printf "\n${BOLD}Important Notes:${NC}\n"
|
||||||
sudo ./du_setup.sh --skip-cleanup
|
printf " - Logs are saved to ${BOLD}/var/log/du_setup_*.log${NC}\n"
|
||||||
|
printf " - Backups of modified configs are in ${BOLD}/root/setup_harden_backup_*${NC}\n"
|
||||||
|
printf " - For full documentation, see the project repository:\n"
|
||||||
|
printf " ${CYAN}%s${NC}\n" "https://github.com/buildplan/du-setup"
|
||||||
|
|
||||||
For more information: https://github.com/buildplan/du-setup
|
printf "\n"
|
||||||
|
|
||||||
EOF
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user