#!/bin/sh

set -ex
hashes="$(dirname $0)/binary-hashes.json"

export dir="$1"
(
  head -n -2
  test -z "$dir" || cd $dir
  sha256sum *xca* | while read md file; do
   echo '  "'$file'":"'$md'",'
  done
  cat <<-EOF

	  "last":""
	}
	EOF
) < "$hashes" > "$hashes".tmp &&

mv "$hashes".tmp "$hashes"
