Accepting request 482515 from home:svalx

OBS-URL: https://build.opensuse.org/request/show/482515
OBS-URL: https://build.opensuse.org/package/show/Archiving/dump?expand=0&rev=17
This commit is contained in:
Martin Pluskal 2017-03-24 21:21:51 +00:00 committed by Git OBS Bridge
parent ba3ce163c4
commit c8f1e6687e
12 changed files with 689 additions and 182 deletions

View File

@ -1,42 +0,0 @@
--- MCONFIG.in
+++ MCONFIG.in
@@ -17,8 +17,8 @@
MANGRP= @MANGRP@
MANMODE= @MANMODE@
-INSTALLBIN= $(INSTALL) -o $(BINOWNER) -g $(BINGRP) -m $(BINMODE)
-INSTALLMAN= $(INSTALL) -o $(MANOWNER) -g $(MANGRP) -m $(MANMODE)
+INSTALLBIN= $(INSTALL) -m $(BINMODE)
+INSTALLMAN= $(INSTALL) -m $(MANMODE)
prefix= @prefix@
exec_prefix= @exec_prefix@
--- configure.in
+++ configure.in
@@ -24,6 +24,8 @@
CPPFLAGS="-D_BSD_SOURCE -D_USE_BSD_SIGNAL ${CPPFLAGS}"
+AC_HEADER_STDC
+
dnl
dnl Handle --enable-debug
dnl
@@ -510,7 +512,7 @@
dnl
dnl Check for rl_completion_matches
dnl
-AC_CHECK_LIB(readline, rl_completion_matches, [rlcm=yes], [rlcm=no], "-ltermcap")
+AC_CHECK_LIB(readline, rl_completion_matches, [rlcm=yes], [rlcm=no])
if test "$rlcm" = yes; then
AC_DEFINE([HAVE_READLINE_RLCM],1,[Define this if your readline libs have the rl_completion_matches library.])
fi
@@ -518,7 +520,7 @@
dnl
dnl Check for rl_completion_append_character
dnl
-AC_CHECK_LIB(readline, rl_completion_append_character, [rcac=yes], [rcac=no], "-ltermcap")
+AC_CHECK_LIB(readline, rl_completion_append_character, [rcac=yes], [rcac=no])
if test "$rcac" = yes; then
AC_DEFINE([HAVE_READLINE_CAC],1,[Define this if your readline libs have the rl_completion_append_character variable.])
fi

View File

