Skip to content

Instantly share code, notes, and snippets.

@noahbliss
Last active September 29, 2021 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noahbliss/0e19e089c1fc53779fc1bdec09761182 to your computer and use it in GitHub Desktop.
Save noahbliss/0e19e089c1fc53779fc1bdec09761182 to your computer and use it in GitHub Desktop.
HX Agent Linux Distribution Conditional Installer
#!/usr/bin/env bash
# Noah Bliss - 2021.09.29
if [ -f /etc/os-release ]; then source /etc/os-release; else echo "os-release missing or not Linux" && exit 1; fi
tgzfile="IMAGE_HX_AGENT_LINUX_32.30.16.tgz"
debfile="xagt_32.30.16-1.ubuntu16_amd64.deb"
rpmfile="xagt-32.30.16-1.el7.x86_64.rpm"
mkdir hxagent
tar -zxf "$tgzfile" -C hxagent
if (echo $ID_LIKE | grep -q "debian"); then
dpkg -i "hxagent/$debfile"
r="true"
elif (echo "$ID_LIKE" | grep -q "centos") || (echo "$ID" | grep -q "centos"); then
rpm -ihv "hxagent/$rpmfile"
r="true"
fi
if [ "$r" == "true" ]; then
/opt/fireeye/bin/xagt -i "hxagent/agent_config.json"
fi
if command -v systemctl > /dev/null; then
systemctl enable xagt
systemctl start xagt
else
service xagt start
fi
rm -rf hxagent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment