NAMEschroot-setup - schroot chroot setup scripts
DESCRIPTIONschroot uses scripts to set up and then clean up the chroot environment. The directory BI]SCHROOT_CONF_SETUP_D] contains scripts run when a chroot is created and destroyed. 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 setup scripts are all invoked with two options:
- 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 [oq]setup-start[cq] option. When the session is ended, the scripts in SCHROOT_CONF_SETUP_D] are run in reverse order with the [oq]setup-stop[cq] option.
- The chroot status.
- This is either [oq]ok[cq] if there are no problems, or [oq]fail[cq] 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 [oq]setup-stop[cq] phase, because they may be run more than once, for example on failure.
- The username of the user the command in the chroot will run as.
- The chroot name. Note that this is the name of the orignal chroot before session creation; you probably want SESSION_ID.
- The directory under which helper programs are located.
- The directory under which non-filesystem chroots are mounted (e.g. block devices and LVM snapshots).
- The process ID of the schroot process.
- The operating system platform schroot is running upon. This may be used to introduce platform-specific behaviour into the setup scripts where required. Note that the HOST variables are probably what are required. In the context of schroot, the platform is the supported configuration and behaviour for a given architecture, and may be identical between different architectures.
- The session identifier.
- Set to [oq]quiet[cq] if only error messages should be printed, [oq]normal[cq] if other messages may be printed as well, and [oq]verbose[cq] if all messages may be printed. Previously called AUTH_VERBOSITY.
- Set to [oq]true[cq] if a session will be created, otherwise [oq]false[cq].
- Set to [oq]true[cq] if a session will be cloned, otherwise [oq]false[cq].
- Set to [oq]true[cq] if a session will be purged, otherwise [oq]false[cq].
- Set to [oq]true[cq] if a session will be created from a source chroot, otherwise [oq]false[cq].
- 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).
- The name of the chroot. This is useful for restricting a setup task to a particular chroot, or set of chroots.
- The name of the alias used to select the chroot. This is useful for specialising a setup task based upon one of its alternative alias names, or the default chroot name. For example, it could be used to specify additional sources in /etc/apt/sources.list, such as a stable-security alias for a stable chroot, or an experimental alias for an unstable chroot.
- The description of the chroot.
- The location to mount the chroot. It is used for mount point creation and mounting.
- The location of the chroot inside the mount point. This is to allow multiple chroots on a single filesystem. Set for all mountable chroot types.
- 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.
Plain and directory chroot variablesThese chroot types use only general variables.
- The file containing the chroot files.
- Set to [oq]true[cq] to repack the chroot into an archive file on ending a session, otherwise [oq]false[cq].
Mountable chroot variables
These variables are only set for directly mountable chroot types.
- The device to mount containing the chroot. mounting.
- Options to pass to mount(8).
- The location of the chroot inside the mount point. This allows the existence of multiple chroots on a single filesystem.
Filesystem union variables
- Union filesystem type.
- Union filesystem mount options.
- Union filesystem overlay directory (writable).
- Union filesystem underlay directory (read-only).
Block device variables
- The device containing the chroot root filesystem. This is usually, but not necessarily, the device which will be mounted. For example, an LVM snapshot this will be the original logical volume.
LVM snapshot variables
- Snapshot name to pass to lvcreate(8).
- The name of the LVM snapshot device.
- Options to pass to lvcreate(8).
Custom keys set in schroot.conf will be uppercased and set in the environment as described in schroot.conf(5).
Setup script configurationThe directory BI]SCHROOT_SYSCONF_DIR]/default contains the default settings used by setup scripts.
- Main configuration file read by setup scripts. The format of this file is described in schroot-script-config(5). This is the default value for the CI]script-config key. Note that this was formerly named SCHROOT_SYSCONF_DIR]/script-defaults. The following files are referenced by default:
- A list of files to copy into the chroot from the host system. Note that this was formerly named SCHROOT_SYSCONF_DIR]/copyfiles-defaults.
- A file in the format decribed in fstab(5), used to mount filesystems inside the chroot. The mount location is relative to the root of the chroot. Note that this was formerly named SCHROOT_SYSCONF_DIR]/mount-defaults.
- System databases (as described in /etc/nsswitch.conf on GNU/Linux systems) to copy into the chroot from the host. Note that this was formerly named SCHROOT_SYSCONF_DIR]/nssdatabases-defaults.
Setup scriptsThe directory BI]SCHROOT_CONF_SETUP_D] contains the chroot setup scripts.
- Print debugging diagnostics and perform basic sanity checking.
- Unpack, clean up, and repack file-based chroots.
- Create and remove union filesystems.
- Create and remove LVM snapshots.
- Mount and unmount filesystems.
- Sets up the QEMU user emulator using binfmt-support. This permits a chroot for a different CPU architecture to be used transparently, providing an alternative to cross-compiling or whole-machine emulation.
- Kill processes still running inside the chroot when ending a session, which would prevent unmounting of filesystems and cleanup of any other resources.
- Copy files from the host system into the chroot. Configure networking by copying hosts and resolv.conf, for example.
- Configure system databases by copying passwd, shadow, group etc. into the chroot.
- Set the chroot name (/etc/debian_chroot) in the chroot. This may be used by the shell prompt to display the current chroot.
COPYRIGHTCopyright © 2005-2012 Roger Leigh CR]<firstname.lastname@example.org>
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 3 of the License, or (at your option) any later version.