rtar/rdd/rmt for 4.2 BSD

donn at sdchema.UUCP donn at sdchema.UUCP
Sat Mar 17 16:30:35 AEST 1984


#! /bin/sh

: This is a Bourne Shell script, not a C-shell script.

: Make a directory 'rtar', copy this file to 'rtar/SCRIPT' and change
:	directories to 'rtar'.  Strip any mail or news headers from
:	SCRIPT and run 'sh SCRIPT'.

cat > README << "EOF"
The files in this directory will allow you to make the following
programs:

	rtar	-- remote tape archiver
	rdd	-- generalized remote tape I/O
	rmt	-- remote tape manipulator

The distribution comes as a set of 'ed' scripts, a Makefile and a
document.  To create the source files to the programs, run 'make
sources' -- this copies the original source files into this directory
and runs 'ed' on them with the appropriate script.  (You may need to
customize the makefile.)  After making the sources, you can run 'make
install' to install them.  You must run 'make install' as root.  To
install the documentation, run 'make document'.

Simple, huh?  (Gasp, wheeze, pant, etc.)

You may direct bug reports to:

	Donn Seeley
	Chemistry Dept., B-014
	UC San Diego
	La Jolla, CA 92093
	(619) 452-4016
	ucbvax!sdcsvax!sdchema!donn

BTW, the sources are no doubt (c) 1984 Regents of the University of
California, although I haven't asked about them.
EOF

cat > rtar.1 << "EOF"
.TH RTAR 1 "16 March 1984"
.UC 4
.SH NAME
rtar, rdd, rmt \- remote tape manipulation programs
.SH SYNOPSIS
.B rtar
\&...\f3f\f1...
.I host:device
[ files ] ...
.PP
.B rdd
\&... [ \f3if=\f2host:device\f1 ] ... [ \f3of=\f2host:device\f1 ] ...
.PP
.B rmt
[
.B \-f
.I host:device
] ...
.SH DESCRIPTION
.IR Rtar ,
.I rdd
and
.I rmt
are versions of
.IR tar (1),
.IR dd (1)
and
.IR mt (1)
which work on remote tapes in much the same way as
.IR rdump (8)
and
.IR rrestore (8).
These programs cause another program
.I /etc/rmt
(\c
.IR rmt (8))
to be executed on the remote host,
which in turn manipulates the specified device
according to commands issued by the local program,
passing data back and forth as necessary.
All keys and options for the remote flavor programs
are the same as for the local flavor programs;
the only difference is that if a tape device
of the form
.I host:device
is specified,
the tape operations are performed on the named device
on the named host.
.SH DIAGNOSTICS
Diagnostics are the same as for the local flavor programs,
with the exception of a few possible socket errors.
Remote errors are reported to the local program.
.SH "SEE ALSO"
dd(1), mt(1), tar(1), mtio(4), rdump(8), rmt(8), rrestore(8)
.SH BUGS
.I Rmt
is clearly a bad name for 'remote
.IR mt ',
since it clashes with
.IR /etc/rmt .
It is suggested that one simply install
.I rmt
as
.IR mt ,
since the overhead of using the remote routines is low for this program.
.PP
.IR Rtar ,
.I rdd
and
.I rmt
must all be setuid to root,
since they use a privileged socket.
The programs know enough to setuid back to the real user id
after opening the socket, but there are undoubtedly security problems here.
.PP
Only one remote tape may be specified.
Thus
.I rdd
may not have a remote tape for both input and output.
.PP
The program
.I /etc/rmt
has bugs in it.
Most of these bugs appear to be handled by
.I rtar
and friends, but beware.
EOF

cat > Makefile << "EOF"
#
# Makefile for rtar, rdd and rmt (4.2 BSD)
#
# If you are making these programs for the first time, using the editor
#	scripts, run 'make sources'.  The variables TAR, DD, MT and DUMPRMT
#	below should be set to the names of file containing VANILLA versions
#	of their respective sources.  If you have modified your sources you
#	will need to change the default assignments.
#

TAR	= /usr/src/bin/tar.c
DD	= /usr/src/bin/dd.c
MT	= /usr/src/bin/mt.c
DUMPRMT	= /usr/src/etc/dump/dumprmt.c

CFLAGS	= -O
BINDIR	= /usr/local/bin

#
# 'make install' puts the programs in $(BINDIR).
# Be sure to run 'make install' as user root.
#
install: all
	cp rtar rdd rmt $(BINDIR)
	cd $(BINDIR); /etc/chown root rtar rdd rmt
	cd $(BINDIR); chmod u+s rtar rdd rmt

all:	rtar rdd rmt

rtar:	rtar.o rsubs.o
	$(CC) $(CFLAGS) -o $@ rtar.o rsubs.o

rdd:	rdd.o rsubs.o
	$(CC) $(CFLAGS) -o $@ rdd.o rsubs.o

rmt:	rmt.o rsubs.o
	$(CC) $(CFLAGS) -o $@ rmt.o rsubs.o

#
# Run 'make sources' to make sources from the editor scripts.
# Use 'make sources' with discretion -- it clobbers the sources.
# 
sources:
	cp $(TAR) rtar.c
	chmod u+w rtar.c
	ed rtar.c < rtar.script
	cp $(DD) rdd.c
	chmod u+w rdd.c
	ed rdd.c < rdd.script
	cp $(MT) rmt.c
	chmod u+w rmt.c
	ed rmt.c < rmt.script
	cp $(DUMPRMT) rsubs.c
	chmod u+w rsubs.c
	ed rsubs.c < rsubs.script

#
# Run 'make document' to install the manual page.
# Set SECTION to determine the section (1 for section 1, l for LOCAL, etc.)
#
MANDIR	= /usr/man
SECTION	= l
document:
	cp rtar.1 $(MANDIR)/man$(SECTION)/rtar.$(SECTION)
	echo '.so $(MANDIR)/man$(SECTION)/rtar.$(SECTION)' > \
		$(MANDIR)/man$(SECTION)/rdd.$(SECTION)
	echo '.so $(MANDIR)/man$(SECTION)/rtar.$(SECTION)' > \
		$(MANDIR)/man$(SECTION)/rmt.$(SECTION)
EOF

cat > rtar.script << "EOF"
1151c
		lastread = rmtread(fd, buf, size - count);



More information about the Comp.sources.unix mailing list