'git pull' calls the hook post-merge when new data arrive.

If this is the case, write a file /tmp/git-pull which contains the names
of changed files.
Do not search for any special output of git.
This commit is contained in:
Gerhard Hoffmann 2022-06-09 18:41:33 +02:00
parent 27445f354a
commit 3574453066

View File

@ -35,42 +35,20 @@ update_psa() {
exit $? exit $?
fi fi
rm -f "$OPKG_CMDS_TMP"
rm -f "$GIT_PULL_TMP"
update_psa_activated # message to ISMAS update_psa_activated # message to ISMAS
local try_update_count=0
local func="${FUNCNAME[0]}" local func="${FUNCNAME[0]}"
log_debug "$func:${LINENO}: fetch/merge updates..." log_debug "$func:${LINENO}: fetch/merge updates..."
# Fetch new updates (using git) # Fetch new updates (using git)
while : if ! fetch_customer_updates; then
do log_error "$func:${LINENO}: fetch no data for $customer_id"\
local repository_is_already_up_to_date=""
if ! fetch_customer_updates repository_is_already_up_to_date; then
if [ "$repository_is_already_up_to_date" = "yes" ]; then
log_error "$func:${LINENO}: $customer_id is up-to-date"\
"-> no files to update -> no psa update" "-> no files to update -> no psa update"
update_psa_false_alarm \ update_psa_false_alarm \
"update request, but no change in $CUSTOMER_REPOSITORY_PATH" "update request, but no change in $CUSTOMER_REPOSITORY_PATH"
exit $? # TODO
fi fi
try_updates_count=$((try_updates_count+1))
if [[ "$try_updates_count" -eq 5 ]]; then
log_error "$func:${LINENO}: fetch/merging failed"
update_psa_pull_error # message to ISMAS
exit $?
fi
update_psa_pull_error # message to ISMAS
sleep 10s
else
# Fetched updates successfully
try_updates_count=0
break
fi
done
update_psa_pull_customer_repository # message to ISMAS update_psa_pull_customer_repository # message to ISMAS
@ -78,7 +56,7 @@ update_psa() {
# local changed_files=$(changed_file_names) # local changed_files=$(changed_file_names)
if [[ ! -z $GIT_PULL_TMP ]]; then if [[ -f "$GIT_PULL_TMP" ]]; then
# TODO # TODO
if ! check_hardware_compatibility "$files_to_copy" ; then if ! check_hardware_compatibility "$files_to_copy" ; then
local __r=$? local __r=$?
@ -88,7 +66,7 @@ update_psa() {
fi fi
fi fi
if [[ ! -z "$OPKG_CMDS_TMP" ]]; then if [[ -f "$OPKG_CMDS_TMP" ]]; then
local commands="$(cat ${OPKG_CMDS_TMP} | tr '\n' '; ')" local commands="$(cat ${OPKG_CMDS_TMP} | tr '\n' '; ')"
log_info "$func:${LINENO}: executed opkg commands" log_info "$func:${LINENO}: executed opkg commands"
update_psa_install_opkg_packages $UPDATE_ISMAS_PROGRESS \ update_psa_install_opkg_packages $UPDATE_ISMAS_PROGRESS \
@ -158,6 +136,7 @@ update_psa() {
update_psa_cleanup $UPDATE_ISMAS_PROGRESS \ update_psa_cleanup $UPDATE_ISMAS_PROGRESS \
$RC_SUCCESS "cleanup after psa update" $RC_SUCCESS "cleanup after psa update"
# TODO
exit 0 exit 0
} }