mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
3.5 KiB

  1. #!/bin/bash
  2. #
  3. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  4. #
  5. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  6. # Please add additional copyright information _after_ the line containing
  7. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  8. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  9. #
  10. # ROCK Linux: rock-src/scripts/Create-CkSumPatch
  11. # ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf
  12. #
  13. # This program is free software; you can redistribute it and/or modify
  14. # it under the terms of the GNU General Public License as published by
  15. # the Free Software Foundation; either version 2 of the License, or
  16. # (at your option) any later version. A copy of the GNU General Public
  17. # License can be found at Documentation/COPYING.
  18. #
  19. # Many people helped and are helping developing ROCK Linux. Please
  20. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  21. # file for details.
  22. #
  23. # --- ROCK-COPYRIGHT-NOTE-END ---
  24. if [ $# = 1 -a "$1" = -misc ] ; then
  25. set x -repository misc ; shift
  26. fi
  27. if [ $# = 1 -a "$1" = -all ] ; then
  28. shift $# ; cmpfield=2
  29. else
  30. if [ "$1" = "-repository" -o "$1" = "-target" ]
  31. then cmpfield=2 ; shift ; else cmpfield=3 ; fi
  32. if [ "$#" -eq 0 -o "${1#-}" != "$1" ] ; then
  33. echo "Usage: $0 <package-names>"
  34. echo "or $0 -repository <respository-names>"
  35. echo "or $0 -target <target-names>"
  36. echo "or $0 -misc"
  37. echo "or $0 -all"
  38. exit 1
  39. fi
  40. fi
  41. echo "Creating cksum.patch ..."
  42. echo -n > cksum.patch
  43. ./scripts/Download -list-cksums | grep '^00* ' | \
  44. while read cksum gzfile ; do
  45. bzfile="`echo "$gzfile" | sed 's,\.\(t\?\)gz$,.\1bz2,'`"
  46. if [ -f "$bzfile" ]
  47. then
  48. checkthis=1
  49. y="`echo $bzfile | cut -f$cmpfield -d/`"
  50. for x ; do
  51. [ $checkthis = 1 ] && checkthis=0
  52. [ "$y" = $x ] && checkthis=2
  53. done
  54. if [ $checkthis = 0 ] ; then
  55. : echo "Skip: $bzfile" ; continue
  56. fi
  57. if [[ "$bzfile" = *.bz2 ]] || [[ "$bzfile" = *.tbz2 ]] ; then
  58. echo -n "$bzfile (bzip2): "
  59. cksum="`bunzip2 < $bzfile | cksum | cut -f1 -d' '`"
  60. else
  61. echo -n "$gzfile (raw): "
  62. cksum="`cksum "$gzfile" | cut -f1 -d' '`"
  63. fi
  64. echo $cksum
  65. rep="`echo $bzfile | cut -f2 -d/`"
  66. if [ -d package/$rep ] ; then
  67. xfile="`echo $gzfile | cut -f4- -d/`"
  68. pkgdir="package/`echo $gzfile | cut -f2,3 -d/`"
  69. descfile="$pkgdir/`echo $gzfile | cut -f3 -d/`.desc"
  70. if [ -f $descfile ] ; then
  71. sedscript="s,\[D\] *00* *$xfile,[D] $cksum $xfile,"
  72. sed "$sedscript" < $descfile > /tmp/$$
  73. if cmp -s ./$descfile /tmp/$$ ; then
  74. echo "!!! SED script didn't change anything:"
  75. echo "!!! $sedscript"
  76. else
  77. { echo "diff -u0 ./$descfile /tmp/$$"
  78. diff -u0 ./$descfile /tmp/$$ ; } >> cksum.patch
  79. fi
  80. rm -f /tmp/$$
  81. else
  82. echo "!!! No Desc File for $gzfile"
  83. echo "!!! (My guess was $descfile)"
  84. fi
  85. elif [ -d target/$rep -o "$rep" = misc ] ; then
  86. if [ -d target/$rep ] ; then
  87. descfile="target/$rep/download.txt"
  88. else
  89. descfile="scripts/miscdown.txt"
  90. fi
  91. xfile="`echo $gzfile | cut -f3- -d/`"
  92. if [ -f $descfile ] ; then
  93. sedscript="s,^00* *$xfile,$cksum $xfile,"
  94. sed "$sedscript" < $descfile > /tmp/$$
  95. if cmp -s ./$descfile /tmp/$$ ; then
  96. echo "!!! SED script didn't change anything:"
  97. echo "!!! $sedscript"
  98. else
  99. { echo "diff -u0 ./$descfile /tmp/$$"
  100. diff -u0 ./$descfile /tmp/$$ ; } >> cksum.patch
  101. fi
  102. rm -f /tmp/$$
  103. else
  104. echo "!!! No Desc File for $gzfile"
  105. echo "!!! (My guess was $descfile)"
  106. fi
  107. else
  108. echo "!!! No Desc File for $gzfile"
  109. echo "!!! (I didn't have any possible guesses)"
  110. fi
  111. fi
  112. done