diff --git a/lib/rbpkg.rb b/lib/rbpkg.rb
index e9017c8..d0aca78 100644
--- a/lib/rbpkg.rb
+++ b/lib/rbpkg.rb
@@ -420,10 +420,10 @@ EOF
@@sha256 = nil
def self.sha256
- @@sha256 || @@sha256 = if system("which sha256 >/dev/null 2>&1")
- "sha256"
- elsif system("which sha256sum >/dev/null 2>&1")
+ @@sha256 || @@sha256 = if system("which sha256sum >/dev/null 2>&1")
"sha256sum"
+ elsif system("which sha256 >/dev/null 2>&1")
+ "sha256"
else
raise "sha256 executable not found"
end
diff --git a/lib/rbpkg/repo.rb b/lib/rbpkg/repo.rb
index e171a85..7e6473e 100644
--- a/lib/rbpkg/repo.rb
+++ b/lib/rbpkg/repo.rb
@@ -457,7 +457,7 @@ class Rbpkg::Repo
file = scan[1]
hash = scan[2]
path = "#{Rbpkg.prefix}/#{file}"
- `echo 'SHA256 (#{sh_quote(path)}) = #{sh_quote(hash)}' | #{Rbpkg.sha256} -c`
+ `echo 'SHA256 (#{sh_quote(path)}) = #{sh_quote(hash)}' | #{Rbpkg.sha256} -c /dev/stdin`
if $?.success?
cmd! "rm #{sh_quote(path)}"
end