diff options
-rw-r--r-- | isomd5sum/checkisomd5.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/isomd5sum/checkisomd5.c b/isomd5sum/checkisomd5.c index 557d04254..14ab5d438 100644 --- a/isomd5sum/checkisomd5.c +++ b/isomd5sum/checkisomd5.c @@ -279,6 +279,34 @@ int mediaCheckFile(char *file) { return rc; } +int printMD5SUM(char *file) { + int isofd; + char mediasum[64]; + char computedsum; + long long isosize; + int supported; + int rc; + int llen; + int skipsectors; + + isofd = open(file, O_RDONLY); + + if (isofd < 0) { + fprintf(stderr, "%s: Unable to find install image.\n", file); + exit(1); + } + + if (parsepvd(isofd, mediasum, &skipsectors, &isosize, &supported) < 0) { + fprintf(stderr, "%s: Could not get pvd data", file); + exit(1); + } + + close(isofd); + + printf("%s: %s\n", file, mediasum); +} + + int main(int argc, char **argv) { int rc; @@ -288,5 +316,11 @@ int main(int argc, char **argv) { exit(1); } + /* see if they just want md5sum */ + if (strcmp(argv[1], "--md5sumonly") == 0) { + printMD5SUM(argv[2]); + exit(0); + } + rc = mediaCheckFile(argv[1]); } |