Permalink
Browse files

Make it work on Linux, where sha1sum is only available.

  • Loading branch information...
1 parent 7e35098 commit 4e706f3a2756971b8699893a6f08332981b49645 @nvie committed Jun 1, 2012
Showing with 10 additions and 1 deletion.
  1. +10 −1 activate.sh
View
11 activate.sh
@@ -49,8 +49,17 @@ autoenv_indent() {
autoenv_hashline()
{
typeset envfile hash
+ typeset hasher
envfile=$1
- hash=$(shasum "$envfile" | cut -d' ' -f 1)
+ if which -s shasum >/dev/null; then
+ hasher="shasum"
+ elif which -s sha1sum >/dev/null; then
+ hasher="sha1sum"
+ else
+ echo "Could not find a suitable hasher. Tried 'sha1sum' and 'shasum'." >&2
+ exit 2
+ fi
+ hash=$($hasher "$envfile" | cut -d' ' -f 1)
echo "$envfile:$hash"
}

0 comments on commit 4e706f3

Please sign in to comment.