summaryrefslogtreecommitdiff
path: root/deb-update.sh
blob: a93fe03e7bcd73d7a3e1176182b9da4a854bdcb4 (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. ;;
  21. source)
  22. DIR="dists/$DIST/$AREA/source"
  23. ;;
  24. *-source)
  25. DIR="dists/$DIST/$BRANCH/$AREA/source"
  26. ;;
  27. *)
  28. DIR="dists/$DIST/$BRANCH/$AREA/binary-$ARCH"
  29. ;;
  30. esac
  31. echo "Checking directories..."
  32. if [ -d $BASE/$DIR ]; then
  33. echo " $DIR looks fine."
  34. else
  35. echo "$0: $BASE/$DIR is not a directory"
  36. echo
  37. echo "AREA must exist."
  38. echo
  39. echo "BRANCH can be either default or source, special ones like unstable or private,"
  40. echo "or space-delimited combinations. Default is \"default\"."
  41. echo
  42. echo "DIST can be \"potato\", \"potato woody\" or similar. Default is \"stable\""
  43. echo
  44. echo "ARCH is \"i386\" or whatever you have. Default is \"i386\"."
  45. echo
  46. echo "The corresponding directory must exist: $BASE/$DIR."
  47. exit 1
  48. fi
  49. done
  50. done
  51. done
  52. done
  53. for ARCH in $ARCHS; do
  54. for DIST in $DISTS; do
  55. for BRANCH in $BRANCHES; do
  56. for AREA in $AREAS; do
  57. SRC=""
  58. case $BRANCH in
  59. default)
  60. DIR="dists/$DIST/$AREA/binary-$ARCH"
  61. ;;
  62. source)
  63. DIR="dists/$DIST/$AREA/source"
  64. SRC="1"
  65. ;;
  66. *-source)
  67. DIR="dists/$DIST/$AREA/$BRANCH/source"
  68. SRC="1"
  69. ;;
  70. *)
  71. DIR="dists/$DIST/$BRANCH/$AREA/binary-$ARCH"
  72. ;;
  73. esac
  74. echo "Scanning $DIR..."
  75. if [ $SRC ]; then
  76. (cd $BASE; \
  77. dpkg-scansources $DIR /dev/null > $DIR/Sources; \
  78. touch $DIR/Sources; \
  79. rm -f $DIR/Sources.gz; \
  80. gzip -c $DIR/Sources > $DIR/Sources.gz; \
  81. )
  82. else
  83. (cd $BASE; \
  84. dpkg-scanpackages $DIR /dev/null > $DIR/Packages; \
  85. touch $DIR/Packages; \
  86. rm -f $DIR/Packages.gz; \
  87. gzip -c $DIR/Packages > $DIR/Packages.gz; \
  88. )
  89. fi
  90. done
  91. done
  92. done
  93. done