Rewrite repo.sh

Improve fault tolerance by actually checking the content instead of using sed
matching on file names.