Skip to content

Commit

Permalink
Merge pull request #96 from huntresslabs/feature/sc-138748-update-use…
Browse files Browse the repository at this point in the history
…r-facing-installation-scripts-be

allow install script to handle tags and system extension
  • Loading branch information
apackel-huntress authored Aug 29, 2024
2 parents c1ac4d0 + f9ce33c commit 91e7625
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions Bash/InstallHuntress-macOS-bash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,14 @@ Usage: $0 [options...] --account_key=<account_key> --organization_key=<organizat
-a, --account_key <account_key> The account key to use for this agent install
-o, --organization_key <organization_key> The org key to use for this agent install
-t, --tags <tags> A comma-separated list of agent tags
-i, --install_system_extension If passed, automatically install the system extension
-h, --help Print this message
EOF
}

while getopts a:o:h:-: OPT; do
while getopts a:o:h:t:-:i OPT; do
if [ "$OPT" = "-" ]; then
OPT="${OPTARG%%=*}" # extract long option name
OPTARG="${OPTARG#$OPT}" # extract long option argument (may be empty)
Expand All @@ -124,6 +126,12 @@ while getopts a:o:h:-: OPT; do
o | organization_key)
organization_key="$OPTARG"
;;
t | tags)
tags="$OPTARG"
;;
i | install_system_extension)
install_system_extension=true
;;
h | help)
usage
;;
Expand Down Expand Up @@ -162,6 +170,14 @@ if ! [[ "$account_key" =~ $pattern ]]; then
accountKey=$(echo "$account_key" | xargs)
fi

if [ -n "$tags" ]; then
logger "using tags: $tags"
fi

if [ "$install_system_extension" = true ]; then
logger "automatically installing system extension"
fi

# Hide most of the account key in the logs, keeping the front and tail end for troubleshooting
masked="$(echo "${accountKey:0:4}")"
masked+="************************"
Expand Down Expand Up @@ -194,9 +210,9 @@ if grep -Fq "$invalid_key" "$install_script"; then
fi

if [ "$install_system_extension" = true ]; then
install_result="$(/bin/bash "$install_script" -a "$accountKey" -o "$organizationKey" -v --install_system_extension)"
install_result="$(/bin/bash "$install_script" -a "$accountKey" -o "$organizationKey" -t "$tags" -v --install_system_extension)"
else
install_result="$(/bin/bash "$install_script" -a "$accountKey" -o "$organizationKey" -v)"
install_result="$(/bin/bash "$install_script" -a "$accountKey" -o "$organizationKey" -t "$tags" -v)"
fi

logger "=============== Begin Installer Logs ==============="
Expand Down

0 comments on commit 91e7625

Please sign in to comment.