> I'm wondering if there is an equivalent of debootstrap of Debian
> anywhere.  By equivalent I mean a tool that ..

Given the fact that such a tool only has to handle 3 files (tarball,
digest + signature file) I guess there was never much need for such a
thing.

>  * I can run like "command FOLDER" with a chroot-able
>    Gentoo system in FOLDER after and
>
>  * for both stage3 and portage tarballs
>    * Downloading tarball
>    * Downloading signature file
>    * Verifying signature
>    * Extracting
>
> Has anyone seen something like that?

I have a very rudimentary script that automates part of this procedure
(without portage snapshot). Maybe this can serve as a starting
point. Please find it attached.

Best,
Matthias

--


#!/bin/bash -eu

ARCH=${1:-amd64}
MIRROR="http://ftp.uni-erlangen.de/pub/mirrors/gentoo";

if [[ $ARCH =~ ^i.86$ ]]
then
  SUBDIR="/releases/x86/autobuilds"
else
  SUBDIR="/releases/${ARCH}/autobuilds"
fi

CONTROL_FILE="latest-stage3-${ARCH}.txt"

wget -c "${MIRROR}${SUBDIR}/${CONTROL_FILE}"

STAGE=$(tail -n 1 "${CONTROL_FILE}")

if [[ ! $STAGE =~ ^([a-z0-9]|/|-|\.)+$ ]]
then
  echo "invalid content"
  exit 1
fi

wget -c "${MIRROR}${SUBDIR}/${STAGE}"
wget -c "${MIRROR}${SUBDIR}/${STAGE}.CONTENTS"
wget -c "${MIRROR}${SUBDIR}/${STAGE}.DIGESTS.asc"

STAGE=$(basename "${STAGE}")

gpg --trust-model=always --no-options --batch --no-tty \
    --no-default-keyring --keyring=/etc/portage/keyring/pubring.gpg \
    --verify "${STAGE}.DIGESTS.asc"

gpg --trust-model=always --no-options --batch --no-tty \
    --no-default-keyring --keyring=/etc/portage/keyring/pubring.gpg \
    --decrypt <"${STAGE}.DIGESTS.asc" >"${STAGE}.DIGESTS"

sed -i -e '7,8d' -e '3,4d' "${STAGE}.DIGESTS"
sha512sum -c "${STAGE}.DIGESTS"

read -p "Continue? y/n: " yesno
if [[ "$yesno" != "y" ]]; then
  exit 1
fi

tar -xvf "${STAGE}"

Attachment: signature.asc
Description: PGP signature

Reply via email to