From b3d78869bf110179e012be27acb248792968f8ff Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Thu, 9 Jun 2022 16:15:28 +0200 Subject: [PATCH] testing --- .../customer_szeged_281/.githooks/post-merge | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 home/root/szeged/UpdateController/workspace/customer_szeged_281/.githooks/post-merge diff --git a/home/root/szeged/UpdateController/workspace/customer_szeged_281/.githooks/post-merge b/home/root/szeged/UpdateController/workspace/customer_szeged_281/.githooks/post-merge new file mode 100755 index 0000000..d92333e --- /dev/null +++ b/home/root/szeged/UpdateController/workspace/customer_szeged_281/.githooks/post-merge @@ -0,0 +1,33 @@ +#!/bin/bash - + +# FILE="/tmp/post-merge$(date +%FT%H-%M-%S)" +# commit=$(git rev-parse --verify HEAD) +# echo "$commit $(git cat-file commit $commit)" >> /tmp/post-merge + +# Redirect output to stderr. +exec 1>&2 + +if [ -z $IFS ]; then + IFS=$'\n' +fi + +GIT_PULL_TMP=/tmp/git_pull +OPKG_CMDS_TMP=/tmp/opkg_commands + +echo "$(date)" > /tmp/TTT + +for fn in $(git diff-tree -r HEAD@{1} HEAD --name-only); do + if grep -E -q ".*(DC*.json|dc/dc2c.hex|tariff*.json)" <<< $fn; then + echo "$fn" >> $GIT_PULL_TMP + fi + if grep -E -q ".*opkg_commands" <<< $fn; then + readarray opkg_commands < <(cat $fn) + for opkg_c in "${opkg_commands[@]}"; do + test -z $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 "" >> $OPKG_CMDS_TMP 2>&1 + done + source "$fn" + fi +done