Last active
September 29, 2021 18:39
-
-
Save noahbliss/0e19e089c1fc53779fc1bdec09761182 to your computer and use it in GitHub Desktop.
HX Agent Linux Distribution Conditional Installer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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