Add support for multiple pools (/var/lib/{livefs,preinstalled}-pool/).

This commit is contained in:
Simon Quigley 2025-02-19 02:15:04 -06:00
parent e71a331e82
commit 818af83d4d
2 changed files with 37 additions and 34 deletions

1
debian/changelog vendored
View File

@ -10,6 +10,7 @@ livecd-rootfs (25.04.18) UNRELEASED; urgency=medium
* Update debhelper compat to 13, no changes needed.
* Make the package completely Lintian-clean except for no-dep5-copyright.
* Update Standards-Version to 4.7.0, no changes needed.
* Add support for multiple pools (/var/lib/{livefs,preinstalled}-pool/).
-- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Mon, 17 Feb 2025 11:12:00 +1300

View File

@ -241,10 +241,11 @@ EOF
configure_universe
if [ -d chroot/var/lib/preinstalled-pool ]; then
cat > config/indices/apt.conf <<-EOF
for POOL_DIR in preinstalled-pool livefs-pool; do
if [ -d chroot/var/lib/$POOL_DIR ]; then
cat > config/indices/apt.conf <<-EOF
Dir {
ArchiveDir "chroot/var/lib/preinstalled-pool";
ArchiveDir "chroot/var/lib/$POOL_DIR";
OverrideDir "config/indices";
CacheDir "config/indices";
}
@ -259,11 +260,11 @@ Tree "dists/$LB_DISTRIBUTION"
Contents " ";
}
EOF
for component in $LB_PARENT_ARCHIVE_AREAS; do
mkdir -p chroot/var/lib/preinstalled-pool/dists/$LB_DISTRIBUTION/$component/binary-$LB_ARCHITECTURES
done
apt-ftparchive generate config/indices/apt.conf
cat << @@EOF > chroot/etc/apt/sources.list.d/preinstalled-pool.sources
for component in $LB_PARENT_ARCHIVE_AREAS; do
mkdir -p chroot/var/lib/$POOL_DIR/dists/$LB_DISTRIBUTION/$component/binary-$LB_ARCHITECTURES
done
apt-ftparchive generate config/indices/apt.conf
cat << @@EOF > chroot/etc/apt/sources.list.d/$POOL_DIR.sources
# This is a sources.list entry for a small pool of packages
# provided on your preinstalled filesystem for your convenience.
#
@ -272,40 +273,41 @@ EOF
# packages remotely instead.
#
Types: deb
URIs: file:/var/lib/preinstalled-pool/
URIs: file:/var/lib/$POOL_DIR/
Suites: $LB_DISTRIBUTION
Components: $LB_PARENT_ARCHIVE_AREAS
Signed-By: /etc/apt/keyrings/preinstalled-pool.gpg
Signed-By: /etc/apt/keyrings/$POOL_DIR.gpg
@@EOF
echo "Waiting on gnupg ("$GPG_PROCESS") to finish generating a key."
wait $GPG_PROCESS
echo "Waiting on gnupg ("$GPG_PROCESS") to finish generating a key."
wait $GPG_PROCESS
R_ORIGIN=$(lsb_release -i -s)
R_CODENAME=$(lsb_release -c -s)
R_VERSION=$(lsb_release -r -s)
R_PRETTYNAME=$(echo $R_CODENAME | sed -e 's/^\(.\)/\U\1/')
R_ORIGIN=$(lsb_release -i -s)
R_CODENAME=$(lsb_release -c -s)
R_VERSION=$(lsb_release -r -s)
R_PRETTYNAME=$(echo $R_CODENAME | sed -e 's/^\(.\)/\U\1/')
apt-ftparchive -o APT::FTPArchive::Release::Origin=$R_ORIGIN \
-o APT::FTPArchive::Release::Label=$R_ORIGIN \
-o APT::FTPArchive::Release::Suite=$R_CODENAME-local \
-o APT::FTPArchive::Release::Version=$R_VERSION \
-o APT::FTPArchive::Release::Codename=$R_CODENAME \
-o APT::FTPArchive::Release::Description="$R_ORIGIN $R_PRETTYNAME Local" \
release chroot/var/lib/preinstalled-pool/dists/$R_CODENAME/ \
> config/gnupg/Release
apt-ftparchive -o APT::FTPArchive::Release::Origin=$R_ORIGIN \
-o APT::FTPArchive::Release::Label=$R_ORIGIN \
-o APT::FTPArchive::Release::Suite=$R_CODENAME-local \
-o APT::FTPArchive::Release::Version=$R_VERSION \
-o APT::FTPArchive::Release::Codename=$R_CODENAME \
-o APT::FTPArchive::Release::Description="$R_ORIGIN $R_PRETTYNAME Local" \
release chroot/var/lib/$POOL_DIR/dists/$R_CODENAME/ \
> config/gnupg/Release
gpg --home config/gnupg --detach-sign --armor config/gnupg/Release
mv config/gnupg/Release \
chroot/var/lib/preinstalled-pool/dists/$R_CODENAME/Release
mv config/gnupg/Release.asc \
chroot/var/lib/preinstalled-pool/dists/$R_CODENAME/Release.gpg
cp config/gnupg/pubring.gpg chroot/etc/apt/keyrings/preinstalled-pool.gpg
find chroot/var/lib/preinstalled-pool/ -name Packages | xargs rm
# We only want to have a cache for the pre-installed pool at this point
Chroot chroot "apt-get update -o Dir::Etc::SourceParts=/dev/null -oDir::Etc::SourceList=etc/apt/sources.list.d/preinstalled-pool.sources"
fi
gpg --home config/gnupg --detach-sign --armor config/gnupg/Release
mv config/gnupg/Release \
chroot/var/lib/$POOL_DIR/dists/$R_CODENAME/Release
mv config/gnupg/Release.asc \
chroot/var/lib/$POOL_DIR/dists/$R_CODENAME/Release.gpg
cp config/gnupg/pubring.gpg chroot/etc/apt/keyrings/$POOL_DIR.gpg
find chroot/var/lib/$POOL_DIR/ -name Packages | xargs rm
# We only want to have a cache for the pre-installed pool at this point
Chroot chroot "apt-get update -o Dir::Etc::SourceParts=/dev/null -oDir::Etc::SourceList=etc/apt/sources.list.d/$POOL_DIR.sources"
fi
done
case $PROJECT:$SUBPROJECT in
*)
if [ -e "config/seeded-snaps" ]; then