# How does mtree know where to start, when creating a hierarchy?



## Chris_H (Aug 6, 2013)

Greetings,

I'm creating a port that I want to chroot(8) into a specific hierarchy. I'm using /etc/mtree/BIND.chroot.dist as a model. I've read the chroot(8) man(1) page. But as I examine /etc/mtree/BIND.chroot.dist:


```
/set type=dir uname=root gname=wheel mode=0755
.
    dev             mode=0555
    ..
    etc
        namedb
            dynamic uname=bind
            ..
            master
            ..
            slave   uname=bind
            ..
            working uname=bind
            ..
        ..
    ..
/set type=dir uname=bind gname=wheel mode=0755
    var             uname=root
        dump
        ..
        log
        ..
        run
            named
            ..
        ..
        stats
        ..
    ..
..
```

I can't see where mtree(8) knows to start the creation process in /var/named. Can someone clear this up for me?

Thank you for all your time, and consideration.

--chris


----------



## SirDice (Aug 6, 2013)

I think it uses the current directory unless you supply it with the -p parameter.


```
-p path
	   Use the file hierarchy rooted in path, instead of the current
	   directory.
```


----------



## Chris_H (Aug 6, 2013)

Greetings @SirDice, and thank you _very_ much for the reply.

Right you are.


```
# /etc/named
	# Create (or update) the chroot directory structure
	#
	if [ -r /etc/mtree/BIND.chroot.dist ]; then
		mtree -deU -f /etc/mtree/BIND.chroot.dist \
		    -p ${named_chrootdir}
____________________^^
```
I _should_ have seen this myself. I don't know how I missed it. Apologies for the "noise", and thanks again.

--chris


----------

