Debian Codegraph @

misc/pkgos-fetch-fake-repo

raw
1 #!/bin/sh
2 # This script prepares a /etc/pkgos/fake-${TARGET_DISTRO}-mirror folder
3 # with Packages.gz and Sources.gz files so that we can later on use
4 # the madison-lite script when using pkgos-parse-requirements.
5 # Indeed, using rmadison for this task is a way too slow, considering the
6 # average amount of dependency in a typical OpenStack component.
7
8 set -e
9
10 if ! [ -r /etc/pkgos/pkgos.conf ] ; then
11 echo "Could not read /etc/pkgos/pkgos.conf"
12 exit 1
13 else
14 . /etc/pkgos/pkgos.conf
15 fi
16
17 # Create the folder and remove the Packages.gz / Sources.gz
18 DEST_DIST_DIR=/etc/pkgos/fake-${TARGET_DISTRO}-mirror/dists/${TARGET_DISTRO}/main
19 for i in binary-all binary-amd64 source ; do
20 if ! [ -d ${DEST_DIST_DIR}/$i ] ; then
21 mkdir -p ${DEST_DIST_DIR}/$i
22 fi
23 if [ "$i" = "source" ] ; then
24 GZFILE=Sources.gz
25 else
26 GZFILE=Packages.gz
27 fi
28 rm -f ${DEST_DIST_DIR}/$i/$GZFILE
29 wget ${CLOSEST_DEBIAN_MIRROR}/dists/${TARGET_DISTRO}/main/$i/$GZFILE -O ${DEST_DIST_DIR}/$i/$GZFILE
30 done