Skip to content

Commit

Permalink
entrypoint monitors for *-updates.txt files
Browse files Browse the repository at this point in the history
completed px4 update generates updates.txt file to signal update has finished.
Monitor for this file to appear and match it to px4 files. For debugging
echo the contents of the -updates.txt to log
  • Loading branch information
TimoSairiala committed Aug 6, 2024
1 parent 059e103 commit 19aab1b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Tools/px_uploader.entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,8 @@ if [ -n "$PX4_EXPORT_DIR" ]; then
# move temp json file to the final json file
mv ${TEMP_JSON} $PX4_EXPORT_DIR/${SALUKI_FILE_INFO_JSON}
fi

# when px4 update is complete, it will generate -updates.txt file mathing with px4 filename
# for example: ssrc_saluki-v3_default-1.14.0-12.0.0-66-g97a3fa5c5f-updates.txt
# monitor for the -updates.txt files and exit if it is valid
inotifyd validate_updates_txt.sh ${PX4_EXPORT_DIR}:n
26 changes: 26 additions & 0 deletions Tools/validate_updates_txt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#! /bin/bash -eu

die () {
echo >&2 "$@"
exit 1
}

[[ "$#" -eq 3 ]] || die "$0 (operation) (dir) (file)"
DIR=$2
FILE=$3

if [[ -e ${FILE} ]]; then
echo "${FILE} appeared"
matching_px4_file=$(echo ${FILE} | sed 's/-updates.txt$/.px4/')
echo "matching px4 file should be: $matching_px4_file"
if [[ -e ${matching_px4_file} ]]; then
echo "updates.txt and px4 file found"

echo "contents of ${FILE}:"
cat ${FILE}

echo "update has finished, exiting"
# exit with status 1 do signal exit has finished
exit 1
fi
fi

0 comments on commit 19aab1b

Please sign in to comment.