@ -1,64 +0,0 @@
--- dump/Makefile.in
+++ dump/Makefile.in
@@ -35,11 +35,11 @@
-e "s|__VERSION__|$(VERSION)|g" $< > $@
install:: all
- $(INSTALL) -d $(SBINDIR) $(MANDIR)
- $(INSTALLBIN) $(PROG) $(SBINDIR)
- $(INSTALLMAN) $(MAN8) $(MANDIR)
- cd $(SBINDIR) && $(RM) -f $(RPROG) && $(LN_S) $(PROG) $(RPROG)
- cd $(MANDIR) && $(RM) -f $(RMAN8) && $(LN_S) $(MAN8) $(RMAN8)
+ $(INSTALL) -d $(DESTDIR)$(SBINDIR) $(DESTDIR)$(MANDIR)
+ $(INSTALLBIN) $(PROG) $(DESTDIR)$(SBINDIR)
+ $(INSTALLMAN) $(MAN8) $(DESTDIR)$(MANDIR)
+ cd $(DESTDIR)$(SBINDIR) && $(RM) -f $(RPROG) && $(LN_S) $(PROG) $(RPROG)
+ cd $(DESTDIR)$(MANDIR) && $(RM) -f $(RMAN8) && $(LN_S) $(MAN8) $(RMAN8)
clean::
$(RM) -f $(PROG) $(MAN8) \#* *.s *.o *.a *~ core
--- dump/main.c
+++ dump/main.c
@@ -1187,7 +1187,7 @@
case SIGSEGV:
msg("SIGSEGV: ABORTING!\n");
(void)signal(SIGSEGV, SIG_DFL);
- (void)kill(0, SIGSEGV);
+ (void)kill(getpid(), SIGSEGV);
/* NOTREACHED */
}
}
--- restore/Makefile.in
+++ restore/Makefile.in
@@ -35,11 +35,11 @@
-e "s|__VERSION__|$(VERSION)|g" $< > $@
install:: all
- $(INSTALL) -d $(SBINDIR) $(MANDIR)
- $(INSTALLBIN) $(PROG) $(SBINDIR)
- $(INSTALLMAN) $(MAN8) $(MANDIR)
- cd $(SBINDIR) && $(RM) -f $(RPROG) && $(LN_S) $(PROG) $(RPROG)
- cd $(MANDIR) && $(RM) -f $(RMAN8) && $(LN_S) $(MAN8) $(RMAN8)
+ $(INSTALL) -d $(DESTDIR)$(SBINDIR) $(DESTDIR)$(MANDIR)
+ $(INSTALLBIN) $(PROG) $(DESTDIR)$(SBINDIR)
+ $(INSTALLMAN) $(MAN8) $(DESTDIR)$(MANDIR)
+ cd $(DESTDIR)$(SBINDIR) && $(RM) -f $(RPROG) && $(LN_S) $(PROG) $(RPROG)
+ cd $(DESTDIR)$(MANDIR) && $(RM) -f $(RMAN8) && $(LN_S) $(MAN8) $(RMAN8)
clean::
$(RM) -f $(PROG) $(MAN8) \#* *.s *.o *.a *~ core
--- rmt/Makefile.in
+++ rmt/Makefile.in
@@ -35,9 +35,9 @@
-e "s|__VERSION__|$(VERSION)|g" $< > $@
install:: all
- $(INSTALL) -d $(SBINDIR) $(MANDIR)
- $(INSTALLBIN) $(PROG) $(SBINDIR)
- $(INSTALLMAN) $(srcdir)/$(MAN8) $(MANDIR)
+ $(INSTALL) -d $(DESTDIR)$(SBINDIR) $(DESTDIR)$(MANDIR)
+ $(INSTALLBIN) $(PROG) $(DESTDIR)$(SBINDIR)
+ $(INSTALLMAN) $(srcdir)/$(MAN8) $(DESTDIR)$(MANDIR)
clean::
rm -f $(PROG) @ERMT@ \#* *.s *.o *.a *~ core rmt.8

View File

@ -1,8 +0,0 @@
--- compat/include/pathnames.h
+++ compat/include/pathnames.h
@@ -54,4 +54,4 @@
#endif
#endif
-#define _PATH_RMT "/etc/rmt" /* path on remote host */
+#define _PATH_RMT "/sbin/rmt" /* path on remote host */

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:78cb75632ac5e99dca38af3a2574303eee3c5a7af464011d279421d8b0e64f96
size 296691

View File

