sync post-checkout/merge-hooks with zg/zone1
This commit is contained in:
parent
e4ce5cbd84
commit
760819d4e8
@ -24,8 +24,27 @@ write_log_file () {
|
|||||||
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
|
||||||
echo "DOWNLOAD, /etc/psa_config/DC2C_print03.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_print04.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_print05.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_print07.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_print09.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_print11.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_print13.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_print15.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_print17.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_print19.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_print29.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_print32.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_device.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_conf.json, $now, N/A" >> $GIT_UPDATE_LOG
|
||||||
if [ -f "$OPKG_COMMANDS_FILE" ]; then
|
if [ -f "$OPKG_COMMANDS_FILE" ]; then
|
||||||
if grep -qE . "${OPKG_COMMANDS_FILE}"; then
|
if grep -qE . "${OPKG_COMMANDS_FILE}"; then
|
||||||
readarray opkg_commands < <(cat $OPKG_COMMANDS_FILE)
|
readarray opkg_commands < <(cat $OPKG_COMMANDS_FILE)
|
||||||
@ -40,10 +59,10 @@ write_log_file () {
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
echo "$line" >> $CHECKOUT_HISTORY_FILE
|
||||||
else
|
else
|
||||||
echo "Found existing line: $line. Do nothing"
|
echo "Found existing line: $line. Do nothing"
|
||||||
fi
|
fi
|
||||||
echo "$line" >> $CHECKOUT_HISTORY_FILE
|
|
||||||
# echo "$line @$now" >> $CHECKOUT_HISTORY_FILE
|
# echo "$line @$now" >> $CHECKOUT_HISTORY_FILE
|
||||||
else
|
else
|
||||||
echo "*******************************************************"
|
echo "*******************************************************"
|
||||||
|
@ -11,11 +11,9 @@ if [ -z $IFS ]; then
|
|||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GIT_PULL_TMP=/tmp/git_changed_files_for_last_pull
|
GIT_UPDATE_LOG=/opt/app/tools/atbupdate/update_log.csv
|
||||||
OPKG_CMDS_TMP=/tmp/opkg_commands
|
|
||||||
|
|
||||||
rm -f $GIT_PULL_TMP
|
#TODO: use in UpdateController
|
||||||
rm -f $OPKG_CMDS_TMP
|
|
||||||
|
|
||||||
get_blob () { # get the blob of the file(name) passed as $1
|
get_blob () { # get the blob of the file(name) passed as $1
|
||||||
# note: this can be used for any file in the filesystem
|
# note: this can be used for any file in the filesystem
|
||||||
@ -29,26 +27,30 @@ get_commit_for_blob () {
|
|||||||
grep -q $1 && echo -n {} && head -n 1")
|
grep -q $1 && echo -n {} && head -n 1")
|
||||||
}
|
}
|
||||||
|
|
||||||
for fn in $(git diff-tree -r HEAD@{1} HEAD --name-only); do
|
write_log_file () {
|
||||||
if grep -E -q "(DC.*json|dc.*hex|dc.*bin|tariff.*json)" <<< $fn; then
|
local now=$(date +"%Y-%m-%dT%T")
|
||||||
|
for fn in $(git diff-tree -r HEAD@{1} HEAD --name-only); do
|
||||||
|
if grep -qE "DC2C.*json" <<< $fn; then
|
||||||
# called in repository: $fn is e.g. etc/psa_tariff/tariff01.json
|
# called in repository: $fn is e.g. etc/psa_tariff/tariff01.json
|
||||||
# add '/' prefix
|
# add '/' prefix
|
||||||
fn=$(echo $fn | awk '{ printf "/"$0 }')
|
echo "DOWNLOAD, $(echo $fn | awk '{ printf "/"$0 }'), $now, N/A" >> "$GIT_UPDATE_LOG"
|
||||||
if [[ -f "$fn" ]]; then
|
elif grep -qE "dc2c.bin" <<< $fn; then
|
||||||
blob=$(get_blob "$fn")
|
# download the file referenced by the link dc2c.bin
|
||||||
commit=$(get_commit_for_blob $blob "$fn")
|
echo "DOWNLOAD, "/etc/dc/dc2c.bin", $now, N/A" >> "$GIT_UPDATE_LOG"
|
||||||
fsize=$(ls -l "$fn" | awk '{ print $5 }')
|
elif grep -qE ".*opkg_commands" <<< $fn; then
|
||||||
echo "$fn $fsize $blob $commit" >> $GIT_PULL_TMP
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if grep -E -q ".*opkg_commands" <<< $fn; then
|
|
||||||
readarray opkg_commands < <(cat $fn)
|
readarray opkg_commands < <(cat $fn)
|
||||||
for opkg_c in "${opkg_commands[@]}"; do
|
for opkg_c in "${opkg_commands[@]}"; do
|
||||||
test -z $opkg_c && continue;
|
# check for lines longer than 'opkg '
|
||||||
test ! -z $(grep -E "^\s*[#]+.*$" <<< $opkg_c) && continue
|
if [ "${#opkg_c}" -gt 4 ]; then
|
||||||
echo -n "$opkg_c" | tr -d '\n\r' >> $OPKG_CMDS_TMP 2>&1
|
# comment: spaces, at least one '#'
|
||||||
echo "" >> $OPKG_CMDS_TMP 2>&1
|
grep -qE '^[[:space:]]*#+.*$' <<< "$opkg_c" && continue
|
||||||
done
|
echo -n "EXECUTE, $opkg_c, $now, N/A" | tr -d '\n\r' >> $GIT_UPDATE_LOG 2>&1
|
||||||
source "$fn"
|
echo "" >> $GIT_UPDATE_LOG 2>&1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
write_log_file
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user