Skip to content

Commit

Permalink
Test for prerequisite binaries before running updates, fixes clempaul#30
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronsegura committed Feb 5, 2025
1 parent 2cccf99 commit c99eee7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
15 changes: 15 additions & 0 deletions dynamicdns.bash
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,21 @@ if [ $VERBOSE = "true" ]; then
echo "Post process set to: $POSTPROCESS"
fi

OS_PREREQS=(uuidgen grep egrep awk sed dig)

NOT_FOUND=()
for cmd in "${OS_PREREQS[@]}"; do
if [ ! "$(which $cmd)" ]; then
NOT_FOUND+=($cmd)
fi
done

if [ ${#NOT_FOUND[@]} -gt 0 ]; then
echo `basename $0` "ERROR: Missing Depenencies: ${NOT_FOUND[*]}"
logStatus "error" "Missing Dependencies: ${NOT_FOUND[*]}"
exit 1
fi

if [ ! -n "$OPTKEY" ]; then
if [ ! -n "$KEY" ]; then
echo `basename $0` ": missing parameter -- KEY"
Expand Down
15 changes: 15 additions & 0 deletions dynamicdns6.bash
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,21 @@ if [ $VERBOSE = "true" ]; then
echo "Post process set to: $POSTPROCESS"
fi

OS_PREREQS=(uuidgen grep egrep awk sed dig)

NOT_FOUND=()
for cmd in "${OS_PREREQS[@]}"; do
if [ ! "$(which $cmd)" ]; then
NOT_FOUND+=($cmd)
fi
done

if [ ${#NOT_FOUND[@]} -gt 0 ]; then
echo `basename $0` "ERROR: Missing Depenencies: ${NOT_FOUND[*]}"
logStatus "error" "Missing Dependencies: ${NOT_FOUND[*]}"
exit 1
fi

if [ ! -n "$OPTKEY" ]; then
if [ ! -n "$KEY" ]; then
echo `basename $0` ": missing parameter -- KEY"
Expand Down

0 comments on commit c99eee7

Please sign in to comment.