Blame contrib/shar/shar.1

Packit 08bd4c
.\" Copyright (c) 1990, 1993
Packit 08bd4c
.\"	The Regents of the University of California.  All rights reserved.
Packit 08bd4c
.\"
Packit 08bd4c
.\" Redistribution and use in source and binary forms, with or without
Packit 08bd4c
.\" modification, are permitted provided that the following conditions
Packit 08bd4c
.\" are met:
Packit 08bd4c
.\" 1. Redistributions of source code must retain the above copyright
Packit 08bd4c
.\"    notice, this list of conditions and the following disclaimer.
Packit 08bd4c
.\" 2. Redistributions in binary form must reproduce the above copyright
Packit 08bd4c
.\"    notice, this list of conditions and the following disclaimer in the
Packit 08bd4c
.\"    documentation and/or other materials provided with the distribution.
Packit 08bd4c
.\" 3. All advertising materials mentioning features or use of this software
Packit 08bd4c
.\"    must display the following acknowledgement:
Packit 08bd4c
.\"	This product includes software developed by the University of
Packit 08bd4c
.\"	California, Berkeley and its contributors.
Packit 08bd4c
.\" 4. Neither the name of the University nor the names of its contributors
Packit 08bd4c
.\"    may be used to endorse or promote products derived from this software
Packit 08bd4c
.\"    without specific prior written permission.
Packit 08bd4c
.\"
Packit 08bd4c
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
Packit 08bd4c
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit 08bd4c
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Packit 08bd4c
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
Packit 08bd4c
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit 08bd4c
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
Packit 08bd4c
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
Packit 08bd4c
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
Packit 08bd4c
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
Packit 08bd4c
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
Packit 08bd4c
.\" SUCH DAMAGE.
Packit 08bd4c
.\"
Packit 08bd4c
.\"     @(#)shar.1	8.1 (Berkeley) 6/6/93
Packit 08bd4c
.\" $FreeBSD$
Packit 08bd4c
.\"
Packit 08bd4c
.Dd April 17, 2008
Packit 08bd4c
.Dt SHAR 1
Packit 08bd4c
.Os
Packit 08bd4c
.Sh NAME
Packit 08bd4c
.Nm shar
Packit 08bd4c
.Nd create a shell archive of files
Packit 08bd4c
.Sh SYNOPSIS
Packit 08bd4c
.Nm
Packit 08bd4c
.Op Fl br
Packit 08bd4c
.Op Fl o Ar archive-file
Packit 08bd4c
.Ar
Packit 08bd4c
.Sh DESCRIPTION
Packit 08bd4c
The
Packit 08bd4c
.Nm
Packit 08bd4c
command writes a
Packit 08bd4c
.Xr sh 1
Packit 08bd4c
shell script which will recreate the file hierarchy specified by the command
Packit 08bd4c
line operands.
Packit 08bd4c
.Pp
Packit 08bd4c
The
Packit 08bd4c
.Nm
Packit 08bd4c
command is normally used for distributing files by
Packit 08bd4c
.Xr ftp 1
Packit 08bd4c
or
Packit 08bd4c
.Xr mail 1 .
Packit 08bd4c
.Pp
Packit 08bd4c
The following options are available:
Packit 08bd4c
.Bl -tag -width indent
Packit 08bd4c
.It Fl b
Packit 08bd4c
Use an alternative binary format.  Content of files will be uuencoded.
Packit 08bd4c
This option should be used to archive binary files correctly.
Packit 08bd4c
In this mode also file permissions will be stored to the archive.
Packit 08bd4c
uudecode(1) is needed to extract archives created with this option.
Packit 08bd4c
.It Fl o Ar archive-file
Packit 08bd4c
Redirect output to
Packit 08bd4c
.Ar archive-file .
Packit 08bd4c
.It Fl r
Packit 08bd4c
If
Packit 08bd4c
.Ar file
Packit 08bd4c
given on command line is a directory the entire subtree will be archived.
Packit 08bd4c
Symbolic links given on command line are followed.  Other symbolic links will
Packit 08bd4c
be archived as such.
Packit 08bd4c
.El
Packit 08bd4c
.Sh EXAMPLES
Packit 08bd4c
To create a shell archive of the program
Packit 08bd4c
.Xr ls 1
Packit 08bd4c
and mail it to Rick:
Packit 08bd4c
.Bd -literal -offset indent
Packit 08bd4c
cd ls
Packit 08bd4c
shar -r . \&| mail -s "ls source" rick
Packit 08bd4c
.Ed
Packit 08bd4c
.Pp
Packit 08bd4c
To recreate the program directory:
Packit 08bd4c
.Bd -literal -offset indent
Packit 08bd4c
mkdir ls
Packit 08bd4c
cd ls
Packit 08bd4c
\&...
Packit 08bd4c
<delete header lines and examine mailed archive>
Packit 08bd4c
\&...
Packit 08bd4c
sh archive
Packit 08bd4c
.Ed
Packit 08bd4c
.Sh SEE ALSO
Packit 08bd4c
.Xr compress 1 ,
Packit 08bd4c
.Xr mail 1 ,
Packit 08bd4c
.Xr tar 1 ,
Packit 08bd4c
.Xr uuencode 1 ,
Packit 08bd4c
.Xr uuencode 5
Packit 08bd4c
.Sh HISTORY
Packit 08bd4c
The
Packit 08bd4c
.Nm
Packit 08bd4c
command appeared in
Packit 08bd4c
.Bx 4.4 .
Packit 08bd4c
This is a re-implementation based on the libarchive(3) library.
Packit 08bd4c
.Sh BUGS
Packit 08bd4c
The
Packit 08bd4c
.Nm
Packit 08bd4c
command makes no provisions for hard links.
Packit 08bd4c
.Pp
Packit 08bd4c
Files containing magic characters or files without a newline ('\\n') as the
Packit 08bd4c
last character are not handled correctly with the default format.  Use the -b
Packit 08bd4c
option for binary files.
Packit 08bd4c
.Pp
Packit 08bd4c
It is easy to insert trojan horses into
Packit 08bd4c
.Nm
Packit 08bd4c
files.
Packit 08bd4c
It is strongly recommended that all shell archive files be examined
Packit 08bd4c
before running them through
Packit 08bd4c
.Xr sh 1 .
Packit 08bd4c
Archives produced using this implementation of
Packit 08bd4c
.Nm
Packit 08bd4c
may be easily examined with the command:
Packit 08bd4c
.Bd -literal -offset indent
Packit 08bd4c
egrep -v '^[X#]' shar.file
Packit 08bd4c
.Ed