diff --git a/HIRS_AttestationCAPortal/build.gradle b/HIRS_AttestationCAPortal/build.gradle index ea3282d2..9a15645c 100644 --- a/HIRS_AttestationCAPortal/build.gradle +++ b/HIRS_AttestationCAPortal/build.gradle @@ -97,7 +97,6 @@ ospackage { } // Post Install - postInstall "echo ${jarVersion} > /opt/hirs/aca/VERSION" postInstall 'bash /opt/hirs/aca/scripts/aca/aca_setup.sh -u' // add chrontab to run ACA at boot postInstall 'echo "@reboot root /opt/hirs/aca/scripts/aca/aca_bootRun.sh -w" >> /etc/crontab' @@ -105,6 +104,8 @@ ospackage { postInstall '/opt/hirs/aca/scripts/aca/aca_bootRun.sh -w &' postInstall 'chmod +x /opt/hirs/aca/scripts/aca/*' postInstall 'bash /opt/hirs/aca/scripts/aca/check_for_aca.sh' + postInstall 'mkdir -p /etc/hirs/aca && touch /etc/hirs/aca/VERSION' + postInstall "echo ${jarVersion} > /etc/hirs/aca/VERSION" // Uninstall preUninstall 'bash /opt/hirs/aca/scripts/aca/aca_remove_setup.sh' diff --git a/package/scripts/aca/aca_setup.sh b/package/scripts/aca/aca_setup.sh index 42f5d7ea..ed1ef78b 100755 --- a/package/scripts/aca/aca_setup.sh +++ b/package/scripts/aca/aca_setup.sh @@ -12,7 +12,8 @@ LOG_FILE_NAME="hirs_aca_install_"$(date +%Y-%m-%d).log LOG_DIR="/var/log/hirs/" LOG_FILE="$LOG_DIR$LOG_FILE_NAME" HIRS_JSON_DIR="/etc/hirs/aca/default-properties" -ACA_PROP_FILE="/etc/hirs/aca/aca.properties" +ACA_OPT_DIR="/opt/hirs/aca/" +ACA_VERSION_FILE="/opt/hirs/aca/VERSION" SPRING_PROP_FILE="/etc/hirs/aca/application.properties" PROP_FILE='../../../HIRS_AttestationCAPortal/src/main/resources/application.properties' COMP_JSON='../../../HIRS_AttestationCA/src/main/resources/component-class.json' @@ -66,7 +67,7 @@ done set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters -mkdir -p $HIRS_CONF_DIR $LOG_DIR $HIRS_JSON_DIR +mkdir -p $HIRS_CONF_DIR $LOG_DIR $HIRS_JSON_DIR $ACA_OPT_DIR touch "$LOG_FILE" pushd $SCRIPT_DIR &>/dev/null @@ -86,6 +87,10 @@ fi echo "HIRS ACA Setup initiated on $(date +%Y-%m-%d)" >> "$LOG_FILE" +# Create a version file for bootRun to use +jarVersion=$(cat '../../../VERSION').$(date +%s).$(git rev-parse --short HEAD) +echo $jarVersion > $ACA_VERSION_FILE + # Set HIRS PKI password if [ -z $HIRS_PKI_PWD ]; then # Create a 32 character random password