Use /opt/app/tools/atbupdate/update_log.csv as main-file for update-history.
This commit is contained in:
parent
981dade375
commit
13cfbb4932
@ -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
|
||||||
@ -30,25 +28,27 @@ get_commit_for_blob () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for fn in $(git diff-tree -r HEAD@{1} HEAD --name-only); do
|
for fn in $(git diff-tree -r HEAD@{1} HEAD --name-only); do
|
||||||
|
local __date = $(date +"%Y-%m-%dT%T")
|
||||||
if grep -E -q "(DC.*json|dc.*hex|dc.*bin|tariff.*json)" <<< $fn; then
|
if grep -E -q "(DC.*json|dc.*hex|dc.*bin|tariff.*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 }')
|
fn=$(echo $fn | awk '{ printf "/"$0 }')
|
||||||
if [[ -f "$fn" ]]; then
|
# if [[ -f "$fn" ]]; then
|
||||||
blob=$(get_blob "$fn")
|
# blob=$(get_blob "$fn")
|
||||||
commit=$(get_commit_for_blob $blob "$fn")
|
# commit=$(get_commit_for_blob $blob "$fn")
|
||||||
fsize=$(ls -l "$fn" | awk '{ print $5 }')
|
# fsize=$(ls -l "$fn" | awk '{ print $5 }')
|
||||||
echo "$fn $fsize $blob $commit" >> $GIT_PULL_TMP
|
# echo "$fn $fsize $blob $commit" >> $GIT_PULL_TMP
|
||||||
fi
|
# fi
|
||||||
|
echo "DOWNLOAD, $fn, $__date, N/A" >> "$GIT_UPDATE_LOG"
|
||||||
fi
|
fi
|
||||||
if grep -E -q ".*opkg_commands" <<< $fn; then
|
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;
|
test -z $opkg_c && continue;
|
||||||
test ! -z $(grep -E "^\s*[#]+.*$" <<< $opkg_c) && continue
|
test ! -z $(grep -E "^\s*[#]+.*$" <<< $opkg_c) && continue
|
||||||
echo -n "$opkg_c" | tr -d '\n\r' >> $OPKG_CMDS_TMP 2>&1
|
echo -n "EXECUTE, $opkg_c, $__date, N/A" | tr -d '\n\r' >> $GIT_UPDATE_LOG 2>&1
|
||||||
echo "" >> $OPKG_CMDS_TMP 2>&1
|
echo "" >> $GIT_UPDATE_LOG 2>&1
|
||||||
done
|
done
|
||||||
source "$fn"
|
# source "$fn"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user