add a big comment

This commit is contained in:
Michael Hudson-Doyle 2019-03-26 13:27:34 +13:00
parent 181792f783
commit b9979cad2a
1 changed files with 36 additions and 5 deletions

View File

@ -1,9 +1,38 @@
#!/bin/bash -eux
# Configure apt so that installs from the pool on the cdrom are preferred
# during installation but not in the installed system.
#
# This has a few steps.
#
# 1. As the remaining steps mean that any changes to apt configuration are do
# not persist into the installed system, we get curtin to configure apt a
# bit earlier than it would by default.
#
# 2. Bind-mount the cdrom into the installed system as /run/cdrom
#
# 3. Set up an overlay over /target/etc/apt. This means that any changes we
# make will not persist into the installed system and we do not have to
# worry about cleaning up after ourselves.
#
# 4. Configure apt in /target to look at the pool on the cdrom. This has two
# subcases:
#
# a. if we expect the network to be working, this basically means
# prepending "deb file:///run/cdrom $(lsb_release -sc) main restricted"
# to the sources.list file.
#
# b. if the network is not expected to be working, we replace the
# sources.list with a file just referencing the cdrom.
#
# 5. If the network is not expected to be working, we also set up an overlay
# over /target/var/lib/apt/lists (if the network is working, we'll run "apt
# update" after the /target/etc/apt overlay has been cleared).
PY=$1
HAS_NETWORK=$2
mount -t tmpfs tmpfs "$TARGET_MOUNT_POINT/run"
mkdir -p "$TARGET_MOUNT_POINT/run/cdrom"
mount --bind /cdrom "$TARGET_MOUNT_POINT/run/cdrom"
$PY -m curtin apt-config
setup_overlay () {
local dir=$1
@ -12,10 +41,12 @@ setup_overlay () {
mount -t overlay overlay -o lowerdir=$dir,workdir=$t/work,upperdir=$t/upper $dir
}
$PY -m curtin apt-config
setup_overlay $TARGET_MOUNT_POINT/etc/apt
mount -t tmpfs tmpfs "$TARGET_MOUNT_POINT/run"
mkdir -p "$TARGET_MOUNT_POINT/run/cdrom"
mount --bind /cdrom "$TARGET_MOUNT_POINT/run/cdrom"
cat > "/tmp/sources.list" <<EOF
deb file:///run/cdrom $(lsb_release -sc) main restricted
EOF