#!/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 - The path of where conf files live on the device # $3 - output sha file path (eg: /home/root/settings.crc) # NOTE: The expectation is the configuration files are in a parent folder settings # eg. $HOME/project/application/resources/settings/ if [ $# -lt 3 ]; 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 {} \; > "$3" # strip it of the absolute path string sed -i "s+ .*$1+ $2/+g" $3 if [ $? -eq 0 ]; then echo "" exit 0 else echo "Generation of SHA file failed." exit 1002 fi