A simple script for making schroot environments from a JSON configuration file
Project description
# mkschroot #
A simple script for making schroot environments from a JSON configuration file
This first version isn't so smart. It assumes that you're using a 64 bit host machine, and doesn't check that you're on Debian as it should (it only uses `debootstrap` to build the chroot environment). It's probably also highly Ubuntu specific right now. To add to the fun it's not been very thoroughly tested yet either.
To use it you must install a couple of things:
apt-get install debootstrap schroot
pip install mkschroot
## Using mkschroot ##
You just need to pass mkschroot a configuration file:
mkschroot ~/chroots/example.json
### Configuring mkschroot ###
The configuration file needs to be JSON. A configuration file might look like the below:
{
"root": "/mnt/files2/chroot",
"source": "http://th.archive.ubuntu.com/ubuntu/",
"base-packages": ["lsb-release", "openssh-client"],
"defaults": {
"conf": {
"root-users": ["kirit"],
"users": ["kirit"]
}
},
"schroot": {
"build-lucid64": {
"release": "lucid",
"packages": [
"g++", "libbz2-dev", "libssl-dev", "python-dev", "uuid-dev",
"libboost-dev", "subversion", "git-core"
]
},
"root-ca-kirit": {
"release": "precise",
"packages": ["openssl"],
"conf": {
"personality": "linux32"
}
}
}
}
A chroot configuration is described by a structure like the following:
{
"release": "lucid",
"packages": ["g++"],
"conf": {
"root-users": ["kirit'"],
"users": ["kirit"]
}
}
* `release`: The operating system version you wish to make use of.
* `conf`: The fields used for the schroot configuration file (in `/etc/schroot/chroot.d/`). The following fields are required: `root-users`, `users`, and the following are optional: `description`, `type`, `personality`, `directory`. Do read the part about common fields though.
The other options are:
* `base-packages`: Packages that are to be installed in all chroots.
* `root`: The directory where you want the chroots to be created in by default (override this using the `directory` setting within a chroot).
* `source`: Where the packages can be installed from.
#### Common configuration items ####
Generally many of the chroots that you want will share a good deal of configuration between machines. To help with this a default `schroot` configuration can be given which will then have values overridden by the specific `schroot`s that you request be made.
This means that the values in the `defaults` key will be used, then any values in the specific `schroots` key will be added in, and finally a few defaults will be generated by `mkschroot`.
* `description`: The release name together with personality name.
* `directory`: The `root` option will have the schroot name added to it.
* `type`: Always `directory`.
* `personality`: The same as the host personality (currently hard coded to 64 bits)
A simple script for making schroot environments from a JSON configuration file
This first version isn't so smart. It assumes that you're using a 64 bit host machine, and doesn't check that you're on Debian as it should (it only uses `debootstrap` to build the chroot environment). It's probably also highly Ubuntu specific right now. To add to the fun it's not been very thoroughly tested yet either.
To use it you must install a couple of things:
apt-get install debootstrap schroot
pip install mkschroot
## Using mkschroot ##
You just need to pass mkschroot a configuration file:
mkschroot ~/chroots/example.json
### Configuring mkschroot ###
The configuration file needs to be JSON. A configuration file might look like the below:
{
"root": "/mnt/files2/chroot",
"source": "http://th.archive.ubuntu.com/ubuntu/",
"base-packages": ["lsb-release", "openssh-client"],
"defaults": {
"conf": {
"root-users": ["kirit"],
"users": ["kirit"]
}
},
"schroot": {
"build-lucid64": {
"release": "lucid",
"packages": [
"g++", "libbz2-dev", "libssl-dev", "python-dev", "uuid-dev",
"libboost-dev", "subversion", "git-core"
]
},
"root-ca-kirit": {
"release": "precise",
"packages": ["openssl"],
"conf": {
"personality": "linux32"
}
}
}
}
A chroot configuration is described by a structure like the following:
{
"release": "lucid",
"packages": ["g++"],
"conf": {
"root-users": ["kirit'"],
"users": ["kirit"]
}
}
* `release`: The operating system version you wish to make use of.
* `conf`: The fields used for the schroot configuration file (in `/etc/schroot/chroot.d/`). The following fields are required: `root-users`, `users`, and the following are optional: `description`, `type`, `personality`, `directory`. Do read the part about common fields though.
The other options are:
* `base-packages`: Packages that are to be installed in all chroots.
* `root`: The directory where you want the chroots to be created in by default (override this using the `directory` setting within a chroot).
* `source`: Where the packages can be installed from.
#### Common configuration items ####
Generally many of the chroots that you want will share a good deal of configuration between machines. To help with this a default `schroot` configuration can be given which will then have values overridden by the specific `schroot`s that you request be made.
This means that the values in the `defaults` key will be used, then any values in the specific `schroots` key will be added in, and finally a few defaults will be generated by `mkschroot`.
* `description`: The release name together with personality name.
* `directory`: The `root` option will have the schroot name added to it.
* `type`: Always `directory`.
* `personality`: The same as the host personality (currently hard coded to 64 bits)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mkschroot-0.1.1.tar.gz
(3.8 kB
view hashes)