Skip to content

Commit

Permalink
add uninstall commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Caleb-Hurshman committed Feb 5, 2025
1 parent e6485b5 commit 849e2cc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 24 deletions.
25 changes: 13 additions & 12 deletions scripts/install/install_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ usage()
USAGE=$(cat <<EOF
Usage:
$(fg_yellow '-v, --version')
Defines the version of the BindPlane Agent.
Defines the version of the Bindplane Agent.
If not provided, this will default to the latest version.
Alternatively the COLLECTOR_VERSION environment variable can be
set to configure the agent version.
Expand All @@ -179,7 +179,7 @@ Usage:
$(fg_yellow '-l, --url')
Defines the URL that the components will be downloaded from.
If not provided, this will default to BindPlane Agent\'s GitHub releases.
If not provided, this will default to Bindplane Agent\'s GitHub releases.
Example: '-l http://my.domain.org/observiq-otel-collector' will download from there.
$(fg_yellow '-b, --base-url')
Expand Down Expand Up @@ -208,9 +208,9 @@ Usage:
The '--endpoint' flag must be specified if this flag is specified.
$(fg_yellow '-c, --check-bp-url')
Check access to the BindPlane server URL.
Check access to the Bindplane server URL.
This parameter will have the script check access to BindPlane based on the provided '--endpoint'
This parameter will have the script check access to Bindplane based on the provided '--endpoint'
$(fg_yellow '-q, --quiet')
Use quiet (non-interactive) mode to run the script in headless environments
Expand Down Expand Up @@ -297,23 +297,23 @@ interactive_check()
if [ "$non_interactive" = "true" ] && [ "$check_bp_url" = "true" ]
then
failed
error_exit "$LINENO" "Checking the BindPlane server URL is not compatible with quiet (non-interactive) mode."
error_exit "$LINENO" "Checking the Bindplane server URL is not compatible with quiet (non-interactive) mode."
fi
}

