DFDISK(1)

NAME
dfdisk - fetch distfiles from multiple locations

SYNOPSIS
dfdisk [-c conf_file] target [target_args]

DESCRIPTION
dfdisk is an utility that adds extra functionality to pkgsrc, allowing it to fetch distfiles from multiple locations. It currently supports the following methods:

CD-ROM
    The program manages a CD database where every disk is matched to a series of distfiles. Whenever a distfile is requested, the program will check if it is known by the database and ask the user to place the needed disk in the drive.

Network
    If a file is not found in the described database, the program fallbacks to the network, fetching the file from there (the usual method in pkgsrc).

The following options are available:

-c  Path to the configuration file to use. Overrides the default /usr/pkg/etc/dfdisk.conf.

  Configuration file details: dfdisk.conf
The configuration file is a simple shell script that sets some variable values. If the -c flag is not given, /usr/pkg/etc/dfdisk.conf is used as the default configuration file.

The following variables ara available:

CD_DIR
    CD mount point. Defaults to /cdrom.

CD_MOUNT
    Command to mount the CD media. Defaults to ‘mount ${CD_DIR}’.

CD_UMOUNT
    Command to unmount the CD media. Defaults to ‘umount ${CD_DIR}’.

DBDIR
    Database directory where all disk information is stored. Defaults to /var/db/dfdisk.

DISTDIR
    Path to pkgsrc's distribution directory, where distfiles are stored after downloading them. Defaults to /usr/pkgsrc/distfiles. This must match pkgsrc's DISTDIR variable, as the program uses it to guess the DIST_SUBDIR for some packages.

FTP_CMD
    Command to fetch files from the network, if they were not found in the disk database. Defaults to ‘’.

  Disk information file details: dfdisk.info
Every disk can contain a control file which is read by dfdisk to automatically get information from it. That file is called dfdisk.info and can be placed anywhere in the disk.

This file can define the following variables:

dfdisk_name
    Full name of disk. Free form text field.

dfdisk_subdir
    Relative path to where distfiles are stored in the CD.

dfdisk_type
    Disk type. The only value allowed for now is ‘cd’. This variable is not used for now, but must be there for future compatibility.

WARNING: this file is a shell script and is directly sourced by dfdisk to read its information. Therefore it may contain malicious commands that will be executed by this program whenever it is read. If you have not authored the disk yourself, check the contents of this file (if present) before proceeding.

  Target description
dfdisk bases its behavior on the target given to it. The following list details all work modes:

add Add the CD disk currently placed in the drive to the database. If the disk contains a dfdisk.info file, it is automatically read; otherwise, all disk information is requested to the user interactively.

clean
    Remove all local distfiles that are known to be stored in some disk. This will leave all new files under DISTDIR, so you can easily burn them to a new disk after creating a disk information file with the ‘mkinfo’ target.

fetch url
    Fetch a distfile, given as an URL. The program will search the database for the given file. If it is found, the user will be required to put the requested media on the drive. If it is not found, FTP_CMD will be used to fetch it from the network; this is why you need to pass an URL to this target.

mkinfo [info_file]
    Interactively create a dfdisk.info file. It will be saved as info_file if given; if not, its name will be asked.

remove
    Interactively remove a disk from the database. You will not want to use this target.

EXAMPLES
To enable dfdisk by default within pkgsrc, add the following lines to your /etc/mk.conf file:

    .if exists(/usr/pkg/bin/dfdisk)
    FETCH_CMD= /usr/pkg/bin/dfdisk fetch
    .endif

If you would like any user to be able to fetch files, you can use sudo(8) to allow them mount the CD drive. To do it:

    CD_MOUNT="sudo mount /cdrom"
    CD_UMOUNT="sudo umount /cdrom"

If you have more than one disk registered in your database and you plan to leave your computer building stuff for a large period of time, it is recommended that you fetch all required distfiles before starting the build. This way, it will not be interrupted waiting for any user action. To do this, you can use pkgsrc's ‘fetch-list’ target, which will call dfdisk for each required file:

    $ cd category/package && make fetch-list | sh

SEE ALSO
ftp(1), packages(7), sudo(8)

AUTHORS
dfdisk was written by Julio Merino <jmmv@netbsd.org>.