summaryrefslogtreecommitdiff
path: root/deb-update.sh
blob: 55c5d441c96c5a590a332920a5a6d27cd923f1a0 (plain)
  1. #! /bin/sh
  2. if [ $# -eq 0 ]; then
  3. echo "Usage: $(basename $0) AREAS BRANCHES DISTS ARCHS"
  4. echo " (multiple values must \"be quoted\" to look as one on the commandline)"
  5. echo "Example: $(basename $0) misc \"default unstable source\" 'potato sid' i386"
  6. exit 1
  7. fi
  8. BASE="/debian/local"
  9. AREAS=$1
  10. BRANCHES="$2"
  11. DISTS="$3"
  12. ARCHS="$4"
  13. for ARCH in $ARCHS; do
  14. for DIST in $DISTS; do
  15. for BRANCH in $BRANCHES; do
  16. for AREA in $AREAS; do
  17. case $BRANCH in
  18. default)
  19. DIR="dists/$DIST/$AREA/binary-$ARCH"
  20. ECHODIR="dists/DIST/AREA/binary-ARCH"
  21. ;;
  22. source)
  23. DIR="dists/$DIST/$AREA/source"
  24. ECHODIR="dists/DIST/AREA/source"
  25. ;;
  26. *-source)
  27. DIR="dists/$DIST/$BRANCH/$AREA/source"
  28. ECHODIR="dists/DIST/BRANCH/AREA/source"
  29. ;;
  30. *)
  31. DIR="dists/$DIST/$BRANCH/$AREA/binary-$ARCH"
  32. ECHODIR="dists/DIST/BRANCH/AREA/binary-ARCH"
  33. ;;
  34. esac
  35. echo "Checking directories..."
  36. if [ -d $BASE/$DIR ]; then
  37. echo " $ECHODIR looks fine."
  38. else
  39. echo "$0: $BASE/$DIR is not a directory"
  40. echo
  41. echo "AREA must exist."
  42. echo
  43. echo "BRANCH can be either default or source, special ones like unstable or private,"
  44. echo "or space-delimited combinations. Default is \"default\"."
  45. echo
  46. echo "DIST can be \"potato\", \"potato woody\" or similar. Default is \"stable\""
  47. echo
  48. echo "ARCH is \"i386\" or whatever you have. Default is \"i386\"."
  49. echo
  50. echo "The corresponding directory must exist: $BASE/$ECHODIR."
  51. exit 1
  52. fi
  53. done
  54. done
  55. done
  56. done
  57. for ARCH in $ARCHS; do
  58. for DIST in $DISTS; do
  59. for BRANCH in $BRANCHES; do
  60. for AREA in $AREAS; do
  61. SRC=""
  62. case $BRANCH in
  63. default)
  64. DIR="dists/$DIST/$AREA/binary-$ARCH"
  65. ;;
  66. source)
  67. DIR="dists/$DIST/$AREA/source"
  68. SRC="1"
  69. ;;
  70. *-source)
  71. DIR="dists/$DIST/$AREA/$BRANCH/source"
  72. SRC="1"
  73. ;;
  74. *)
  75. DIR="dists/$DIST/$BRANCH/$AREA/binary-$ARCH"
  76. ;;
  77. esac
  78. echo "Scanning $DIR..."
  79. if [ $SRC ]; then
  80. (cd $BASE; \
  81. dpkg-scansources $DIR /dev/null > $DIR/Sources; \
  82. touch $DIR/Sources; \
  83. rm -f $DIR/Sources.gz; \
  84. gzip -c $DIR/Sources > $DIR/Sources.gz; \
  85. )
  86. else
  87. (cd $BASE; \
  88. dpkg-scanpackages $DIR /dev/null > $DIR/Packages; \
  89. touch $DIR/Packages; \
  90. rm -f $DIR/Packages.gz; \
  91. gzip -c $DIR/Packages > $DIR/Packages.gz; \
  92. )
  93. fi
  94. done
  95. done
  96. done
  97. done