FreeBSD doesn't have "date -r" and calls its sha1 hash tool tool "sha1."
Signed-off-by: Ed Maste <ema...@freebsd.org> --- Defining shell functions within a case statement is a little odd but I'd rather not have several functions each with the same case statement in them. I could perhaps move these into an ovs-osdep.subr if that seems cleaner. With this change (and after enabling SSL in configure) all but 3 skipped tests in "make check" pass on FreeBSD. utilities/ovs-pki.in | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/utilities/ovs-pki.in b/utilities/ovs-pki.in index 019ffcf..4db0480 100755 --- a/utilities/ovs-pki.in +++ b/utilities/ovs-pki.in @@ -24,6 +24,43 @@ batch=no log='@LOGDIR@/ovs-pki.log' keytype=rsa bits=2048 + +# OS-specific compatibility routines +case $(uname -s) in +FreeBSD) + +file_mod_epoch() +{ + stat -r "$1" | awk '{print $10}' +} + +file_mod_date() +{ + stat -f '%Sm' "$1" +} + +sha1sum() +{ + sha1 "$@" +} + +;; + +*) + +file_mod_epoch() +{ + date -r "$1" +%s +} + +file_mod_date() +{ + date -r "$1" +} + +;; +esac + for option; do # This option-parsing mechanism borrowed from a Autoconf-generated # configure script under the following license: @@ -365,7 +402,7 @@ make_tmpdir() { fingerprint() { file=$1 name=${1-$2} - date=$(date -r $file) + date=$(file_mod_date "$file") if grep -e '-BEGIN CERTIFICATE-' "$file" > /dev/null; then fingerprint=$(openssl x509 -noout -in "$file" -fingerprint | sed 's/SHA1 Fingerprint=//' | tr -d ':') @@ -609,7 +646,7 @@ elif test "$command" = expire; then for type in switch controller; do cd "$pkidir/${type}ca/incoming" || exit 1 for file in $(glob "*"); do - time=$(date -r "$file" +%s) + time=$(file_mod_epoch "$file") if test "$time" -lt "$cutoff"; then rm -f "$file" fi -- 1.7.10.3 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev