Gentoo Archives: gentoo-dev

From: Matthias Maier <tamiko@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] debootstrap equivalent for Gentoo?
Date: Sun, 28 Dec 2014 08:14:54
Message-Id: 87h9wgyyvs.fsf@jackdaw.kyomu.43-1.org
In Reply to: [gentoo-dev] debootstrap equivalent for Gentoo? by Sebastian Pipping
1 > I'm wondering if there is an equivalent of debootstrap of Debian
2 > anywhere. By equivalent I mean a tool that ..
3
4 Given the fact that such a tool only has to handle 3 files (tarball,
5 digest + signature file) I guess there was never much need for such a
6 thing.
7
8 > * I can run like "command FOLDER" with a chroot-able
9 > Gentoo system in FOLDER after and
10 >
11 > * for both stage3 and portage tarballs
12 > * Downloading tarball
13 > * Downloading signature file
14 > * Verifying signature
15 > * Extracting
16 >
17 > Has anyone seen something like that?
18
19 I have a very rudimentary script that automates part of this procedure
20 (without portage snapshot). Maybe this can serve as a starting
21 point. Please find it attached.
22
23 Best,
24 Matthias
25
26 --
27
28
29 #!/bin/bash -eu
30
31 ARCH=${1:-amd64}
32 MIRROR="http://ftp.uni-erlangen.de/pub/mirrors/gentoo"
33
34 if [[ $ARCH =~ ^i.86$ ]]
35 then
36 SUBDIR="/releases/x86/autobuilds"
37 else
38 SUBDIR="/releases/${ARCH}/autobuilds"
39 fi
40
41 CONTROL_FILE="latest-stage3-${ARCH}.txt"
42
43 wget -c "${MIRROR}${SUBDIR}/${CONTROL_FILE}"
44
45 STAGE=$(tail -n 1 "${CONTROL_FILE}")
46
47 if [[ ! $STAGE =~ ^([a-z0-9]|/|-|\.)+$ ]]
48 then
49 echo "invalid content"
50 exit 1
51 fi
52
53 wget -c "${MIRROR}${SUBDIR}/${STAGE}"
54 wget -c "${MIRROR}${SUBDIR}/${STAGE}.CONTENTS"
55 wget -c "${MIRROR}${SUBDIR}/${STAGE}.DIGESTS.asc"
56
57 STAGE=$(basename "${STAGE}")
58
59 gpg --trust-model=always --no-options --batch --no-tty \
60 --no-default-keyring --keyring=/etc/portage/keyring/pubring.gpg \
61 --verify "${STAGE}.DIGESTS.asc"
62
63 gpg --trust-model=always --no-options --batch --no-tty \
64 --no-default-keyring --keyring=/etc/portage/keyring/pubring.gpg \
65 --decrypt <"${STAGE}.DIGESTS.asc" >"${STAGE}.DIGESTS"
66
67 sed -i -e '7,8d' -e '3,4d' "${STAGE}.DIGESTS"
68 sha512sum -c "${STAGE}.DIGESTS"
69
70 read -p "Continue? y/n: " yesno
71 if [[ "$yesno" != "y" ]]; then
72 exit 1
73 fi
74
75 tar -xvf "${STAGE}"

Attachments

File name MIME type
signature.asc application/pgp-signature