From f01c7f9b53d6889bbc0e16b4ee4803407e354559 Mon Sep 17 00:00:00 2001 From: Thomas Levine <_@thomaslevine.com> Date: Sun, 10 Apr 2016 15:34:06 +0000 Subject: [PATCH] move dependency checks up to beginning --- urchin | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/urchin b/urchin index 6cf9ea2..e127b95 100755 --- a/urchin +++ b/urchin @@ -156,6 +156,26 @@ Go to https://thomaslevine.com/!/urchin/ for documentation on writing tests. EOF } +# -------------------- Dependency checks -------------------- +if command -v md5 1> /dev/null 2> /dev/null; then + urchin_md5=md5 +elif command -v md5sum 1> /dev/null 2> /dev/null; then + urchin_md5=md5sum +else + echo Could not find MD5 hash command >&2 + exit 1 +fi + +if epoch_date 2>&1 > /dev/null; then + epoch=epoch_date +elif epoch_pax 2>&1 > /dev/null; then + epoch=epoch_pax +else + echo I could not find a seconds counter. >&2 + exit 1 +fi + + # -------------------- Portable wrappers -------------------- mktemp_dir() { # Support HP-UX mktemp that has wrong exit codes and @@ -271,26 +291,6 @@ urchin_root() { fi } -# -------------------- Dependency checks -------------------- -if command -v md5 1> /dev/null 2> /dev/null; then - urchin_md5=md5 -elif command -v md5sum 1> /dev/null 2> /dev/null; then - urchin_md5=md5sum -else - echo Could not find MD5 hash command >&2 - urchin_exit 1 -fi - -if epoch_date 2>&1 > /dev/null; then - epoch=epoch_date -elif epoch_pax 2>&1 > /dev/null; then - epoch=epoch_pax -else - echo I could not find a seconds counter. >&2 - urchin_exit 1 -fi - - # -------------------- Main stuff -------------------- recurse() { requested_path="${1}"