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

Re: debconf apt configurator

> Joey Hess <joey@kitenet.net> writes:
> > Here is a first stab at such a UI. I am using debconf as the frontend to it,
> > which means it can have a variety of looks and feels, including a dialog ui,
> > like Adam wants. To take a look at it:
> [...]
> > It currently handles http and ftp well; cdrom, nfs, and a mounted filesystem
> > need to be fleshed out. It asks if you want non-free, and if so, if you want
> > contrib. Then it lets you pick from a list of countries, and choose from a
> > list of mirrors in the country. It finishes by spitting out an apt.sources
> > line. There is also provision made for entering mirror data manually.
> Okay, sounds good for the network part.  Regarding CD-ROM, I think it
> should *first* check in some reasonable locations on whether a CD-ROM
> is present.  I've CC'd <debian-cd>, perhaps they can give us some
> clues on platform-independant ways of doing this.  I would suppose
> checking for ISO filesystems and well-known top-level files which
> appear on the CD in well-known devices locations, such as /dev/hdc,
> /dev/cdrom, /dev/scd[01].  I wouldn't think it'd be *too* hard to do
> this.  A fallback would be to ask for the device where the CD-ROM is.

Cdrom autodetection can be done by trying to mount in sequence all known
cdrom locations until one succeds. It can output some ugly error messages
on the console but should work well with most common hardware. If it fails
just prompt the user and try again. This is the code I use to autodetect the
installation cdrom with my automatic installer:

find_cdrom() {
    umount $TEMP_MPOINT
    for device in $CDROM $(find_cdrom_devices); do
	test "$device" || continue
	mount -o ro -t iso9660 $device $TEMP_MPOINT 2>/dev/null || continue
        umount $device
	echo "$device"

find_cdrom_devices() {
    local devices="$(
	fdisk -l 2>/dev/null \
	  | awk -v FS="[ :]" '/ 1 cylinders/ { print $2 }'
	if cat /proc/scsi/scsi 2>/dev/null | grep -qw 'CD-ROM'; then
	    echo "/dev/scd0"
	    echo "/dev/scd1"
    echo "$devices"

is_dist_cdrom() {
    local device=$1
    local rc=1
    test "$device" || return 1
    umount $TEMP_MPOINT
    mount -o ro -t iso9660 $device $TEMP_MPOINT 2>/dev/null || return 1
    test -e $TEMP_MPOINT/.disk/info -a -d $TEMP_MPOINT/debian/dists && rc=0
    umount $device
    return $rc

The autodetection should be done at the very beginning of the installation,
before installing the rescue disk and all the rest, because it could be used
as source of the base installation.

When the source location is somewhat `local', i.e. cdrom, harddisk or nfs, it
can be easily inherited by the second part of the installation and used to
create automatically the apt sources.list file. The trick is to figure out
where the source has been mounted in the first step, create a small script
which will mount the source in the second step just before starting apt and
translate all the "deb cdrom:..." lines of a preconfigured sources.list
contained in the sources tree into the "deb whatever:..." which describe the
actual source mount point. This can be easily done with simple shell code.
The only problem is that the distribution source must be mounted with the
apt-mount script each time one wants to install new packages, but this could
be solved is some way.

Im my opinion all the apt configuration prompting should be entirely skipped
if we are installing from a local source, and we can know it at installation

> This whole "autosense" scenario, if doable, is attractive to me
> because then we could conceive of an automated installation media
> detection for a great number of cases (probably 90% of CD users).

It is doable. I'm installing transparently from the same cd inserted in the
cdrom drive, mounted from a remote nfs server or copied to a local harddisk.
Obviously only the cdrom source is detected automatically, the others must
be specified by the user in some way.

> Now this system would also have to deal with the CD ordering issues,
> if any; again, I look to <debian-cd> to offer guidance here.
> So assuming the autosense fails, perhaps then we would ask whether to
> use:
>   * network (see Joey's stuff)
>   * CD-ROM in a location not autosensed, which would prompt for mount
>     point(s).  It should test that this is valid.
>   * NFS (could we inherit the location of the server used for TFTP in
>     case of that install method?), which needs 'server:share-name' and
>     possibly 'subdir/in/share'.  It should test that this is valid.
>   * local disk, which needs 'device-name' and possibly
>     'subdir-in-partition'
>   * floppy (don't use apt at all, just emit a big ole' warning)
> One nicety would be overlaying network stuff over possibly staler
> CD-ROM archives, etc., but that's just fluff at this point.

Just put the proper lines in sources.list before the cdrom locations.

> > Using debconf for the frontend might be controversial, but I think it can
> > handle all the types of prompting we might want to add to this, except
> > perhaps ordering a list of sources be priority, which I doubt we want to
> > trouble people with anyway.
> Well, its only controversial in that debconf would have to be added to
> base.  What do you think of that?  Are there any non-base depends that
> debconf has?
> > One nice features comes to light if you test it with this command:
> > 
> > make clean test FRONTEND=dialog PACKAGE=aptconf PRIORITY=critical
> > 
> > That makes it skip some of the less important questions, which happen to be
> > those RMS wouldn't like and those I don't think we should trouble a newbie
> > with. :-)
> That is pretty sweet.

Another thing I suggest is to define some standard format to describe the
installation medium. What I have done is to create a conf file containing
all the paths inside the source tree needed by the installation process and
a few variables used to identify the cd. If adopted by policy for official
cd's this could also greatly simplify the installation process because it
could automatically find all components and skip many user questions. This
is the file I use to describe my distribution, which I put in a well-known
location of the cd where the installer can automatically find it:

# ./install/dist.conf
# Configuration file for DZ/Debian distribution.

# Distribution identification

# Base files

# Apt configuration

# Apt cdrom description

The file provides all the information needed by the installer to install
a base system and configure apt for the automatic installation of the full
system. As all the paths are relative they are valid for cdrom, NFS or a
local harddisk. The apt list files, which are needed only when installing
from a cd, are created just before burning the cd and stored in the cdrom
itself in ./install/apt/lists, so you don't need to run apt-cdrom before
starting apt and the whole process can go totally unattended from the initial
boot to the final login prompt.

Massimo Dal Zotto

|  Massimo Dal Zotto               email: dz@cs.unitn.it               |
|  Via Marconi, 141                phone: ++39-0461534251              |
|  38057 Pergine Valsugana (TN)      www: http://www.cs.unitn.it/~dz/  |
|  Italy                             pgp: finger dz@tango.cs.unitn.it  |

Reply to: