forked from PX4/PX4-Autopilot
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
entrypoint monitors for *-updates.txt files
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
1 parent
059e103
commit 19aab1b
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |