From 7db36e8de4c0bd753d5b12983c3ed2375a6ccb7a Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Thu, 25 May 2023 15:31:02 +0200 Subject: [PATCH] Testing. Add known files to be downloaded/executed. --- .githooks/post-checkout | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/.githooks/post-checkout b/.githooks/post-checkout index f4c4a7e..821313e 100755 --- a/.githooks/post-checkout +++ b/.githooks/post-checkout @@ -1,20 +1,36 @@ -echo "POST-CHECKOUT" -echo "PREV-HEAD=$1" -echo "CURR-HEAD=$2" -echo "BRANCH-CHECKOUT=$3" +# echo "POST-CHECKOUT" +# echo "PREV-HEAD=$1" +# echo "CURR-HEAD=$2" +# echo "BRANCH-CHECKOUT=$3" readonly ch_file="/opt/app/tools/atbupdate/checkout_history" readonly update_log_file="/opt/app/tools/atbupdate/update_log.csv" if [ -f $ch_file ]; then - readonly repo=$(basename $(git rev-parse --show-toplevel)) + # repo: customer_281 + readonly repo=$(basename $(git rev-parse --show-toplevel)) + # branch: customer_281:HEAD->zg1/zone1,origin/zg1/zone1 readonly branch=$(git log --graph --all --decorate $2 | head -n 1 | sed -E -e 's/(.*?)\((.*)\)/\2/g' | sed -E -e s/[[:space:]]//g) - line="$repo:$branch" - echo "line=$line" + readonly line="$repo:$branch" + readonly now="$(date +%Y-%m-%dT%T)" if ! grep -Eq "$line" $ch_file; then + # line not found. first checkout of this branch (on this PSA). + # mark dc and print-templates to be downloaded by update-tool. + # mark opkg_commdands-file to be executed by update-tool. echo $line >> $ch_file - echo "DOWNLOAD, /etc/dc/dc2c.4.21.bin, $(date +%Y-%m-%dT%T), N/A" >> $update_log_file + echo "DOWNLOAD, /etc/dc/dc2c.4.21.bin, $now, N/A" >> $update_log_file + echo "DOWNLOAD, /etc/psa_config/DC2C_print01.json, $now, N/A" >> $update_log_file + echo "DOWNLOAD, /etc/psa_config/DC2C_print02.json, $now, N/A" >> $update_log_file + echo "DOWNLOAD, /etc/psa_config/DC2C_print03.json, $now, N/A" >> $update_log_file + echo "DOWNLOAD, /etc/psa_config/DC2C_print04.json, $now, N/A" >> $update_log_file + echo "DOWNLOAD, /etc/psa_config/DC2C_print29.json, $now, N/A" >> $update_log_file + echo "DOWNLOAD, /etc/psa_config/DC2C_print32.json, $now, N/A" >> $update_log_file + echo "EXECUTE, /etc/psa_update/opkg_commands, $now, N/A" >> $update_log_file else - echo "Found $line. Do nothing" + echo "Found existing line: $line. Do nothing" fi +else + echo "*******************************************************" + echo " $ch_file DOES NOT EXIST !!! " + echo "*******************************************************" fi