.TH REROOTWIN 1
.SH NAME
rerootwin, savedevs, getdevs \- change root and keep devices
.SH SYNOPSIS
.B rerootwin
[
.I -f -u -n -t nsfile
]
.I newroot
[
authagent
]
.PP
.B savedevs
[
.I srvname
]
.PP
.B getdevs
[
.I srvname
]
.PP
.B /lib/namespace.saveterm
.SH DESCRIPTION
.I rerootwin
creates a new namespace using
.IR newns (8)
but retains connection to the current interactive window
by using
.IR srvfs (4)
to save the devices from 
.I /mnt/term 
and 
.I /mnt/wsys 
and
remount them inside the new namespace.
.PP
.I newroot
is expected to exist as 
.I /srv/newroot
or be a dialable IP or system name serving 9p on port 564 suitable for a root filesystem. The script attempts to check the current namespace and issue any preparatory binds necessary to make the devices available to 
.I /srv. 
.PP
The file
.I /lib/namespace.saveterm
or
.I /boot/namespace.saveterm
must be available, unless the 
.I -t nsfile
option is given, in which case that file must be a correctly constructed namespace file. By default the 
.I /net.alt 
directory is used as a
pivot point for the remount of the user's devices. The
.B -n
and 
.B -u
flags change this pivot point to 
.I /n 
or 
.I /u 
respectively. (
.I /u 
will only exist on systems running the Bell Labs rootless kernel.) The
.B -f
option changes the namespace file used to
.I /lib/namespace.save9front
or the analog in 
.I boot.
This alternative file follows the 9front namespace conventions and should be used when stepping into a 9front namespace.
.I authagent
is set to "factotum" by default. Another value can be chosen if the user is running a personal factotum in 
.I /srv 
under a different name
.PP
.I getdevs
and
.I savedevs
make use of the same device-saving
.IR srvfs (4)
but do not enter an entirely new namespace. 
.IR savedevs 
saves the current
console and window system devices under a given
.I srvname
or under a pid identity if no name is provided. 
.IR getdevs
.I srvname
issues mount and 
.IR bind (1)
commands to reattach to the saved devices.
.SH EXAMPLES
To enter a fossil-root namespace from within a rootless service namespace:
.IP
.EX
cpu -h tcp!fileserver!17060 -u bootes
rerootwin boot
grio
.EE
.PP
To let a shell within 
.IR hubfs (4)
correctly track window size and run gui programs:
.IP
.EX
savedevs prehub
hub hubfs oldshell
getdevs prehub
.EE
.SH SOURCE
.B sources/mycroftiv/rootlessnext/scripts
.SH SEE ALSO
.IR bind (1),
.IR srvfs (4)
.SH BUGS
It is not always possible to analyze the originating namespace in detail to determine how the current devices are attached. 
