remove handling og checkout_history file

This commit is contained in:
Gerhard Hoffmann 2023-07-04 14:01:23 +02:00
parent c272d9013d
commit 92e8e0946d

View File

@ -1,24 +1,19 @@
#!/bin/bash - #!/bin/bash -
# echo "POST-CHECKOUT $PWD" > "/tmp/post_checkout.txt" # echo "POST-CHECKOUT"
# echo "PREV-HEAD=$1" # echo "PREV-HEAD=$1"
# echo "CURR-HEAD=$2" # echo "CURR-HEAD=$2"
# echo "BRANCH-CHECKOUT=$3" # echo "BRANCH-CHECKOUT=$3"
readonly CHECKOUT_HISTORY_FILE="/opt/app/tools/atbupdate/checkout_history"
readonly GIT_UPDATE_LOG="/opt/app/tools/atbupdate/update_log.csv" readonly GIT_UPDATE_LOG="/opt/app/tools/atbupdate/update_log.csv"
readonly OPKG_COMMANDS_FILE="./etc/psa_update/opkg_commands" readonly OPKG_COMMANDS_FILE="./etc/psa_update/opkg_commands"
write_log_file () { write_log_file () {
if [ -f $CHECKOUT_HISTORY_FILE ]; then
# repo: customer_281 # repo: customer_281
readonly repo=$(basename $(git rev-parse --show-toplevel)) readonly repo=$(basename $(git rev-parse --show-toplevel))
# branch: customer_281:HEAD->zg1/zone1,origin/zg1/zone1 # 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 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 line="$repo:$branch"
readonly now="$(date +%Y-%m-%dT%T)" readonly now="$(date +%Y-%m-%dT%T)"
if ! grep -Eq "$line" $CHECKOUT_HISTORY_FILE; then
# line not found. first checkout of this branch (on this PSA).
# mark dc and print-templates to be downloaded by update-tool.
echo "DOWNLOAD, /etc/dc/dc2c.bin, $now, N/A" >> $GIT_UPDATE_LOG echo "DOWNLOAD, /etc/dc/dc2c.bin, $now, N/A" >> $GIT_UPDATE_LOG
echo "DOWNLOAD, /etc/psa_config/DC2C_print01.json, $now, N/A" >> $GIT_UPDATE_LOG echo "DOWNLOAD, /etc/psa_config/DC2C_print01.json, $now, N/A" >> $GIT_UPDATE_LOG
echo "DOWNLOAD, /etc/psa_config/DC2C_print02.json, $now, N/A" >> $GIT_UPDATE_LOG echo "DOWNLOAD, /etc/psa_config/DC2C_print02.json, $now, N/A" >> $GIT_UPDATE_LOG
@ -59,16 +54,6 @@ write_log_file () {
done done
fi fi
fi fi
echo "$line" >> $CHECKOUT_HISTORY_FILE
else
echo "Found existing line: $line. Do nothing"
fi
# echo "$line @$now" >> $CHECKOUT_HISTORY_FILE
else
echo "*******************************************************"
echo " $CHECKOUT_HISTORY_FILE DOES NOT EXIST !!! "
echo "*******************************************************"
fi
} }
write_log_file write_log_file