Skip to content

Commit

Permalink
Look for functions.sh in /etc too (fix osresearch#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicowilliams committed Nov 11, 2021
1 parent 86323a3 commit 2c784e4
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 4 deletions.
3 changes: 3 additions & 0 deletions sbin/attest-enroll
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ if [[ -s $TOP/lib/safeboot/functions.sh ]]; then
elif [[ -s $TOP/functions.sh ]]; then
# shellcheck source=functions.sh
. "$TOP/functions.sh"
elif [[ -s /etc/safeboot/functions.sh ]]; then
# shellcheck source=functions.sh
. /etc/safeboot/functions.sh
else
echo "Unable to find Safeboot function library" 1>&2
exit 1
Expand Down
3 changes: 3 additions & 0 deletions sbin/gencert
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ if [[ -s $TOP/lib/safeboot/functions.sh ]]; then
elif [[ -s $TOP/functions.sh ]]; then
# shellcheck disable=SC1090 source=functions.sh
. "$TOP/functions.sh"
elif [[ -s /etc/safeboot/functions.sh ]]; then
# shellcheck source=functions.sh
. /etc/safeboot/functions.sh
else
echo "Unable to find Safeboot function library" 1>&2
exit 1
Expand Down
3 changes: 3 additions & 0 deletions sbin/genkeytab
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ if [[ -s $TOP/lib/safeboot/functions.sh ]]; then
elif [[ -s $TOP/functions.sh ]]; then
# shellcheck disable=SC1090 source=functions.sh
. "$TOP/functions.sh"
elif [[ -s /etc/safeboot/functions.sh ]]; then
# shellcheck source=functions.sh
. /etc/safeboot/functions.sh
else
echo "Unable to find Safeboot function library" 1>&2
exit 1
Expand Down
3 changes: 3 additions & 0 deletions sbin/getkeytab
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ if [[ -s $TOP/lib/safeboot/functions.sh ]]; then
elif [[ -s $TOP/functions.sh ]]; then
# shellcheck disable=SC1090 source=functions.sh
. "$TOP/functions.sh"
elif [[ -s /etc/safeboot/functions.sh ]]; then
# shellcheck source=functions.sh
. /etc/safeboot/functions.sh
else
echo "Unable to find Safeboot function library" 1>&2
exit 1
Expand Down
3 changes: 3 additions & 0 deletions sbin/safeboot
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ if [[ -s $TOP/lib/safeboot/functions.sh ]]; then
elif [[ -s $TOP/functions.sh ]]; then
# shellcheck source=functions.sh
. "$TOP/functions.sh"
elif [[ -s /etc/safeboot/functions.sh ]]; then
# shellcheck source=functions.sh
. /etc/safeboot/functions.sh
else
echo "Unable to find Safeboot function library" 1>&2
exit 1
Expand Down
3 changes: 3 additions & 0 deletions sbin/tpm2-attest
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ if [[ -s $TOP/lib/safeboot/functions.sh ]]; then
elif [[ -s $TOP/functions.sh ]]; then
# shellcheck source=functions.sh
. "$TOP/functions.sh"
elif [[ -s /etc/safeboot/functions.sh ]]; then
# shellcheck source=functions.sh
. /etc/safeboot/functions.sh
else
echo "Unable to find Safeboot function library" 1>&2
exit 1
Expand Down
7 changes: 3 additions & 4 deletions sbin/tpm2-policy
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ TOP=$(dirname "$BINDIR")
if [[ -s $TOP/lib/safeboot/functions.sh ]]; then
# shellcheck disable=SC1090 source=functions.sh
. "$TOP/lib/safeboot/functions.sh"
functions_sh=$TOP/lib/safeboot/functions.sh
elif [[ -s $TOP/functions.sh ]]; then
# shellcheck disable=SC1090 source=functions.sh
. "$TOP/functions.sh"
functions_sh=$TOP/functions.sh
elif [[ -s /etc/safeboot/functions.sh ]]; then
# shellcheck disable=SC1090 source=functions.sh
. /etc/safeboot/functions.sh
else
echo "Unable to find Safeboot function library" 1>&2
exit 1
fi
# shellcheck source=functions.sh
. "$functions_sh"

set -euo pipefail -o noclobber
shopt -s extglob
Expand Down
3 changes: 3 additions & 0 deletions sbin/tpm2-recv
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ if [[ -s $TOP/lib/safeboot/functions.sh ]]; then
elif [[ -s $TOP/functions.sh ]]; then
# shellcheck disable=SC1090 source=functions.sh
. "$TOP/functions.sh"
elif [[ -s /etc/safeboot/functions.sh ]]; then
# shellcheck source=functions.sh
. /etc/safeboot/functions.sh
else
echo "Unable to find Safeboot function library" 1>&2
exit 1
Expand Down
3 changes: 3 additions & 0 deletions sbin/tpm2-send
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ if [[ -s $TOP/lib/safeboot/functions.sh ]]; then
elif [[ -s $TOP/functions.sh ]]; then
# shellcheck disable=SC1090 source=functions.sh
. "$TOP/functions.sh"
elif [[ -s /etc/safeboot/functions.sh ]]; then
# shellcheck source=functions.sh
. /etc/safeboot/functions.sh
else
echo "Unable to find Safeboot function library" 1>&2
exit 1
Expand Down

0 comments on commit 2c784e4

Please sign in to comment.