# Test connection to BindPlane if it was specified
# Test connection to Bindplane if it was specified
connection_check()
{
if [ "$check_bp_url" = "true" ] ; then
if [ -n "$opamp_endpoint" ]; then
HTTP_ENDPOINT="$(echo "${opamp_endpoint}" | sed 's#^ws#http#' | sed 's#/v1/opamp$##')"
info "Testing connection to BindPlane: $fg_magenta$HTTP_ENDPOINT$reset..."
info "Testing connection to Bindplane: $fg_magenta$HTTP_ENDPOINT$reset..."

if curl --max-time 20 -s "${HTTP_ENDPOINT}" > /dev/null; then
succeeded
else
failed
warn "Connection to BindPlane has failed."
warn "Connection to Bindplane has failed."
increase_indent
printf "%sDo you wish to continue installation?%s " "$fg_yellow" "$reset"
prompt "n"
Expand All @@ -323,7 +323,7 @@ connection_check()
if [ "$input" = "y" ] || [ "$input" = "Y" ]; then
info "Continuing installation."
else
error_exit "$LINENO" "Aborting due to user input after connectivity failure between this system and the BindPlane server."
error_exit "$LINENO" "Aborting due to user input after connectivity failure between this system and the Bindplane server."
fi
fi
fi
Expand Down Expand Up @@ -492,7 +492,7 @@ latest_version()
# This will install the package by downloading & unpacking the tarball into the install directory
install_package()
{
banner "Installing BindPlane Agent"
banner "Installing Bindplane Agent"
increase_indent

# Remove temporary directory, if it exists
Expand Down Expand Up @@ -584,7 +584,7 @@ install_package()
rm -rf "$TMP_DIR" || error_exit "$LINENO" "Failed to remove temp dir: $TMP_DIR"
succeeded

success "BindPlane Agent installation complete!"
success "Bindplane Agent installation complete!"
decrease_indent
}

Expand Down Expand Up @@ -619,6 +619,7 @@ display_results()
info "Start Command: $(fg_cyan "sudo launchctl load /Library/LaunchDaemons/$SERVICE_NAME.plist")$(reset)"
info "Stop Command: $(fg_cyan "sudo launchctl unload /Library/LaunchDaemons/$SERVICE_NAME.plist")$(reset)"
info "Logs Command: $(fg_cyan "sudo tail -F $INSTALL_DIR/log/collector.log")$(reset)"
info "Uninstall Command: $(fg_cyan "sudo sh -c "$(curl -fsSlL https://github.com/observIQ/bindplane-otel-collector/releases/latest/download/install_macos.sh)" install_macos.sh -r")$(reset)"
decrease_indent

banner 'Support'
Expand All @@ -636,7 +637,7 @@ display_results()

uninstall()
{
banner "Uninstalling BindPlane Agent"
banner "Uninstalling Bindplane Agent"
increase_indent

if [ ! -f "$INSTALL_DIR/observiq-otel-collector" ]; then
Expand Down
26 changes: 14 additions & 12 deletions scripts/install/install_unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ usage()
USAGE=$(cat <<EOF
Usage:
$(fg_yellow '-v, --version')
Defines the version of the BindPlane Agent.
Defines the version of the Bindplane Agent.
If not provided, this will default to the latest version.
Alternatively the COLLECTOR_VERSION environment variable can be
set to configure the agent version.
Expand All @@ -188,7 +188,7 @@ Usage:
$(fg_yellow '-l, --url')
Defines the URL that the components will be downloaded from.
If not provided, this will default to BindPlane Agent\'s GitHub releases.
If not provided, this will default to Bindplane Agent\'s GitHub releases.
Example: '-l http://my.domain.org/observiq-otel-collector' will download from there.
$(fg_yellow '-b, --base-url')
Expand Down Expand Up @@ -230,9 +230,9 @@ Usage:
The '--endpoint' flag must be specified if this flag is specified.
$(fg_yellow '-c, --check-bp-url')
Check access to the BindPlane server URL.
Check access to the Bindplane server URL.
This parameter will have the script check access to BindPlane based on the provided '--endpoint'
This parameter will have the script check access to Bindplane based on the provided '--endpoint'
$(fg_yellow '-q, --quiet')
Use quiet (non-interactive) mode to run the script in headless environments
Expand Down Expand Up @@ -485,19 +485,19 @@ set_opamp_secret_key()
fi
}

# Test connection to BindPlane if it was specified
# Test connection to Bindplane if it was specified
connection_check()
{
if [ -n "$check_bp_url" ] ; then
if [ -n "$opamp_endpoint" ]; then
HTTP_ENDPOINT="$(echo "${opamp_endpoint}" | sed -z 's#^ws#http#' | sed -z 's#/v1/opamp$##')"
info "Testing connection to BindPlane: $fg_magenta$HTTP_ENDPOINT$reset..."
info "Testing connection to Bindplane: $fg_magenta$HTTP_ENDPOINT$reset..."

if curl --max-time 20 -s "${HTTP_ENDPOINT}" > /dev/null; then
succeeded
else
failed
warn "Connection to BindPlane has failed."
warn "Connection to Bindplane has failed."
increase_indent
printf "%sDo you wish to continue installation?%s " "$fg_yellow" "$reset"
prompt "n"
Expand All @@ -507,7 +507,7 @@ connection_check()
if [ "$input" = "y" ] || [ "$input" = "Y" ]; then
info "Continuing installation."
else
error_exit "$LINENO" "Aborting due to user input after connectivity failure between this system and the BindPlane server."
error_exit "$LINENO" "Aborting due to user input after connectivity failure between this system and the Bindplane server."
fi
fi
fi
Expand Down Expand Up @@ -553,7 +553,7 @@ interactive_check()
if [ "$non_interactive" = "true" ] && [ "$check_bp_url" = "true" ]
then
failed
error_exit "$LINENO" "Checking the BindPlane server URL is not compatible with quiet (non-interactive) mode."
error_exit "$LINENO" "Checking the Bindplane server URL is not compatible with quiet (non-interactive) mode."
fi
}

Expand Down Expand Up @@ -640,7 +640,7 @@ latest_version()
# extracting the binaries, and then removing the archive.
install_package()
{
banner "Installing BindPlane Agent"
banner "Installing Bindplane Agent"
increase_indent

# if the user didn't specify a local file then download the package
Expand Down Expand Up @@ -710,7 +710,7 @@ install_package()
esac
fi

success "BindPlane Agent installation complete!"
success "Bindplane Agent installation complete!"
decrease_indent
}

Expand Down Expand Up @@ -762,10 +762,12 @@ display_results()
info "Start Command: $(fg_cyan "sudo systemctl start observiq-otel-collector")$(reset)"
info "Stop Command: $(fg_cyan "sudo systemctl stop observiq-otel-collector")$(reset)"
info "Status Command: $(fg_cyan "sudo systemctl status observiq-otel-collector")$(reset)"
info "Uninstall Command: $(fg_cyan "sudo systemctl observiq-otel-collector -r")$(reset)"
else
info "Start Command: $(fg_cyan "sudo service observiq-otel-collector start")$(reset)"
info "Stop Command: $(fg_cyan "sudo service observiq-otel-collector stop")$(reset)"
info "Status Command: $(fg_cyan "sudo service observiq-otel-collector status")$(reset)"
info "Uninstall Command: $(fg_cyan "sudo service observiq-otel-collector -r")$(reset)"
fi
info "Logs Command: $(fg_cyan "sudo tail -F /opt/observiq-otel-collector/log/collector.log")$(reset)"
decrease_indent
Expand Down Expand Up @@ -805,7 +807,7 @@ uninstall_package()
uninstall()
{
set_package_type
banner "Uninstalling BindPlane Agent"
banner "Uninstalling Bindplane Agent"
increase_indent

info "Checking permissions..."
Expand Down

0 comments on commit 849e2cc

Please sign in to comment.