Adding additional apt repositories during the build

9 views
Skip to first unread message

Benedikt Niedermayr

unread,
Nov 9, 2018, 5:18:25 AM11/9/18
to isar-...@googlegroups.com

Hi guys,

I wanted to add additional repositories at the beginning of the build (e.g for installing docker-ce) and I tried to add it to the  "DISTRO_APT_KEYS" variable.

But doing that way debootstrap doesn't seem to work anymore:

| I: Retrieving InRelease
| I: Retrieving Release
| I: Retrieving Release.gpg
| I: Checking Release signature
| E: Release signed by unknown key (key id EF0F382A1A7B6500)
| WARNING: exit code 1 from a shell command.


I think the default gpg keyring gets overwritten.

Do you have any proposals or clean solutions for this?


For now I implemented a little hack to get things to work.

Maybe we need a functionality in Isar which works like a hook based mechanism, so we can add those

to the initial build step when bootstrapping the rootfs.


isar-bootstrap-host.bbappend & isar-bootstrap-target.bbappend:

do_bootstrap_append() {
    sudo install -v -m755 ${WORKDIR}/custom-setup.sh ${ROOTFSDIR}/
    sudo flock "${ISAR_BOOTSTRAP_LOCK}" -c "\
        set -e
        export DISTRO_SUITE="${@get_distro_suite(d, True)}"
        export DISTRO_ARCH="${DISTRO_ARCH}"
        chroot "${ROOTFSDIR}" /custom-setup.sh
    "
    sudo rm -f ${ROOTFSDIR}/custom-setup.sh
}
custom-setup.sh:
apt-get install --no-install-recommends -y curl apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL $GPG_URL | apt-key add -
echo "deb [arch=$DISTRO_ARCH] https://download.docker.com/linux/debian \
$DISTRO_SUITE stable" | \
tee /etc/apt/sources.list.d/docker.list
apt-get update -y
Regards
Benedikt

Maxim Yu. Osipov

unread,
Nov 9, 2018, 5:53:40 AM11/9/18
to Benedikt Niedermayr, isar-...@googlegroups.com
Hi Benedikt,

On 11/9/18 1:17 PM, 'Benedikt Niedermayr' via isar-users wrote:
> Hi guys,
>
> I wanted to add additional repositories at the beginning of the build
> (e.g for installing docker-ce) and I tried to add it to the
> "DISTRO_APT_KEYS" variable.
>
> But doing that way debootstrap doesn't seem to work anymore:
>
> | I: Retrieving InRelease
> | I: Retrieving Release
> | I: Retrieving Release.gpg
> | I: Checking Release signature
> | E: Release signed by unknown key (key id EF0F382A1A7B6500)
> | WARNING: exit code 1 from a shell command.
>
>
> I think the default gpg keyring gets overwritten.
>
> Do you have any proposals or clean solutions for this?

Yes, this is a known problem (I absolutely agree that this
DISTRO_APT_KEYS is confusing) and I plan to fix it in a next couple of
weeks.

Thanks for your proposal - I'll think if installation of keys could be
done with less "hooky" way.

Regards,
Maxim.

>
> For now I implemented a little hack to get things to work.
>
> Maybe we need a functionality in Isar which works like a hook based
> mechanism, so we can add those
>
> to the initial build step when bootstrapping the rootfs.
>
>
> isar-bootstrap-host.bbappend & isar-bootstrap-target.bbappend:
>
> do_bootstrap_append() {
>     sudo install -v -m755 ${WORKDIR}/custom-setup.sh ${ROOTFSDIR}/
>     sudo flock "${ISAR_BOOTSTRAP_LOCK}"-c "\
>         set -e
>         export DISTRO_SUITE="${@get_distro_suite(d, True)}"
>         export DISTRO_ARCH="${DISTRO_ARCH}"
>         chroot "${ROOTFSDIR}" /custom-setup.sh
>     "
>     sudo rm -f ${ROOTFSDIR}/custom-setup.sh
> }
> custom-setup.sh:
> GPG_URL="https://download.docker.com/linux/debian/gpg"
> apt-get install --no-install-recommends -y curl apt-transport-https
> ca-certificates curl gnupg2 software-properties-common
> curl -fsSL $GPG_URL |apt-key add -
> echo "deb [arch=$DISTRO_ARCH] https://download.docker.com/linux/debian \
> $DISTRO_SUITE stable"|\
> tee /etc/apt/sources.list.d/docker.list
> apt-get update -y
> Regards
> Benedikt
>
> --
> You received this message because you are subscribed to the Google
> Groups "isar-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to isar-users+...@googlegroups.com
> <mailto:isar-users+...@googlegroups.com>.
> To post to this group, send email to isar-...@googlegroups.com
> <mailto:isar-...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/isar-users/42954dda-cc28-4cf4-e1fe-a3b1b636a4a3%40googlemail.com
> <https://groups.google.com/d/msgid/isar-users/42954dda-cc28-4cf4-e1fe-a3b1b636a4a3%40googlemail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.


--
Maxim Osipov
ilbers GmbH
Maria-Merian-Str. 8
85521 Ottobrunn
Germany
+49 (151) 6517 6917
mos...@ilbers.de
http://ilbers.de/
Commercial register Munich, HRB 214197
General Manager: Baurzhan Ismagulov
Reply all
Reply to author
Forward
0 new messages