Skip to content

Instantly share code, notes, and snippets.

@foospidy
Last active February 25, 2019 13:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save foospidy/ec91df7682ee3872deeafbc8734a5d60 to your computer and use it in GitHub Desktop.
Save foospidy/ec91df7682ee3872deeafbc8734a5d60 to your computer and use it in GitHub Desktop.
honeydb-agent install script.
#!/usr/bin/env bash
#
# Installs/upgrades the latest version of honeydb-agent.
# An existing configuration will be backed up, and applied
# to the new install/upgrade.
#
# sudo ./honeydb-agent-install.sh
#
ARCHITECTURE=`uname -m`
# backup config if needed
mkdir -p .honeydb-agent-backup
if [ -d /etc/honeydb ];
then
cp /etc/honeydb/* .honeydb-agent-backup/
fi
# check for curl, install if needed
if [ -z `which curl` ];
then
apt-get update
apt-get install -y curl
fi
# setup repo if needed
if [ ! -f /etc/apt/sources.list.d/honeydb-honeydb-agent.list ];
then
curl -1sLf 'https://dl.cloudsmith.io/public/honeydb/honeydb-agent/cfg/setup/bash.deb.sh' | bash
#apt-get install -y debian-keyring
#apt-get install -y debian-archive-keyring
#apt-get install -y apt-transport-https
#curl -1sLf 'https://dl.cloudsmith.io/public/honeydb/honeydb-agent/cfg/gpg/gpg.305CBD56E3FE07CA.key' | apt-key add -
#curl -1sLf 'https://dl.cloudsmith.io/public/honeydb/honeydb-agent/cfg/setup/config.deb.txt?codename=jessie&distro=debian' > /etc/apt/sources.list.d/honeydb-honeydb-agent.list
#apt-get update
fi
# get latest agent
apt-get -y install honeydb-agent
# clean up
apt-get -y autoremove
# restore config
if [ -f .honeydb-agent-backup/agent.conf ];
then
cp .honeydb-agent-backup/* /etc/honeydb/
fi
# restart agent
service honeydb-agent restart
systemctl honeydb-agent restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment