Added write_log_file()

This commit is contained in:
Gerhard Hoffmann 2023-05-24 12:08:59 +02:00
parent 505911ef5b
commit c94b276be0

View File

@ -27,29 +27,33 @@ 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 () {
local __datum = $(date +"%Y-%m-%dT%T") local __date = $(date +"%Y-%m-%dT%T")
if grep -E -q "(DC.*json|dc.*hex|dc.*bin|tariff.*json)" <<< $fn; then for fn in $(git diff-tree -r HEAD@{1} HEAD --name-only); do
# called in repository: $fn is e.g. etc/psa_tariff/tariff01.json if grep -E -q "(DC.*json|dc.*hex|dc.*bin|tariff.*json)" <<< $fn; then
# add '/' prefix # called in repository: $fn is e.g. etc/psa_tariff/tariff01.json
fn=$(echo $fn | awk '{ printf "/"$0 }') # add '/' prefix
# if [[ -f "$fn" ]]; then fn=$(echo $fn | awk '{ printf "/"$0 }')
# blob=$(get_blob "$fn") # if [[ -f "$fn" ]]; then
# commit=$(get_commit_for_blob $blob "$fn") # blob=$(get_blob "$fn")
# fsize=$(ls -l "$fn" | awk '{ print $5 }') # commit=$(get_commit_for_blob $blob "$fn")
# echo "$fn $fsize $blob $commit" >> $GIT_PULL_TMP # fsize=$(ls -l "$fn" | awk '{ print $5 }')
# fi # echo "$fn $fsize $blob $commit" >> $GIT_PULL_TMP
echo "DOWNLOAD, $fn, $__datum, N/A" >> "$GIT_UPDATE_LOG" # fi
fi echo "DOWNLOAD, $fn, $__date, N/A" >> "$GIT_UPDATE_LOG"
if grep -E -q ".*opkg_commands" <<< $fn; then fi
readarray opkg_commands < <(cat $fn) if grep -E -q ".*opkg_commands" <<< $fn; then
for opkg_c in "${opkg_commands[@]}"; do readarray opkg_commands < <(cat $fn)
test -z $opkg_c && continue; for opkg_c in "${opkg_commands[@]}"; do
test ! -z $(grep -E "^\s*[#]+.*$" <<< $opkg_c) && continue test -z $opkg_c && continue;
echo -n "EXECUTE, $opkg_c, $__datum, N/A" | tr -d '\n\r' >> $GIT_UPDATE_LOG 2>&1 test ! -z $(grep -E "^\s*[#]+.*$" <<< $opkg_c) && continue
echo "" >> $GIT_UPDATE_LOG 2>&1 echo -n "EXECUTE, $opkg_c, $__date, N/A" | tr -d '\n\r' >> $GIT_UPDATE_LOG 2>&1
done echo "" >> $GIT_UPDATE_LOG 2>&1
# source "$fn" done
fi # source "$fn"
done fi
done
}
write_log_file