summaryrefslogtreecommitdiff
path: root/util/common.sh
blob: f4b741e3d51dbc37c3f4382dfc85c0e79922568a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
TMPDIR="/var/tmp/manned-indexer"

test -f .config && source ./.config


index() {
  echo "====> indexer -v $@"
  ./indexer -v $@ 2>&1
  echo
}


# Convenient wrapper around index() for debian repos
# Usage: index_dev sys mirror distro list-of-components [contents]
#   contents:
#     empty for global Contents-i386.gz location
#     "cmp" for per-component Contents.i386.gz location
#     Otherwise, full path to Contents file
index_deb() {
  local SYS=$1
  local MIRROR=$2
  local DISTRO=$3
  local COMPONENTS=$4
  local CONTENTS=${5:-"dists/$DISTRO/Contents-$ARCH.gz"}
  local ARCH=${6:-"i386"}

  for CMP in $COMPONENTS; do
    local CONT=$CONTENTS
    test $CONT = cmp && CONT="dists/$DISTRO/$CMP/Contents-$ARCH.gz"
    index deb --sys "$SYS" --mirror "$MIRROR" --contents "$MIRROR$CONT" --packages "${MIRROR}dists/$DISTRO/$CMP/binary-$ARCH/Packages.gz"
  done
}