@@ -19,6 +19,7 @@ set -Eeuo pipefail
1919: " ${UPDATE:= false} "
2020: " ${STATIC_IP:= } "
2121: " ${LOCAL_PROFILE_PATH:= } "
22+ : " ${MINIMAL:= false} "
2223
2324# Enable alias expansion in non-interactive bash scripts.
2425# Required so commands like `dappnode_wireguard` (defined as aliases in `.dappnode_profile`) work.
@@ -49,6 +50,70 @@ die() {
4950 exit 1
5051}
5152
53+ usage () {
54+ cat << 'EOF '
55+ Usage: dappnode_install.sh [options]
56+
57+ Options:
58+ --update Clean existing downloaded artifacts before installing (equivalent: UPDATE=true)
59+ --static-ip <ipv4> Set a static IP (equivalent: STATIC_IP=...)
60+ --local-profile-path <path> Use a local .dappnode_profile instead of downloading (equivalent: LOCAL_PROFILE_PATH=...)
61+ --ipfs-endpoint <url> Override IPFS gateway endpoint (equivalent: IPFS_ENDPOINT=...)
62+ --profile-url <url> Override profile download URL (equivalent: PROFILE_URL=...)
63+ --minimal Force minimal package set: BIND VPN WIREGUARD DAPPMANAGER (equivalent: MINIMAL=true)
64+ -h, --help Show this help
65+
66+ Environment variables (also supported):
67+ UPDATE, STATIC_IP, LOCAL_PROFILE_PATH, IPFS_ENDPOINT, PROFILE_URL, MINIMAL
68+ EOF
69+ }
70+
71+ parse_args () {
72+ while [[ $# -gt 0 ]]; do
73+ case " $1 " in
74+ --update)
75+ UPDATE=true
76+ shift
77+ ;;
78+ --static-ip)
79+ [[ $# -ge 2 ]] || die " --static-ip requires an IPv4 argument"
80+ STATIC_IP=" $2 "
81+ shift 2
82+ ;;
83+ --local-profile-path)
84+ [[ $# -ge 2 ]] || die " --local-profile-path requires a path argument"
85+ LOCAL_PROFILE_PATH=" $2 "
86+ shift 2
87+ ;;
88+ --ipfs-endpoint)
89+ [[ $# -ge 2 ]] || die " --ipfs-endpoint requires a URL argument"
90+ IPFS_ENDPOINT=" $2 "
91+ shift 2
92+ ;;
93+ --profile-url)
94+ [[ $# -ge 2 ]] || die " --profile-url requires a URL argument"
95+ PROFILE_URL=" $2 "
96+ shift 2
97+ ;;
98+ --minimal)
99+ MINIMAL=true
100+ shift
101+ ;;
102+ -h|--help)
103+ usage
104+ exit 0
105+ ;;
106+ --)
107+ shift
108+ break
109+ ;;
110+ * )
111+ die " Unknown option: $1 (use --help)"
112+ ;;
113+ esac
114+ done
115+ }
116+
52117require_cmd () {
53118 local cmd=" $1 "
54119 command -v " $cmd " > /dev/null 2>&1 || die " Missing required command: $cmd "
@@ -443,6 +508,20 @@ is_port_used() {
443508
444509# Determine packages to be installed
445510determine_packages () {
511+ # Global override: minimal install, regardless of OS.
512+ if [[ " ${MINIMAL} " == " true" ]]; then
513+ PKGS=(BIND VPN WIREGUARD DAPPMANAGER)
514+ log " Minimal mode enabled; overriding packages"
515+ log " Packages to be installed: ${PKGS[*]} "
516+ log " PKGS: ${PKGS[*]} "
517+ for comp in " ${PKGS[@]} " ; do
518+ local ver_var
519+ ver_var=" ${comp} _VERSION"
520+ log " $ver_var = ${! ver_var-} "
521+ done
522+ return 0
523+ fi
524+
446525 # macOS: package selection depends on whether the Mac is suitable to run always-on.
447526 # - non-server mac: BIND VPN WIREGUARD DAPPMANAGER
448527 # - server mac: BIND IPFS VPN WIREGUARD DAPPMANAGER WIFI HTTPS
@@ -847,6 +926,8 @@ addUserToDockerGroup() {
847926# #############################################
848927
849928main () {
929+ parse_args " $@ "
930+
850931 bootstrap_filesystem
851932 check_prereqs
852933 configure_static_ip
0 commit comments