From e784352bd768ed814e92d2e0c65234abe5d912b2 Mon Sep 17 00:00:00 2001 From: CyberLeo Date: Wed, 11 Jul 2012 12:34:02 -0500 Subject: [PATCH] j/seeds: use local repo cache if it exists; otherwise use archive --- seeds/debian.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/seeds/debian.sh b/seeds/debian.sh index 3c02073..85aec10 100644 --- a/seeds/debian.sh +++ b/seeds/debian.sh @@ -18,14 +18,26 @@ esac [ "${suite}" ] || pebkac "Debian seed needs [repo]" -[ "${repo}" ] || repo="file://${jseed}/debian" +[ "${repo}" ] || { + if [ -f "${jseed}/debian/dists/${suite}/Release" ] + then + repo="file://${jseed}/debian" + else + repo="http://archive.debian.org/debian" + fi +} + +keyring="${jseed}/debian/debian-archive-keyring.gpg" +[ -f "${keyring}" ] || unset keyring mkdir -p "${jroot}/var/cache/apt/archives" -echo "Seeding deb archives" >&2 -( cd "${jseed}/debian/debs"; find . | cpio -pl "${jroot}/var/cache/apt/archives" ) +[ ! -d "${jseed}/debian/debs" ] || { + echo "Seeding deb archives" >&2 + ( cd "${jseed}/debian/debs"; find . | cpio -pl "${jroot}/var/cache/apt/archives" ) +} -cmd="debootstrap '--arch=${arch}' '--keyring=${jseed}/debian/debian-archive-keyring.gpg' '--include=${include}' '${suite}' '${jroot}' '${repo}'" +cmd="debootstrap '--arch=${arch}' ${keyring+'--keyring=${jseed}/debian/debian-archive-keyring.gpg'} '--include=${include}' '${suite}' '${jroot}' '${repo}'" echo "Executing: ${cmd}" eval "${cmd}" -- 2.42.0