SCHROOT-SETUP(5)

NAME
schroot-setup — schroot chroot setup scripts

DESCRIPTION
schroot uses scripts to to set up and then clean up the chroot environment. The directories @SCHROOT_CONF_SETUP_D@ and @SCHROOT_CONF_EXEC_D@ contain scripts run when a chroot is created and destroyed, and entered and left, respectively. Several environment variables are set while the scripts are being run, which allows their behaviour to be customised, depending upon, for example, the type of chroot in use.

The scripts are run in name order, like those run by init(8), by using the same style of execution as run-parts(8).

The setup scripts are all invoked with two options:

1   The action to perform.

    When a session is first started, the chroot is set up by running the scripts in @SCHROOT_CONF_SETUP_D@ with the ‘setup-start’ option. When a command or shell is run in the configured chroot, the scripts in @SCHROOT_CONF_EXEC_D@ are run with the ‘exec-start’ option. After the command or command has completed, the scripts are run in reverse order with the ‘exec-stop’ option. Finally, when the session is ended, the scripts in @SCHROOT_CONF_SETUP_D@ are run in reverse order with the ‘setup-stop’ option.

2   The chroot status.

    This is either ‘ok’ if there are no problems, or ‘fail’ if something went wrong. For example, particular actions may be skipped on failure.

Note that the scripts should be idempotent. They must be idempotent during the ‘exec-stop’ and ‘setup-stop’ phases, because they may be run more than once.

ENVIRONMENT

  General variables

AUTH_USER
    The username of the user the command in the chroot will run as.

AUTH_VERBOSITY
    Set to ‘quiet’ if only error messages should be printed, ‘normal’ if other messages may be printed as well, and ‘verbose’ if all messages may be printed.

MOUNT_DIR
    The directory under which non-filesystem chroots are mounted (e.g. block devices and LVM snapshots).

LIBEXEC_DIR
    The directory under which helper programs are located.

PID The process ID of the schroot process.

SESSION_ID
    The session identifier.

CHROOT_TYPE
    The type of the chroot. This is useful for restricting a setup task to particular types of chroot (e.g. only block devices or LVM snapshots).

CHROOT_NAME
    The name of the chroot. This is useful for restricting a setup task to a particular chroot, or set of chroots.

CHROOT_DESCRIPTION
    The description of the chroot.

CHROOT_MOUNT_LOCATION
    The location to mount the chroot. It is used for mount point creation and mounting.

CHROOT_LOCATION
    The location of the chroot inside the mount point. This is to allow multiple chroots on a single filesystem.

CHROOT_PATH
    The absolute path to the chroot. This is typically CHROOT_MOUNT_LOCATION and CHROOT_LOCATION concatenated together. This is the path which should be used to access the chroots.

CHROOT_MOUNT_DEVICE
    The device containing the chroot root filesystem. This is only set for chroots which require mounting.

  Plain and directory chroot variables
These chroot types use only general variables.

  File variables

CHROOT_FILE
    The file containing the chroot files.

CHROOT_FILE_REPACK
    Set to ‘true’ to repack the chroot into an archive file on ending a session, otherwise ‘false’.

  Block device variables

CHROOT_DEVICE
    The device containing the chroot root filesystem. This usually, but not necessarily the device which will be mounted. For example, an LVM snapshot this will be the original logical volume.

CHROOT_MOUNT_OPTIONS
    Options to pass to mount(8).

  LVM snapshot variables

CHROOT_LVM_SNAPSHOT_NAME
    Snapshot name to pass to lvcreate(8).

CHROOT_LVM_SNAPSHOT_DEVICE
    The name of the LVM snapshot device.

CHROOT_LVM_SNAPSHOT_OPTIONS
    Options to pass to lvcreate(8).

FILES

  @SCHROOT_CONF_SETUP_D@
The system-wide chroot setup directory.

00check
    Print debugging diagnostics and perform basic sanity checking.

05file
    Unpack, clean up, and repack file-based chroots.

05lvm
    Create and remove LVM snapshots.

10mount
    Mount and unmount filesystems.

20network
    Configure networking by copying resolv.conf from the host system.

30passwd
    Configure passwd, shadow and groups in the chroot. This copies the files from the host system.

50chrootname
    Set the chroot name (/etc/debian_chroot) in the chroot. This may be used by the shell prompt to display the current chroot.

50sbuild
    If sbuild(1) is installed, set up the build directories, including ownership and permissions, inside the chroot for use by sbuild.

  @SCHROOT_CONF_EXEC_D@
The system-wide chroot execution directory

00check
    Print debugging diagnostics and perform basic sanity checking.

AUTHORS
Roger Leigh.

COPYRIGHT
Copyright © 2005-2006 Roger Leigh ↵<rleigh@debian.org>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

SEE ALSO
sbuild(1), schroot.conf(5), run-parts(8).