From 9f46b4ce5b63d62865d873dd94fff2600c33fdaf Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Tue, 17 Sep 2024 15:13:18 +1000 Subject: [PATCH] Debugging fixes; in partuclar lifting out the main/debian-installer packages from the main section Packages file. No using an apparent main_debian-installer section in the pool. --- build-installer.sh | 85 +++++++++++++++++++++++++++++++--------------- 1 file changed, 57 insertions(+), 28 deletions(-) diff --git a/build-installer.sh b/build-installer.sh index 62bc964..92ae627 100755 --- a/build-installer.sh +++ b/build-installer.sh @@ -65,7 +65,7 @@ for S in $SECTIONS ; do P="${M%%=*}" F="${M#*=}" DEBURL["$P"]="$F" - DEBDIR["$P"]="$MEDIA/pool/$S" + DEBDIR["$P"]="$MEDIA/pool/${S/\//_}" PROVIDER["$P"]="$P" done done @@ -88,17 +88,28 @@ $TARGET_ARCH EOF ###################################################################### -# Unback a static busybox for the target architecture for a temporary -# installation of $INITRD/bin/sh as a do-nothing script. This setup is -# only used for installing libc6 and it will be overridden by -# installing busybox-udeb later. The purpose of this is only to -# install libc6, which has a troublesome preinst script that can and -# should be ignored in this use case. +# Unback a static busybox to have a $INITRD/sbin/losetup in support of +# loop devices and for an installation of $INITRD/bin/sh as a +# do-nothing script. The /bin/sh setup is a temporary patch to allow +# an early installation of libc6, which is wanted by some installer +# (captain's call) packages installed later. +# +# The static busybox is next overwritten by the busybox-udeb which is +# required by some udeb packages. But /sbin/losetup is hard-linked and +# will thus be preserved. It is used in the initrd-init script for +# presenting the package pool to the running installer. +# +# The purpose of using busybox-static for /bin/sh is for installation +# of libc6, which has a troublesome preinst script (that can and +# should be ignored in this use case). When busybox-udeb the script is +# replaced by a symbolic link to that binary. But libc6 is then +# already installed target_dpkg -E --unpack $(debs busybox-static) executable $INITRD/bin/sh <&2 EOF +ln $INITRD/bin/busybox $INITRD/sbin/losetup target_dpkg -E --install $(debs libc6) ###################################################################### @@ -107,6 +118,9 @@ target_dpkg -E --install $(debs libc6) # the initrd. Upon booting, this will locate the media pool and expand # itself and progress by installing further udeb packages from the # pool as enumerated by pool-packages-installer.list. +# +# Note that udebs are installed with "--force-overwrite" because some +# of them compete about adding some configuration files. UDEBS=( $( KERNELVERSION="${LINUX#linux-image-}" envsubst '${KERNELVERSION}' \ < $UDEBSLIST | sed '/#/d;/^$/d' ) @@ -123,35 +137,44 @@ echo ${DISTNAME} > $INITRD/etc/default-release mkdir $INITRD/etc/console-setup mkdir -p $INITRD/cdrom -# Install "initrd-init" as the initrd /init to run at boot time +sed 's/\(jessie.|ascii\))/\1|daedalus)/' -i \ + $INITRD/usr/share/debootstrap/scripts/daedalus +#sed '/base-passwd/s/x/cat mawk base-/' -i \ +# $INITRD/usr/share/debootstrap/scripts/daedalus + + +###################################################################### +# Install "initrd-init" as the initrd /init to run at boot time. This +# script is what the kernel executes at boot time. There is also an +# /sbin/init script that belongs to the installer software which +# however implements some other assumptions about the boot-up. cp initrd-init $INITRD/init ###################################################################### -# Set up package pool media. -# -# This will populate $MEDIA/pool/* with deb files and $MEDIA/dists -# with Packages.xz to describe them. First PKGS is extended with -# pool_packages, +# Set up package pool media. This will populate $MEDIA/pool/* with deb +# files from $(pool_packages) expanded with their depends and +# recommends, and thereafter a $MEDIA/dists structure is set up with +# Packages.xz to describe them and a Release file. At end the $MEDIA +# directory is touched-up with configurations needed by bootstrap-base +# before it's packed up as a squasfs into the $INITRD tree. for P in $(pool_packages) ; do F="${DEBURL[$P]}" [ -z "$F" ] || PKGS["$P"]="$F" done - -# Expand the PKGS table with depends and recommends; -echo -n "*** computing dependencies" >&2 -for P in ${!PKGS[@]} ; do expand_depends "$P" ; done +#-- Expand the PKGS table with depends and recommends; +echo -n "*** computing dependencies ..." >&2 +for P in ${!PKGS[@]} ; do expand_install_depends "$P" ; done echo - -# Download the PKGS table packages into their pool sections. +#-- Download the PKGS table packages into their pool sections. for P in ${!PKGS[@]} ; do download "$P" ; done -# Prepare the distribution indexes for the various sections. +#-- Prepare the distribution indexes for the various sections. for S in $SECTIONS ; do P="dists/$DISTNAME/$S/binary-$TARGET_ARCH/Packages" mkdir -p "$MEDIA/${P%/*}" - ( cd $MEDIA ; dpkg-scanpackages -t '*deb' "pool/$S" > $P ) + ( cd $MEDIA ; dpkg-scanpackages -t '*deb' "pool/${S/\//_}" > $P ) done - +#-- Prepare the repository Release file apt-ftparchive \ -o APT::FTPArchive::Release::Date="$(date -R)" \ -o APT::FTPArchive::Release::Label="DEVUANMEDIA" \ @@ -160,21 +183,27 @@ apt-ftparchive \ -o APT::FTPArchive::Release::Version="$DISTVERS" \ -o APT::FTPArchive::Release::Codename="$DISTNAME" \ -o APT::FTPArchive::Release::Architectures="$TARGET_ARCH" \ - -o APT::FTPArchive::Release::Components="$SECTIONS" \ + -o APT::FTPArchive::Release::Components="main" \ release $MEDIA/dists/$DISTNAME > $MEDIA/dists/$DISTNAME/Release ln -s $DISTNAME $MEDIA/dists/stable - -# Final media touch-up as expected by bootstrap-base +#-- Final media touch-up as expected by bootstrap-base mkdir $MEDIA/.disk/ touch $MEDIA/.disk/base_installable echo full_cd > $MEDIA/.disk/cd_type date +"Devuan GNU/Linux $DISTVERS $DISTNAME $ARCH - bespoke %Y%m%d" \ > $MEDIA/.disk/info +#-- Prepare a squashfs of $MEDIA into $INITRD. +fakeroot mksquashfs $MEDIA $INITRD/pool.squashfs + +## base-installer fixes +# cannot link /usr/bin/logger to /bin/busybox -- done already +ln -s /bin/busybox $INITRD/sbin/logger +rm $INITRD/bin/logger +# cannot open /bin/archdetect -- file exists +mv $INITRD/{bin,sbin}/archdetect ###################################################################### -# Prepare a squashfs of $MEDIA into $INITRD. Pack up $INITRD into a -# top-level initrd.gz, and copy out vmlinuz as well -fakeroot mksquashfs $MEDIA $INITRD/pool.squashfs +# Pack up $INITRD into a top-level initrd.gz, and copy out vmlinuz find $INITRD -not -name udebs -printf '%P\n' | \ fakeroot cpio -o -H newc -D $INITRD | gzip > initrd.gz cp $INITRD/boot/vmlinuz . -- 2.39.2