Index: scripts/check_config_files_sha.sh =================================================================== diff -u --- scripts/check_config_files_sha.sh (revision 0) +++ scripts/check_config_files_sha.sh (revision ed174614f1fa9c1b94e3dfc5d3366848974f8c5d) @@ -0,0 +1,45 @@ +#!/bin/sh +########################################################################### +# +# Copyright (c) 2021-2023 Diality Inc. - All Rights Reserved. +# +# THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN +# WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. +# +# @file generate_config_files_sha.sh +# +# @author (last) Vy +# @date (last) 25-Jul-2023 +# @author (original) Vy +# @date (original) 25-Jul-2023 +# +############################################################################ +# $1 - the path to the settings folder +# $2 - sha file path + +# NOTE: The expectation is the configuration files are in a parent folder settings +# eg. $HOME/project/application/resources/settings/ + +if [ $# -lt 2 ]; then + currentFile=$(basename "$0") + echo "Usage: ./$currentFile " + exit 1003 +fi + +# traverse to the settings folder where the conf files live +cd $1 + +# check the sha against stored +sha256sum -c $2 + +if [ $? -eq 0 ]; then + echo "" + exit 0 +else + echo "SHA check failed" + exit 1003 +fi + + + + Index: scripts/generate_config_files_sha.sh =================================================================== diff -u --- scripts/generate_config_files_sha.sh (revision 0) +++ scripts/generate_config_files_sha.sh (revision ed174614f1fa9c1b94e3dfc5d3366848974f8c5d) @@ -0,0 +1,45 @@ +#!/bin/sh +########################################################################### +# +# Copyright (c) 2021-2023 Diality Inc. - All Rights Reserved. +# +# THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN +# WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. +# +# @file generate_config_files_sha.sh +# +# @author (last) Vy +# @date (last) 25-Jul-2023 +# @author (original) Vy +# @date (original) 25-Jul-2023 +# +############################################################################ +# $1 - the path to the settings folder +# $2 - output sha file path + +# NOTE: The expectation is the configuration files are in a parent folder settings +# eg. $HOME/project/application/resources/settings/ + +if [ $# -lt 2 ]; then + currentFile=$(basename "$0") + echo "Usage: ./$currentFile " + exit 1003 +fi + +# find all .conf files in the given path +find $1 -type f -name '*.conf' -exec sha256sum {} \; > $2 + +# strip it of the absolute path string +sed -i "s+ .*settings/+ +g" $2 + +if [ $? -eq 0 ]; then + echo "" + exit 0 +else + echo "Generation of SHA file failed." + exit 1002 +fi + + + +