sortix-mirror/utils/chroot.8

63 lines
1018 B
Groff

.Dd September 29, 2016
.Dt CHROOT 8
.Os
.Sh NAME
.Nm chroot
.Nd run command with changed root directory
.Sh SYNOPSIS
.Nm
.Op Fl dI
.Ar newroot
.Oo
.Ar command
.Oo
.Ar arguments ...
.Oc
.Oc
.Sh DESCRIPTION
.Nm
changes the root directory to
.Ar newroot
and runs
.Ar command
with the given
.Ar arguments .
.Ar command
defaults to
.Xr sh 1 .
The working directory for
.Ar command
is changed to
.Pa / .
.Pp
The options are as follows:
.Bl -tag -width "12345678"
.It Fl d , Fl \-devices
Mount
.Pa /dev
from the host system into the
.Pa /dev
inside
.Ar newroot .
The mountpoint is removed when
.Ar command
completes.
This option is useful for running installations.
.It Fl I , Fl \-init
Become an init process using
.Xr setinit 2
and transfer the controlling terminal temporarily to the new session using the
.Sy TIOCSCTTY
.Xr ioctl 2 .
.El
.Sh ENVIRONMENT
The environment is preserved.
.Ev PATH
is used to search for
.Ar command .
.Sh EXIT STATUS
.Nm
will exit 0 on success and non-zero otherwise.
.Sh SEE ALSO
.Xr chroot 2