2023-08-23 20:30:06 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#####################################################################################
|
|
|
|
#
|
|
|
|
# Script to remove ACA setup files and database items.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#####################################################################################
|
|
|
|
|
|
|
|
SCRIPT_DIR=$( dirname -- "$( readlink -f -- "$0"; )"; )
|
|
|
|
LOG_FILE=/dev/null
|
|
|
|
|
|
|
|
# Check for Admin privileges
|
|
|
|
if [ "$EUID" -ne 0 ]; then
|
|
|
|
echo "This script requires root. ACA setup not removed. Please run as root."
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-09-18 20:48:29 +00:00
|
|
|
|
|
|
|
source $SCRIPT_DIR/../db/mysql_util.sh
|
|
|
|
|
2024-02-13 13:59:43 +00:00
|
|
|
# Make sure mysql root password is available and set $DB_ADIM_PWD before continuing...
|
|
|
|
check_mariadb_install
|
|
|
|
|
2023-09-18 20:48:29 +00:00
|
|
|
check_mysql_root
|
2023-08-23 20:30:06 +00:00
|
|
|
|
|
|
|
# remove the hrs-db and hirs_db user
|
2023-09-18 20:48:29 +00:00
|
|
|
pushd $SCRIPT_DIR/../db/ &>/dev/null
|
2023-10-05 20:05:21 +00:00
|
|
|
./db_drop.sh $DB_ADMIN_PWD
|
2023-09-18 20:48:29 +00:00
|
|
|
popd &>/dev/null
|
2023-08-23 20:30:06 +00:00
|
|
|
|
2023-09-27 18:40:18 +00:00
|
|
|
# remove pki files and config files if not installed by rpm
|
2023-08-23 20:30:06 +00:00
|
|
|
echo "Removing certificates and config files..."
|
2024-02-13 13:59:43 +00:00
|
|
|
|
2024-02-16 14:45:47 +00:00
|
|
|
# Remove /opt/hirs only if not configured by a package basedd install:
|
|
|
|
if [ ! -f /etc/hirs/aca/VERSION ]; then
|
2024-02-21 18:16:13 +00:00
|
|
|
if [ -d "/etc/hirs" ]; then
|
|
|
|
rm -rf /etc/hirs >/dev/null 2>&1
|
|
|
|
fi
|
2024-02-16 14:45:47 +00:00
|
|
|
if [ -d "/opt/hirs" ]; then
|
|
|
|
rm -rf /opt/hirs >/dev/null 2>&1
|
|
|
|
fi
|
2023-09-27 18:40:18 +00:00
|
|
|
fi
|
2023-08-23 20:30:06 +00:00
|
|
|
|
2023-09-13 20:56:39 +00:00
|
|
|
# Remove crontab and current ACA process
|
|
|
|
echo "Removing the ACA crontab"
|
|
|
|
sed -i '/aca_bootRun.sh/d' /etc/crontab
|
|
|
|
echo "Shutting down the aca..."
|
|
|
|
ps axf | grep HIRS_AttestationCAPortal.war | grep -v grep | awk '{print "kill " $1}' | sh >/dev/null 2>&1
|
2023-10-05 20:05:21 +00:00
|
|
|
echo "ACA setup removal complete."
|