Commit 0487e767 authored by Heinz N. Gies's avatar Heinz N. Gies

update paths to resolve #40

BSD uses different conventions then what vmadm used, we want to
be good BSD citizens so now we follow them.
parent e7ead262
[root]
name = "vmadm"
version = "0.1.0"
version = "0.2.0"
dependencies = [
"aud 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bzip2 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
......
[package]
name = "vmadm"
version = "0.1.0"
version = "0.2.0"
authors = ["Heinz N. Gies <heinz@project-fifo.net>"]
[dependencies]
......
......@@ -8,7 +8,7 @@ The goal of this is to provide a fast, efficient utility to manage BSD jails. Th
vmadm describes jails as JSON files. These files are compatible with vmadm's files but represent only a subset of the total options.
Data lives in `/etc/jails`, being an index file and description file per zone. We do this to mimic the way zomeadm works on Solaris but replaces xml+plaintext with JSON.
Data lives in `/usr/local/etc/vmadm`, being an index file and description file per zone. We do this to mimic the way zomeadm works on Solaris but replaces xml+plaintext with JSON.
Images are ZFS datasets that get cloned for a new jail, both living under a given prefix (that can be defined).
......@@ -62,15 +62,27 @@ Some of the steps above require a reboot, there is however no reason not just do
2. Clone this repository
3. Build the binary `cargo build --release`
4. Copy the executable `cp target/release/vmadm /usr/local/sbin`
5. Create the jails folder: `mkdir /etc/jails`
5. Create the jails folder: `mkdir /usr/local/etc/vmadm`
6. Create the images folder `mkdir -p /var/imgadm/images`
7. Create the main config file: `echo 'pool = "zroot/jails"\n[networks]\nadmin = "bridge0"' > /etc/vmadm.toml`
7. Create the main config file: `echo 'pool = "zroot/jails"\n[networks]\nadmin = "bridge0"' > /usr/local/etc/vmadm.toml`
8. Download a/the datase `curl -O https://s3.amazonaws.com/datasets.project-fifo.net/freebsd/e022d0f8-5630-11e7-b660-9b2d243d4404.xz`
9. Extract the dataset `xzcat e022d0f8-5630-11e7-b660-9b2d243d4404.xz | zfs receive zroot/jails/e022d0f8-5630-11e7-b660-9b2d243d4404`
10. Create a jail: cat example.json | vmadm create
The devfs ruleset to used can be adjusted in the `/etc/vmadm.toml` by adding `devfs_ruleset = <rule number>`.
The devfs ruleset to used can be adjusted in the `/usr/local/etc/vmadm.toml` by adding `devfs_ruleset = <rule number>`.
## update
If you ran 0.1.0 of the vmadm some path's have changed:
`/etc/vmadm.toml` is now `/usr/local/etc/vmadm.toml`
And
`/etc/jails` is now `/usr/local/etc/vmadm`
Moving those directories and files is all that's required.
## usage
```
......
......@@ -7,7 +7,7 @@ use std::collections::BTreeMap as Map;
use toml;
extern crate slog;
static CONFIG: &'static str = "/etc/vmadm.toml";
static CONFIG: &'static str = "/usr/local/etc/vmadm.toml";
/// Global settings
#[derive(Debug, Deserialize, Serialize)]
......@@ -36,7 +36,7 @@ pub struct Config {
}
fn default_conf_dir() -> String {
"/etc/jails".to_string()
"/usr/local/etc/vmadm".to_string()
}
fn default_image_dir() -> String {
......
......@@ -66,9 +66,9 @@ impl<'a> JDB<'a> {
/// # Example
///
/// ```
/// // Open jail config folder in /etc/jails
/// // Open jail config folder in /usr/local/etc/vmadm
/// use jdb::JDB;
/// let db = JDB::open("/etc/jails/index");
/// let db = JDB::open("/usr/local/etc/vmadm/index");
/// ```
pub fn open(config: &'a Config) -> Result<Self, Box<Error>> {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment