customer_281/.githooks/post-checkout

37 lines
1.8 KiB
Plaintext
Raw Normal View History

# echo "POST-CHECKOUT"
# echo "PREV-HEAD=$1"
# echo "CURR-HEAD=$2"
# echo "BRANCH-CHECKOUT=$3"
2023-05-25 14:51:42 +02:00
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
# 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)
readonly line="$repo:$branch"
readonly now="$(date +%Y-%m-%dT%T)"
2023-05-25 15:08:21 +02:00
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.
2023-05-25 14:51:42 +02:00
echo $line >> $ch_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
2023-05-25 15:04:51 +02:00
else
echo "Found existing line: $line. Do nothing"
2023-05-25 14:51:42 +02:00
fi
else
echo "*******************************************************"
echo " $ch_file DOES NOT EXIST !!! "
echo "*******************************************************"
2023-05-25 14:33:48 +02:00
fi