install.fairie/home/dot_local/bin/post-installx/executable_post-rkhunter.sh

23 lines
1.1 KiB
Bash
Raw Normal View History

2024-05-04 21:05:33 -07:00
#!/usr/bin/env bash
# @file rkhunter configuration
# @brief This script applies the rkhunter integration and updates it as well
2024-05-27 20:45:14 -07:00
set -Eeuo pipefail
2024-05-27 20:50:11 -07:00
trap "gum log -sl error 'Script encountered an error!'" ERR
2024-05-27 04:15:03 -07:00
2024-05-04 21:05:33 -07:00
if command -v rkhunter > /dev/null; then
if [ -d /Applications ] && [ -d /System ]; then
### macOS
2024-05-27 20:50:11 -07:00
gum log -sl info 'Updating file "$(brew --prefix)/Cellar/rkhunter/1.4.6/etc/rkhunter.conf"' && gsed -i "s/^#WEB_CMD.*$/WEB_CMD=curl\ -L/" "$(brew --prefix)/Cellar/rkhunter/1.4.6/etc/rkhunter.conf"
2024-05-19 23:06:00 -07:00
export PATH="$(echo "$PATH" | gsed 's/VMware Fusion.app/VMwareFusion.app/g')"
export PATH="$(echo "$PATH" | gsed 's/IntelliJ IDEA CE.app/IntelliJIDEACE.app/g')"
2024-05-04 21:05:33 -07:00
else
### Linux
2024-05-27 20:50:11 -07:00
gum log -sl info 'Updating file /etc/rkhunter.conf' && sed -i "s/^#WEB_CMD.*$/WEB_CMD=curl\ -L/" /etc/rkhunter.conf
2024-05-04 21:05:33 -07:00
fi
2024-05-27 23:55:42 -07:00
sudo rkhunter --propupd || gum log -sl warn "sudo rkhunter --propupd returned non-zero exit code"
sudo rkhunter --update || gum log -sl warn "sudo rkhunter --update returned non-zero exit code"
2024-05-04 21:05:33 -07:00
else
2024-05-27 20:50:11 -07:00
gum log -sl info 'rkhunter is not installed'
2024-05-04 21:05:33 -07:00
fi