@ -0,0 +1,17 @@
From: Alexey Svistunov <svalx@svalx.net>
Date: 2017-03-15 15:48:22 +0300
Subject: Fixing rpmlint no-return-in-nonvoid-function error in dump
References: https://sourceforge.net/u/svalx1/dump/ci/7b36fa5f01cfb42e6dc9af83b444524ca1d2d4e9/
Upstream: merged
Index: dump-0.4b46/common/transformation_lzo.c
===================================================================
--- dump-0.4b46.orig/common/transformation_lzo.c
+++ dump-0.4b46/common/transformation_lzo.c
@@ -13,6 +13,7 @@
static int
lzo_initialize(Transformation *xform, int enc)
{
+ return 0;
}
/*

View File

@ -0,0 +1,53 @@
Index: dump-0.4b46/dump/dump.8.in
===================================================================
--- dump-0.4b46.orig/dump/dump.8.in
+++ dump-0.4b46/dump/dump.8.in
@@ -199,7 +199,7 @@ exist, dump doesn't create a new remote
The default path name of the remote
.BR rmt (8)
program is
-.IR /etc/rmt ;
+.IR /usr/bin/rmt ;
this can be overridden by the environment variable
.BR RMT .
.TP
Index: dump-0.4b46/dump/Makefile.am
===================================================================
--- dump-0.4b46.orig/dump/Makefile.am
+++ dump-0.4b46/dump/Makefile.am
@@ -5,7 +5,6 @@ EXTRA_DIST =
man_MANS = dump.8
DISTCLEANFILES += dump.8
EXTRA_DIST += dump.8.in
-dist_man_MANS = rdump.8
sbin_PROGRAMS = dump
@@ -20,7 +19,6 @@ dump.8: dump.8.in
install-exec-hook:
$(MKDIR_P) $(DESTDIR)$(sbindir)
- $(LN_S) dump $(DESTDIR)$(sbindir)/rdump
uninstall-hook:
$(RM) -f $(DESTDIR)$(sbindir)/rdump
Index: dump-0.4b46/restore/Makefile.am
===================================================================
--- dump-0.4b46.orig/restore/Makefile.am
+++ dump-0.4b46/restore/Makefile.am
@@ -5,7 +5,6 @@ EXTRA_DIST =
man_MANS = restore.8
DISTCLEANFILES += restore.8
EXTRA_DIST += restore.8.in
-dist_man_MANS = rrestore.8
sbin_PROGRAMS = restore
@@ -22,7 +21,6 @@ restore.8: restore.8.in
install-exec-hook:
$(MKDIR_P) $(DESTDIR)$(sbindir)
- $(LN_S) restore $(DESTDIR)$(sbindir)/rrestore
uninstall-hook:
$(RM) -f $(DESTDIR)$(sbindir)/rrestore

View File

@ -0,0 +1,79 @@
From: Alexey Svistunov <svalx@svalx.net>
Date: 2017-03-21 12:22:00 +0300
Subject: Independent rmt and ermt build, change its locations to _bindir
References:
Upstream: submitted
Index: dump-0.4b46/rmt/Makefile.am
===================================================================
--- dump-0.4b46.orig/rmt/Makefile.am
+++ dump-0.4b46/rmt/Makefile.am
@@ -1,17 +1,23 @@
AM_CPPFLAGS = -I$(top_srcdir)/compat/include
DISTCLEANFILES =
EXTRA_DIST =
+bin_PROGRAMS =
+man_MANS =
-sbin_PROGRAMS = rmt
+if BUILD_RMT
+bin_PROGRAMS += rmt
+man_MANS += rmt.8
+DISTCLEANFILES += rmt.8
+EXTRA_DIST += rmt.8.in
+endif
if BUILD_ERMT
-sbin_PROGRAMS += ermt
+bin_PROGRAMS += ermt
+man_MANS += ermt.1
+DISTCLEANFILES += ermt.1
+EXTRA_DIST += ermt.1.in
endif
-man_MANS = rmt.8
-DISTCLEANFILES += rmt.8
-EXTRA_DIST += rmt.8.in
-
rmt_SOURCES = rmt.c
rmt_LDADD = ../compat/lib/libcompat.la $(EXT2FS_LIBS)
@@ -22,3 +28,8 @@ rmt.8: rmt.8.in
$(AM_V_GEN)\
sed -e "s|__DATE__|$(DATE)|g" \
-e "s|__VERSION__|$(VERSION)|g" $< > $@
+ermt.1: ermt.1.in
+ $(AM_V_GEN)\
+ sed -e "s|__DATE__|$(DATE)|g" \
+ -e "s|__VERSION__|$(VERSION)|g" $< > $@
+
Index: dump-0.4b46/configure.ac
===================================================================
--- dump-0.4b46.orig/configure.ac
+++ dump-0.4b46/configure.ac
@@ -80,9 +80,6 @@ AC_MSG_CHECKING([whether to build ermt])
BUILD_ERMT=no
AC_ARG_ENABLE([ermt], [AC_HELP_STRING([--enable-ermt], [compile ermt, an encrypting version of rmt @<:@default=no@:>@])])
if test "$enable_ermt" = "yes"; then
- if test "$BUILD_RMT" != "yes"; then
- AC_MSG_ERROR([ermt requires --enable-rmt])
- fi
BUILD_ERMT=yes
fi
AM_CONDITIONAL([BUILD_ERMT], [test "$BUILD_ERMT" = "yes"])
Index: dump-0.4b46/Makefile.am
===================================================================
--- dump-0.4b46.orig/Makefile.am
+++ dump-0.4b46/Makefile.am
@@ -1,9 +1,6 @@
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = compat/lib common dump restore
-if BUILD_RMT
-SUBDIRS += rmt
-endif
+SUBDIRS = compat/lib common dump restore rmt
EXTRA_DIST = \
dump.lsm KNOWNBUGS MAINTAINERS REPORTING-BUGS \

3
dump-0.4b46.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8061d927dd1ae98e0a1bd70406cde5ecbced154507460629be174c55822f2f97
size 578200

View File

@ -1,27 +0,0 @@
diff -up dump-0.4b44/configure.in.buildfix dump-0.4b44/configure.in
--- dump-0.4b44/configure.in.buildfix 2011-06-14 14:37:49.659652746 +0200
+++ dump-0.4b44/configure.in 2011-06-14 14:40:47.361349814 +0200
@@ -415,6 +415,11 @@ if test "$ext2fs_h" = no -o "x$EXT2FS_LI
AC_MSG_ERROR(You need to install the Ext2fs libraries from the E2fsprogs distribution first - hint: make install-libs)
fi
+PKG_CHECK_MODULES(COM_ERR, [com_err])
+if test -n "$STATIC" ; then
+ COM_ERR_LIBS=`$PKG_CONFIG --libs --static com_err`
+fi
+
dnl
dnl Check for ext2fs_read_inode_full
dnl
diff -up dump-0.4b44/MCONFIG.in.buildfix dump-0.4b44/MCONFIG.in
--- dump-0.4b44/MCONFIG.in.buildfix 2011-06-14 14:41:00.869323616 +0200
+++ dump-0.4b44/MCONFIG.in 2011-06-14 14:41:12.947300187 +0200
@@ -40,7 +40,7 @@ GINC+= @EXT2FS_CFLAGS@
# indicate where the ext2fs library can be found (this is not needed if you
# have run `make install-libs' in the e2fsprogs source directory).
#GLIBDIR= -L/usr/src/e2fsprogs-0.5c/lib
-GLIBS= $(GLIBDIR) -L../compat/lib -lcompat @EXT2FS_LIBS@
+GLIBS= $(GLIBDIR) -L../compat/lib -lcompat @EXT2FS_LIBS@ @COM_ERR_LIBS@
#
# Definitions (don't change them unless you know what you are doing)

View File

@ -1,3 +1,36 @@
-------------------------------------------------------------------
Tue Mar 21 10:13:12 UTC 2017 - svalx@svalx.net
- Update to 0.4b44
* Improve data throughput when using compression in dump by
allowing multiple slaves to compress in parallel. Thanks
to Phillip Susi <psusi@cfl.rr.com> for the patch.
* Add dump encryption support and reorganise the whole
compression/encryption code as plugins. Thanks to
Bear Giles <bgiles@coyotesong.com> for the patch.
* Add sqlite index support and reorganize the QFA code
as plugins. Thanks to Bear Giles <bgiles@coyotesong.com> for
the patch.
* Lots of various build cleanups and minor bugfixes.
* Use pkg-config to locate openssl dependencies to fix ermt linking.
* Fix building when QFA code is disabled (Alexander Zangerl).
* Fix crash with the -Q option (Alexander Zangerl).
* Fix crash with legacy indexer (Alexander Zangerl).
* Fix handling of the -A flag.
* Fix compression enabling logic (Alexander Zangerl).
* Skip unhandled fstab entries (Josef Ridky).
- Add ermt (1) man page
- A new version of dump have an updated make system, because of this
* remove patches dump-0.4b43-configure.patch, dump-0.4b43-destdir.patch
* rebase patch dump-0.4b43-pathnames.patch to dump-0.4b46-pathnames.patch
- Add dump-0.4b46-lzo-no-return.patch - fixing rpmlint
no-return-in-nonvoid-function error in dump
- Add dump-0.4b46-rmt-ermt.patch - independent rmt and ermt build,
change its locations to _bindir
- Cleanup spec file with spec-cleaner
- Separated rmt subpackage
- Alternatives system for rmt/ermt
-------------------------------------------------------------------
Fri May 1 15:16:02 UTC 2015 - mpluskal@suse.com

101
dump.spec
View File

@ -1,7 +1,7 @@
#
# spec file for package dump
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -17,19 +17,25 @@
Name: dump
Version: 0.4b44
Version: 0.4b46
Release: 0
Summary: A Backup Program
Summary: Programs for backing up and restoring ext2/3/4 filesystems
License: BSD-3-Clause
Group: Productivity/Archiving/Backup
Url: http://dump.sourceforge.net
Source0: http://sourceforge.net/projects/%{name}/files/%{name}/%{version}/%{name}-%{version}.tar.gz
Patch0: %{name}-0.4b43-pathnames.patch
Patch1: %{name}-0.4b43-destdir.patch
Patch2: %{name}-0.4b43-configure.patch
Source1: ermt.1.in
# PATCH-FIX-SUSE dump-0.4b46-pathnames.patch svalx@svalx.net -- pathnames and
# symlinks configuration for dump and restore
Patch0: %{name}-0.4b46-pathnames.patch
# PATCH-FIX-UPSTREAM dump-0.4b46-rmt-ermt.patch svalx@svalx.net -- Independent rmt and
# ermt build, change its locations to _bindir
Patch1: %{name}-0.4b46-rmt-ermt.patch
Patch3: %{name}-0.4b43-include.patch
Patch4: %{name}-0.4b43-fix-bashisms.patch
Patch5: %{name}-buildfix.patch
# PATCH-FIX-UPSTREAM dump-0.4b46-lzo-no-return.patch svalx@svalx.net -- fixing rpmlint
# no-return-in-nonvoid-function error in dump
Patch5: %{name}-0.4b46-lzo-no-return.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: e2fsprogs-devel
@ -40,8 +46,8 @@ BuildRequires: lzo-devel
BuildRequires: openssl-devel
BuildRequires: readline-devel
BuildRequires: zlib-devel
Requires: rmt
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Recommends: %{name}-rmt = %{version}
Recommends: mt
%description
The dump package contains both dump and restore. Dump examines files
@ -50,48 +56,67 @@ copies those files to a specified disk, tape, or other storage medium.
The restore command performs the inverse function of dump. It can
restore a full backup of a file system.
%package rmt
Summary: Provides certain programs with access to remote tape devices
Group: Productivity/Archiving/Backup
Requires(post): update-alternatives
Requires(postun): update-alternatives
Provides: rmt
%description rmt
The rmt utility provides remote access to tape devices for programs
like dump (a filesystem backup program), restore (a program for
restoring files from a backup), tar (an archiving program) and cpio.
%prep
%setup -q
%patch0
%patch1
%patch2
cp %{SOURCE1} rmt/
%patch0 -p1
%patch1 -p1
%patch3
%patch4 -p1
%patch5 -p1
%build
autoreconf -fi
%configure \
--sbindir=/sbin \
--enable-rmt \
--with-ldopts= \
--with-ccopts="-I$PWD -Wall" \
--with-binowner=root \
--with-bingrp=root \
--with-binmode=0755 \
--with-manowner=root \
--with-mangrp=root \
--with-manmode=0644 \
--enable-readline \
--enable-largefile \
--enable-ermt
%configure --enable-ermt --enable-rmt=no --with-rmtpath=%{_bindir}
make %{?_smp_mflags}
%install
install -d %{buildroot}%{_sysconfdir} \
%{buildroot}/sbin \
%{buildroot}/%{_mandir}/man8
make DESTDIR=%{buildroot}/ install
#do not install rmt
#ln -sf ../sbin/rmt $RPM_BUILD_ROOT/etc/rmt
rm %{buildroot}/sbin/rmt
rm %{buildroot}/%{_mandir}/man8/rmt.*
%make_install
mv examples/encrypted_rmt .
# Alternatives system
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
ln -sf %{_sysconfdir}/alternatives/rmt %{buildroot}%{_bindir}/rmt
ln -sf %{_sysconfdir}/alternatives/rmt.1%{ext_man} %{buildroot}%{_mandir}/man1/rmt.1%{ext_man}
%post rmt
%{_sbindir}/update-alternatives --force \
--install %{_bindir}/rmt rmt %{_bindir}/ermt 20 \
--slave %{_mandir}/man1/rmt.1%{ext_man} rmt.1%{ext_man} %{_mandir}/man1/ermt.1%{ext_man}
%postun rmt
if [ "$1" = 0 ] ; then
"%{_sbindir}/update-alternatives" --remove rmt %{_bindir}/ermt
fi
%files
%defattr(-, root, root)
%{_mandir}/*/*
/sbin/*
%doc CHANGES COPYRIGHT KNOWNBUGS MAINTAINERS README REPORTING-BUGS
%doc THANKS TODO dump.lsm examples
%{_sbindir}/dump
%{_sbindir}/restore
%{_mandir}/man8/dump.8%{ext_man}
%{_mandir}/man8/restore.8%{ext_man}
%doc NEWS COPYING KNOWNBUGS MAINTAINERS README REPORTING-BUGS
%doc AUTHORS TODO dump.lsm examples
%files rmt
%defattr(-,root,root)
%ghost %{_bindir}/rmt
%{_bindir}/ermt
%ghost %{_mandir}/man1/rmt.1%{ext_man}
%{_mandir}/man1/ermt.1%{ext_man}
%ghost %{_sysconfdir}/alternatives/rmt
%ghost %{_sysconfdir}/alternatives/rmt.1%{ext_man}
%doc encrypted_rmt/README
%changelog

441
ermt.1.in Normal file
View File

@ -0,0 +1,441 @@
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" 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.
.\" 3. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
.\"
.TH ERMT 1 "version __VERSION__ of __DATE__" BSD "System management commands"
.SH NAME
ermt \- remote magtape protocol module with transparent encryption support
.SH SYNOPSIS
.B ermt
.SH DESCRIPTION
.B Ermt
is a program used by the remote
.BR dump (8),
.BR restore (8)
.BR cpio (1)
or
.BR tar (1)
programs in manipulating a magnetic tape drive through an interprocess
communication connection.
.B Ermt
is normally started up with an
.BR ssh (1)
.BR rexec (3)
or
.BR rcmd (3)
call.
.PP
The
.B ermt
program accepts requests specific to the manipulation of magnetic tapes,
performs the commands, then responds with a status indication. All responses
are in
.B ASCII
and in one of the following two forms.
.PP
Successful commands have responses of:
.RS
.B A\fInumber\fR\en
.RE
.PP
where
.I number
is an
.B ASCII
representation of a decimal number.
.PP
Unsuccessful commands are responded to with:
.RS
.B E\fIerror-number\fR\en\fIerror-message\fR\en
.RE
.PP
where
.I error-number
is one of the possible error numbers described in
.BR intro (2)
and
.I error-message
is the corresponding error string as printed from a call to
.BR perror (3).
.PP
The protocol is comprised of the following commands, which are sent as
indicated - no spaces are supplied between the command and its arguments, or
between its arguments, and \en indicates that a newline should be supplied:
.TP
.B O\fIdevice\fR\en\fImode\fR\en
Open the specified
.I device
using the indicated
.IR mode .
.I Device
is a full pathname and
.I mode
is an
.B ASCII
representation of a decimal number suitable for passing to
.BR open (2).
If a device had already been opened, it is closed before a new open is
performed.
.TP
.B C\fIdevice\fR\en
Close the currently open device. The
.I device
specified is ignored.
.TP
.B L\fIwhence\fR\en\fIoffset\fR\en
Perform an
.BR lseek (2)
operation using the specified parameters. The response value is that returned
from the
.B lseek
call.
.TP
.B W\fIcount\fR\en
Write data onto the open device.
.B Rmt
reads
.I count
bytes from the connection, aborting if a premature end-of-file is encountered.
The response value is that returned from the
.BR write (2)
call.
.TP
.B R\fIcount\fR\en
Read
.I count
bytes of data from the open device. If
.I count
exceeds the size of the data buffer (10 kilobytes), it is truncated to the
data buffer size.
.B Rmt
then performs the requested
.BR read (2)
and responds with
.B A\fIcount-read\fR\en
if the read was successful; otherwise an error in the standard format is
returned. If the read was successful, the data read is then sent.
.TP
.B I\fIoperation\fR\en\fIcount\fR\en
Perform a
.B MTIOCOP
.BR ioctl (2)
command using the specified parameters. The parameters are interpreted as the
.B ASCII
representations of the decimal values to place in the
.B mt_op
and
.B mt_count
fields of the structure used in the
.B ioctl
call. The return value is the
.I count
parameter when the operation is successful.
.IP
By issuing the
.B I-1\en0\en
command, a client will specify that he is using the VERSION 1 protocol.
.IP
For a VERSION 0 client, the
.I operation
parameter is the platform
.B mt_op
value (could be different if the client and the
.B rmt
server are on two different platforms). For a VERSION 1 client, the
.I operation
parameter is standardized as below:
.RS
.TP
.B 0
Issue a
.B MTWEOF
command (write
.I count
end-of-file records).
.TP
.B 1
Issue a
.B MTFSF
command (forward space over
.I count
file marks).
.TP
.B 2
Issue a
.B MTBSF
command (backward space over
.I count
file marks).
.TP
.B 3
Issue a
.B MTFSR
command (forward space
.I count
inter-record gaps).
.TP
.B 4
Issue a
.B MTBSR
command (backward space
.I count
inter-record gaps).
.TP
.B 5
Issue a
.B MTREW
command (rewind).
.TP
.B 6
Issue a
.B MTOFFL
command (rewind and put the drive offline).
.TP
.B 7
Issue a
.B MTNOP
command (no operation, set status only).
.RE
.TP
.B i\fIoperation\fR\en\fIcount\fR\en
Perform an extended
.B MTIOCOP
.BR ioctl (2)
command using the specified parameters. The parameters are interpreted as the
.B ASCII
representations of the decimal values to place in the
.B mt_op
and
.B mt_count
fields of the structure used in the
.B ioctl
call. The return value is the
.I count
parameter when the operation is successful. The possible operations are:
.RS
.TP
.B 0
Issue a
.B MTCACHE
command (switch cache on).
.TP
.B 1
Issue a
.B MTNOCACHE
command (switch cache off).
.TP
.B 2
Issue a
.B MTRETEN
command (retension the tape).
.TP
.B 3
Issue a
.B MTERASE
command (erase the entire tape).
.TP
.B 4
Issue a
.B MTEOM
command (position to end of media).
.TP
.B 5
Issue a
.B MTNBSF
command (backward space count files to BOF).
.RE
.TP
.B S
Return the status of the open device, as obtained with a
.B MTIOCGET
.B ioctl
call. If the operation was successful, an \*(lqack\*(rq is sent with the size
of the status buffer, then the status buffer is sent (in binary, which is
non-portable between different platforms).
.TP
.BI s sub-command
This is a replacement for the previous
.B S
command, portable across different platforms. If the open device is a magnetic
tape, return members of the magnetic tape status structure, as obtained with a
.B MTIOCGET
ioctl call. If the open device is not a magnetic tape, an error is returned. If
the
.B MTIOCGET
operation was successful, the numerical value of the structure member is
returned in decimal. The following sub commands are supported:
.RS
.TP
.B T
return the content of the structure member
.B mt_type
which contains the type of the magnetic tape device.
.TP
.B D
return the content of the structure member
.B mt_dsreg
which contains the "drive status register".
.TP
.B E
return the content of the structure member
.B mt_erreg
which contains the "error register". This structure member must be retrieved
first because it is cleared after each
.B MTIOCGET
ioctl call.
.TP
.B R
return the content of the structure member
.B mt_resid
which contains the residual count of the last I/O.
.TP
.B F
return the content of the structure member
.B mt_fileno
which contains the file number of the current tape position.
.TP
.B B
return the content of the structure member
.B mt_blkno
which contains the block number of the current tape position.
.TP
.B f
return the content of the structure member
.B mt_flags
which contains MTF_ flags from the driver.
.TP
.B b
return the content of the structure member
.B mt_bf
which contains the optimum blocking factor.
.RE
.PP
Any other command causes
.B rmt
to exit.
.SH ENCRYPTION
This version "rmt" utility - \fBe\fRrmt have a transparent encryption support.
Data is encrypted before it is written to tape, and decrypted when read.
.DQ .DQ .DQ .DQ .DQ .DQ .DQ Tools that use rmt for remote tape access (such as dump, restore, cpio
and tar) can manipulate encrypted data without modification.
.PP
.B ermt
reads the secret key from ".ermt.key" and use
.BR openssl (1)
for perform encryption and decryption.
The symmetric cipher is currently hardwired as Blowfish.
.SH EXAMPLES
.SS Run-time setup:
- Create a user for remote tape access, which we will call "dump":
.TP
useradd -m dump
.TP
- Generate a random key in ~dump/.ermt.key:
.PP
.EX
su - dump
openssl rand -out .ermt.key 32
chmod 400 .ermt.key
.EE
.PP
Due to the way "openssl enc -kfile .ermt.key" reads the key file,
you should ensure that the key contains no \e0 or \er or \en characters,
which would prematurely truncate the key length.
.PP
- Protect the key: copy to many floppies, "od -x .ermt.key|lpr", etc.
.PP
- Set up ssh access from root (or whoever you run dump as)
.PP
- Copy the ermt binary to ~dump and change dump's shell to ~dump/ermt
.PP
.RS
or
.RE
.PP
- If user who run backup program is a same with the user who must to run rmt, just install ermt binary into a bin folder.
.SS Backup usage:
Just dump remotely to localhost:
.PP
.EX
dump -0u -f dump@localhost:/dev/st0 /
restore -i -f dump@localhost:/dev/st0
# You can use GNU tar too
.EE
.PP
If your device is doing hardware compression, it's best to turn
it off, since encrypted data compresses very poorly.
.SS Emergency decrypting:
If you need to restore a tape and
don't have access to a host running ermt,
you have two choices:
.PP
- If you have a copy of the ermt binary, run it with the -d switch
to decrypt stdin to stdout:
.PP
.EX
dd if=/dev/st0 bs=10k |
(cd ~dump; ./ermt -d) | # assuming ermt is in ~dump
restore -i -f -
.EE
.PP
- If not, use the OpenSSL "openssl" command, which does the same thing:
.PP
.EX
dd if=/dev/st0 bs=10k |
openssl enc -d -kfile ~dump/.ermt.key -blowfish -nosalt -nopad |
restore -i -f -
.EE
.PP
.SH ERRORS
If "~/.ermt.key" will not be found, any opertion will fail.
.SH DIAGNOSTICS
All responses are of the form described above.
.SH SEE ALSO
.BR ssh (1),
.BR rcmd (3),
.BR rexec (3),
.I /usr/include/sys/mtio.h,
.BR dump (8),
.BR restore (8)
.SH BUGS
People should be discouraged from using this for a remote file access protocol.
.SH AUTHOR
The
.B dump/restore
backup suit was ported to Linux's Second Extended File System by Remy Card
<card@Linux.EU.Org>. He maintained the initial versions of
.B dump
(up and including 0.4b4, released in january 1997).
.PP
Starting with 0.4b5, the new maintainer is Stelian Pop <stelian@popies.net>.
.SH AVAILABILITY
The
.B dump/restore
backup suit is available from <http://dump.sourceforge.net>
.SH HISTORY
The
.B rmt
command appeared in 4.2BSD.