mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
v2v: tests: isolate SHA1 calculation in an own shared function
sha1sum(1) does not exist everywhere, so wrap it in an own function so the right implementation can be chosen on each OS. Also, wrapping it avoid using awk everytime.
This commit is contained in:
@@ -28,3 +28,16 @@ do_md5 ()
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
do_sha1 ()
|
||||
{
|
||||
case "$(uname)" in
|
||||
Linux)
|
||||
sha1sum "$1" | awk '{print $1}'
|
||||
;;
|
||||
*)
|
||||
echo "$0: unknown method to calculate SHA1 of file on $(uname)"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user