diff --git a/.gitignore b/.gitignore index 8c6858f..2393f7b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ *.o .depend -*.8.gz +*.[78].gz *.full *.debug ggatessh/ggatessh diff --git a/ggatessh/ggatessh.8 b/ggatessh/ggatessh.8 index 9a9050e..a8a3260 100644 --- a/ggatessh/ggatessh.8 +++ b/ggatessh/ggatessh.8 @@ -188,6 +188,7 @@ client# mount_cd9660 /dev/ggate0 /cdrom .Ed .Sh SEE ALSO .Xr geom 4 , +.Xr ggatessh 7 , .Xr ggated 8 , .Xr ggatel 8 , .Xr mount_cd9660 8 diff --git a/ggatessh/rc.d/Makefile b/ggatessh/rc.d/Makefile index cfa9f7d..c2068c4 100644 --- a/ggatessh/rc.d/Makefile +++ b/ggatessh/rc.d/Makefile @@ -4,6 +4,8 @@ SYSCONFDIR?= /etc RCDIR= ${SYSCONFDIR}/rc.d SCRIPTSDIR= ${RCDIR} +MAN= ggatessh.7 + SCRIPTS= ggatessh .include diff --git a/ggatessh/rc.d/ggatessh b/ggatessh/rc.d/ggatessh index fbfdb5e..fa1063d 100644 --- a/ggatessh/rc.d/ggatessh +++ b/ggatessh/rc.d/ggatessh @@ -231,7 +231,9 @@ ggatessh_iter() load_rc_config $name -tmp="$2" +cmd="$1" +shift +tmp="$*" ggatedevnums="${tmp:=$ggatessh_devs}" -run_rc_command "$1" +run_rc_command "$cmd" diff --git a/ggatessh/rc.d/ggatessh.7 b/ggatessh/rc.d/ggatessh.7 new file mode 100644 index 0000000..1a26c07 --- /dev/null +++ b/ggatessh/rc.d/ggatessh.7 @@ -0,0 +1,153 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright 2020 John-Mark Gurney +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.\" Note: The date here should be updated whenever a non-trivial +.\" change is made to the manual page. +.Dd October 25, 2020 +.Dt GGATESSH 7 +.Os +.Sh NAME +.Nm ggatessh +.Nd start up script for ggatessh +.Sh SYNOPSIS +.Bd -literal -compact +service ggatessh [one]start [ ... ] +service ggatessh [one]rescue [ ... ] +service ggatessh [one]stop [ ... ] +service ggatessh [one]destroy [ ... ] +service ggatessh [one]status [ ... ] +.Ed +.Pp +Configuration via +.Xr rc.conf 5 : +.Dl ggatessh_enable="YES" +.Dl ggatessh_devs="" +.Dl ggatessh__path="usera@hosta:patha/to/file" +.Dl ggatessh__pidfile="/path/to/pidfile" +.Dl ggatessh__sector="" +.Dl ggatessh__port="" +.Dl ggatessh__sshkey="/path/to/ssh/key" +.Sh DESCRIPTION +The +.Nm +rc.d script is allows for boot time and run time configuration of +.Xr ggatessh 8 . +.Pp +If no +.Ar devnum +arguments are specified, then the script iterates through all the +numbers that are specified in the +.Dv ggatessh_devs +variable. +If one or more +.Ar devnum +arguments are specified, the provided commands is run for each of them. +.Pp +The following actions are: +.Bl -tag -width destroy +.It start +This creates the ggate device and runs the daemon with the specified +parameters. +.It rescue +This requires that the ggate device has already been created w/ the +.Cm start +command or via another mechanism. +This command will run +.Xr ggatessh 8 +with the rescue command, allowing IOs to resume after a previous +daemon has died. +.It stop +This command will kill the daemon that was started via the +.Cm start +command. +This will not destroy the ggate device, which means that any IO to +the device will hang and not be completed until the daemon is restarted +or the device is forcefully destroyed using the +.Xr ggatessh 8 +command. +.It destroy +This will destroy the ggate device. +If the device is busy, or currently open, it will fail. +.It status +Print out the status of the +.Xr ggatessh 8 +daemon, and if it is running, its pid. +.El +.Pp +For each +.Ar devnum +specified, either via +.Dv ggatessh_devs +or as an argument, the following +.Xr rc.conf 5 +options are used: +.Bl -tag -width "ggatessh__pidfile" +.It ggatessh__path +This specifies the user, host and file to use. +Its format is: +.Dv [user@]host:file . +If the user part is not specified, it defaults to +.Dv root. +.It ggatessh__pidfile +Specify the file to use to store the daemon's pid. +If this is not specified, it defaults to +.Pa /var/run/ggatessh.ggate.pid . +.It ggatessh__sector +Specifies the sector size of the device. +If not specified, the default, +.Dv 4096 +is used. +.It ggatessh__port +Specifies the port to connect to on the host. +The default is 22 if not specified. +.It ggatessh__sshkey +Specifies the ssh key to use for authentication. +If unspecified, the default +.Pa $HOME/.ssh/id_rsa +is used. +As +.Dv $HOME +may be different when the startup script is run in different contexts, +it is highly recommended to specify this. +.El +.Sh FILES +.Bl -tag -width ".Pa /dev/null" -compact +.It Pa /etc/rc.d/ggatessh +The script described in this man page. +.El +.Sh SEE ALSO +.Xr rc.conf 5 , +.Xr ggatessh 8 +.Sh HISTORY +The +.Nm +script first appeared in +.Fx 13.0 . +.Sh AUTHORS +This manual page was written by +.An John-Mark Gurney Aq Mt jmg@FreeBSD.org .