importpw / import

`import` is a simple and fast module system for Bash and other Unix shells
https://import.sh
MIT License
338 stars 10 forks source link

Import fails if `sha1sum` binary is not present #6

Closed dotcarls closed 5 years ago

dotcarls commented 5 years ago

Hi there!

I was hitting some errors when attempting to run your shakedown gist on OSX:

/Users/tcarlson/.import.sh: line 37: sha1sum: command not found
/Users/tcarlson/.import.sh: line 67: .: /Users/tcarlson/.import-cache/import.pw/robwhitby/shakedown: is a directory
./script.sh: line 7: shakedown: command not found

I fixed this by installing md5sha1sum via Homebrew (brew install md5sha1sum, taken from Stack Overflow), though this would be altogether unnecessary if import tested for a few alternative binaries, such as shasum or shasum5.18 which appear to be available by default on OSX and produce identical hashes:

tcarlson-a01 Scratch/shakedown ‹master*› » sha1sum script.sh
9cedb6b3a4267547afc8ccec064fae66db583315  script.sh
tcarlson-a01 Scratch/shakedown ‹master*› » shasum script.sh 
9cedb6b3a4267547afc8ccec064fae66db583315  script.sh
tcarlson-a01 Scratch/shakedown ‹master*› » shasum5.18 script.sh
9cedb6b3a4267547afc8ccec064fae66db583315  script.sh

It may be nice to list binary dependencies in the README, such as curl, sha1sum, grep, awk and sed despite that these are all expected to be present on any reasonable *nix system. 🙂

TooTallNate commented 5 years ago

Hey @dotcarls, cool that you found the project :) Very nice catch on sha1sum not being present by default, let's fix that.

Funny you mention listing the deps in the Readme, because I had that previously but then figured the same thought as you about any reasonable *nix system. I'd almost prefer just to get issues like this one in order to fix them "properly" (with tools available by default) rather than have the user hunt for the packages to install.