[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#811243: base-installer: shouldn't assume that file protocol is only used for CD (image) installs



Package: base-installer
Version: 1.160
Severity: normal
Tags: d-i

Hi there,

The following snippet can be found in library.sh:

    # Assumes the file protocol is only used for CD (image) installs
    configure_apt () {
        if [ "$PROTOCOL" = file ]; then
           	[…]
           	if ! log-output -t base-installer \
            		chroot /target apt-cdrom add </dev/null; then
                error "error while running apt-cdrom"
            fi
        else
            # sources.list uses space to separate the components, not comma
            COMPONENTS=$(echo $COMPONENTS | tr , " ")
            APTSOURCE="$PROTOCOL://$MIRROR$DIRECTORY"
    
            echo "deb $APTSOURCE $DISTRIBUTION $COMPONENTS" > $APT_SOURCES
        fi

Is there reason for making such an assumption?  I didn't check whether
$PROTOCOL was used by other packages, but even if the value can't be
changed to say, “cdrom”, please at least ensure that it was set to
“file” because a CDROM was detected; for instance by replacing the test
with

    if [ "$PROTOCOL" = file ] && [ -f /cdrom/.disk/base_installable ]; then

(which the test performed by get_mirror_info to set PROTOCOL in the
first place).

It might sound weird to use a file:// mirror URI.  But in my case it's
very convenient when setting up minimal networkless VMs to use in a test
suite (with a shared partial mirror in a directory exposed to the
guests).  base-installer currently calls apt-cdrom(8) on that directory,
which is needlessly slow and sometimes even confusing when a popup asks
me to insert the disk (probably due to a race condition).

Thanks,
cheers,
-- 
Guilhem.

Attachment: signature.asc
Description: PGP signature


Reply to: