#!/bin/sh
#/*************************************************************************************
#* Do NOT modify or remove this copyright and confidentiality notice                  *
#*                                                                                    *
#* Copyright 2017 - 2017 Seagate Technology LLC or one of its affiliates.             *
#*                                                                                    *
#* The code contained herein is CONFIDENTIAL to Seagate Technology LLC.               *
#* Portions may also be trade secret. Any use, duplication, derivation, distribution  *
#* or disclosure of this code, for any reason, not expressly authorized in writing by *
#* Seagate Technology LLC is prohibited. All rights are expressly reserved by         * 
#* Seagate Technology LLC                                                             *
#*************************************************************************************/

echo "STATUS: Loading security certificate file for trust verification"

# The uploadTrigger_trus will validate the server certificate with trust.
# It will first check if the server certificate can be validated with the existing trust certificate. 
# If yes, it will do nothing. 
# Else it will check for trust verification of the server certificate.  
# For successful case, it will update the existing trust certificate with the incoming trust.

certFile="/mnt/ramdisk/ldap-cert-file"

if [ -e /app/usr/bin/ssl/uploadTrigger_trust.sh ]; then
    uploadScript=/app/usr/bin/ssl/uploadTrigger_trust.sh
fi

if [ -e /cfg/bin/ssl/uploadTrigger_trust.sh ]; then
    uploadScript=/cfg/bin/ssl/uploadTrigger_trust.sh
fi

if [ ! -e $uploadScript ]; then
    echo "$0 - Error: uploadScript missing."
    exit 1
fi

${uploadScript} $certFile 

echo "Done with $0."
exit 0;

