diff options
author | Mike Fulbright <msf@redhat.com> | 2003-01-03 17:45:35 +0000 |
---|---|---|
committer | Mike Fulbright <msf@redhat.com> | 2003-01-03 17:45:35 +0000 |
commit | e4cf0c4fa6bf87e502d7278b711c62fdc03b730b (patch) | |
tree | 40438930607041eb8f53994d3ab27e420ebc5b3f /isomd5sum/checkisomd5.c | |
parent | c4c1504ed4b2333222b6aa57bd623d9631133455 (diff) | |
download | anaconda-e4cf0c4fa6bf87e502d7278b711c62fdc03b730b.tar.gz anaconda-e4cf0c4fa6bf87e502d7278b711c62fdc03b730b.tar.xz anaconda-e4cf0c4fa6bf87e502d7278b711c62fdc03b730b.zip |
added ability to sniff out md5sum w/o doing a test
Diffstat (limited to 'isomd5sum/checkisomd5.c')
-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]); } |