atreyu187

Dreamcast Guides : Dreamcast Dumping Script (for *nix)

Jul 8th, 2013
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.60 KB | None | 0 0
  1. By darcagn
  2.  
  3. "I've been buying a lot of discs lately and needed a faster way to both dump/post info and to verify that my discs are good.
  4.  
  5. Usage: dcdump.sh [dreamcastIP]
  6.  
  7. Features:
  8.  
  9. [*]Downloads all tracks automatically using default dumping parameters
  10. [*]Spins down GD-ROM drive when dumping is completed
  11. [*]Prints GDI and file size/hashes to the terminal so that you can quickly compare info
  12. [*]Generates postinfo.txt file with everything ready to go for a perfect post here at Dumpcast. Just write in your ringcode and paste into a new post.
  13.  
  14. Download http://dumpcast.dcemulation.org/dcdump.sh
  15.  
  16. Script tested on OS X Mavericks, OS X Snow Leopard, and Ubuntu. On OS X, you will need to install wget first--the easiest way to do this is by using a package manager such as Homebrew, fink, or MacPorts. The hash generation code relies on OpenSSL so make sure that is installed too. Everything else should be standard on any common *nix distro.
  17.  
  18. Comments and suggestions welcomed. I will be happy to address any cross-platform issues to get it running on your system.
  19.  
  20.  
  21.  
  22. Code:#!/bin/sh
  23. echo "Dreamcast Dumping Script by darcagn"
  24. echo " for use with httpd-ack gd-rom dumper software"
  25. echo " => http://dumpcast.dcemulation.org/\n"
  26.  
  27. if [ -z "$1" ];
  28. then
  29. echo "usage: dcdump.sh [dreamcast's IP address]"
  30. echo "IP of Dreamcast not specified. Quitting.\n "
  31. exit
  32. fi
  33.  
  34. echo "Beginning to download files from httpd-ack...\n"
  35. wget -r -w 1 -nH -R dc_bios*,dc_flash*,syscalls*,httpd-ack* $1
  36.  
  37. echo "Required disc access complete, spinning down disc..."
  38. wget -q -t 1 -O /dev/null $1/cdrom_spin_down
  39.  
  40. echo "Renaming downloaded tracks to their correct filenames..."
  41. for i in track*
  42. do mv "$i" "`echo $i | sed s/.ipbintoc.*$//`"
  43. done
  44.  
  45. echo "Generating dump information...\n"
  46.  
  47. echo "[b][u]Disc Information[/u]:[/b]" > postinfo.txt
  48. cat index.html \
  49. | head -16 | tail -10 \
  50. | sed 's/<tr><td>/[b]/g' \
  51. | sed 's/<\/td><td colspan=3>/:[\/b] /g' \
  52. | sed 's/<\/td><\/tr>//g' >> postinfo.txt
  53. rm index.html
  54.  
  55. echo "GDI info...\n"
  56.  
  57. printf "\nringcode:[code]<<write in ringcode here>>[/code]\n\ngdi information:[code]" >> postinfo.txt
  58. cat disc.gdi | tr -d "\r" | tee -a postinfo.txt
  59. echo "[/code]\n" >> postinfo.txt
  60. printf "file information:[quote]" >> postinfo.txt
  61.  
  62. echo "\nCalculating filesizes and hashes... This may take a while, please be patient.\n"
  63.  
  64. printf "disc.gdi " | tee -a postinfo.txt
  65. filesize="size "`ls -nl disc.gdi | awk '{print $5}'`
  66. printf "\t$filesize\t"
  67. printf "[color=red]%s[/color] " "$filesize" >> postinfo.txt
  68. crc32="crc "`crc32 disc.gdi`
  69. printf "$crc32 "
  70. printf "[color=green]%s[/color] " "$crc32" >> postinfo.txt
  71. md5="md5 "`openssl md5 disc.gdi | awk -F"=" '{ print $2 }' | sed 's/ //g'`
  72. printf "$md5 "
  73. printf "[color=blue]%s[/color] " "$md5" >> postinfo.txt
  74. sha1="sha1"`openssl sha1 disc.gdi | awk -F"=" '{ print $2 }'`
  75. printf "%s\n" "$sha1"
  76. printf "[color=red]%s[/color]\n" "$sha1" >> postinfo.txt
  77.  
  78. for track in track*
  79. do
  80. printf "$track " | tee -a postinfo.txt
  81. filesize="size "`ls -nl $track | awk '{print $5}'`
  82. printf "\t$filesize\t"
  83. printf "[color=red]%s[/color] " "$filesize" >> postinfo.txt
  84. crc32="crc "`crc32 $track`
  85. printf "$crc32 "
  86. printf "[color=green]%s[/color] " "$crc32" >> postinfo.txt
  87. md5="md5 "`openssl md5 $track | awk -F"=" '{ print $2 }' | sed 's/ //g'`
  88. printf "$md5 "
  89. printf "[color=blue]%s[/color] " "$md5" >> postinfo.txt
  90. sha1="sha1"`openssl sha1 $track | awk -F"=" '{ print $2 }'`
  91. printf "%s\n" "$sha1"
  92. printf "[color=red]%s[/color]\n" "$sha1" >> postinfo.txt
  93. done
  94.  
  95. echo "[/quote]\n" >> postinfo.txt
  96. echo "\npostinfo.txt generated... all done!"
Add Comment
Please, Sign In to add comment