remove handling og checkout_history file
This commit is contained in:
parent
0133e505a1
commit
4fe11fae51
@ -1,73 +1,58 @@
|
|||||||
#!/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)"
|
echo "DOWNLOAD, /etc/dc/dc2c.bin, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
if ! grep -Eq "$line" $CHECKOUT_HISTORY_FILE; then
|
echo "DOWNLOAD, /etc/psa_config/DC2C_print01.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
# line not found. first checkout of this branch (on this PSA).
|
echo "DOWNLOAD, /etc/psa_config/DC2C_print02.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
# mark dc and print-templates to be downloaded by update-tool.
|
echo "DOWNLOAD, /etc/psa_config/DC2C_print03.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
echo "DOWNLOAD, /etc/dc/dc2c.bin, $now, N/A" >> $GIT_UPDATE_LOG
|
echo "DOWNLOAD, /etc/psa_config/DC2C_print04.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_print05.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_print06.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_print03.json, $now, N/A" >> $GIT_UPDATE_LOG
|
echo "DOWNLOAD, /etc/psa_config/DC2C_print07.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_print04.json, $now, N/A" >> $GIT_UPDATE_LOG
|
echo "DOWNLOAD, /etc/psa_config/DC2C_print08.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_print05.json, $now, N/A" >> $GIT_UPDATE_LOG
|
echo "DOWNLOAD, /etc/psa_config/DC2C_print09.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_print06.json, $now, N/A" >> $GIT_UPDATE_LOG
|
echo "DOWNLOAD, /etc/psa_config/DC2C_print10.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_print07.json, $now, N/A" >> $GIT_UPDATE_LOG
|
echo "DOWNLOAD, /etc/psa_config/DC2C_print11.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_print08.json, $now, N/A" >> $GIT_UPDATE_LOG
|
echo "DOWNLOAD, /etc/psa_config/DC2C_print12.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_print09.json, $now, N/A" >> $GIT_UPDATE_LOG
|
echo "DOWNLOAD, /etc/psa_config/DC2C_print13.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_print10.json, $now, N/A" >> $GIT_UPDATE_LOG
|
echo "DOWNLOAD, /etc/psa_config/DC2C_print14.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_print11.json, $now, N/A" >> $GIT_UPDATE_LOG
|
echo "DOWNLOAD, /etc/psa_config/DC2C_print15.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_print12.json, $now, N/A" >> $GIT_UPDATE_LOG
|
echo "DOWNLOAD, /etc/psa_config/DC2C_print16.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_print13.json, $now, N/A" >> $GIT_UPDATE_LOG
|
echo "DOWNLOAD, /etc/psa_config/DC2C_print17.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_print14.json, $now, N/A" >> $GIT_UPDATE_LOG
|
echo "DOWNLOAD, /etc/psa_config/DC2C_print18.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_print15.json, $now, N/A" >> $GIT_UPDATE_LOG
|
echo "DOWNLOAD, /etc/psa_config/DC2C_print19.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_print16.json, $now, N/A" >> $GIT_UPDATE_LOG
|
echo "DOWNLOAD, /etc/psa_config/DC2C_print20.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_print17.json, $now, N/A" >> $GIT_UPDATE_LOG
|
echo "DOWNLOAD, /etc/psa_config/DC2C_print29.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_print18.json, $now, N/A" >> $GIT_UPDATE_LOG
|
echo "DOWNLOAD, /etc/psa_config/DC2C_print32.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_print19.json, $now, N/A" >> $GIT_UPDATE_LOG
|
echo "DOWNLOAD, /etc/psa_config/DC2C_device.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_print20.json, $now, N/A" >> $GIT_UPDATE_LOG
|
echo "DOWNLOAD, /etc/psa_config/DC2C_cash.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_print29.json, $now, N/A" >> $GIT_UPDATE_LOG
|
echo "DOWNLOAD, /etc/psa_config/DC2C_conf.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_print32.json, $now, N/A" >> $GIT_UPDATE_LOG
|
if [ -f "$OPKG_COMMANDS_FILE" ]; then
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_device.json, $now, N/A" >> $GIT_UPDATE_LOG
|
if grep -qE . "${OPKG_COMMANDS_FILE}"; then
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_cash.json, $now, N/A" >> $GIT_UPDATE_LOG
|
readarray opkg_commands < <(cat $OPKG_COMMANDS_FILE)
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_conf.json, $now, N/A" >> $GIT_UPDATE_LOG
|
for opkg_c in "${opkg_commands[@]}"; do
|
||||||
if [ -f "$OPKG_COMMANDS_FILE" ]; then
|
# check for lines longer than 'opkg '
|
||||||
if grep -qE . "${OPKG_COMMANDS_FILE}"; then
|
if [ "${#opkg_c}" -gt 4 ]; then
|
||||||
readarray opkg_commands < <(cat $OPKG_COMMANDS_FILE)
|
# comment: spaces, at least one '#'
|
||||||
for opkg_c in "${opkg_commands[@]}"; do
|
grep -qE '^[[:space:]]*#+.*$' <<< "$opkg_c" && continue
|
||||||
# check for lines longer than 'opkg '
|
echo -n "EXECUTE, $opkg_c, $now, N/A" | tr -d '\n\r' >> $GIT_UPDATE_LOG 2>&1
|
||||||
if [ "${#opkg_c}" -gt 4 ]; then
|
echo "" >> $GIT_UPDATE_LOG 2>&1
|
||||||
# comment: spaces, at least one '#'
|
|
||||||
grep -qE '^[[:space:]]*#+.*$' <<< "$opkg_c" && continue
|
|
||||||
echo -n "EXECUTE, $opkg_c, $now, N/A" | tr -d '\n\r' >> $GIT_UPDATE_LOG 2>&1
|
|
||||||
echo "" >> $GIT_UPDATE_LOG 2>&1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
fi
|
done
|
||||||
echo "$line" >> $CHECKOUT_HISTORY_FILE
|
|
||||||
else
|
|
||||||
echo "Found existing line: $line. Do nothing"
|
|
||||||
fi
|
fi
|
||||||
# echo "$line @$now" >> $CHECKOUT_HISTORY_FILE
|
|
||||||
else
|
|
||||||
echo "*******************************************************"
|
|
||||||
echo " $CHECKOUT_HISTORY_FILE DOES NOT EXIST !!! "
|
|
||||||
echo "*******************************************************"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user