*BSD News Article 11326


Return to BSD News archive

Received: by minnie.vk1xwt.ampr.org with NNTP
	id AA1579 ; Tue, 23 Feb 93 14:49:22 EST
Path: sserve!manuel.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!network.ucsd.edu!ogicse!psgrain!ee.und.ac.za!shrike.und.ac.za!hippo!kudu!g89r4222
From: g89r4222@kudu.ru.ac.za (Geoff Rehmet)
Newsgroups: comp.unix.bsd
Subject: [386BSD] More options for rdump & rrestore
Message-ID: <g89r4222.730049559@kudu>
Date: 18 Feb 93 15:32:39 GMT
Article-I.D.: kudu.g89r4222.730049559
Sender: news@hippo.ru.ac.za (Usenet News Admin)
Organization: Rhodes University, Grahamstown, South Africa
Lines: 228

Hi,

This follows on my enquiries about rdump and rrestore - to use a
remote tape drive to do filesystem backups.

I have added the option to specify the remote tape device as
user@host:device - which I need since I cannot log in as root on
the system which has the remote tape.

The following is a shell archive of the diffs which are needed to
add these options to 386bsd's rdump and rrestore.


Geoff.



----Cut here ------------
#!/bin/sh 
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	dumpmain.diff
#	dumprmt.diff
#	rdump.diff
#	rrestore.diff
#	tape.diff
#
# Created by Geoff Rehmet - geoff@braae.ru.ac.za
#
echo x - dumpmain.diff
sed 's/^X//' >dumpmain.diff << 'END-of-dumpmain.diff'
X*** /usr/src/sbin/dump/dumpmain.c	Thu Feb 18 12:39:03 1993
X--- /usr/src/sbin/dump/dumpmain.c.orig	Thu Feb 18 11:53:48 1993
X***************
X*** 71,77 ****
X  long	blocksperfile;	/* output blocks per file */
X  #ifdef RDUMP
X  char	*host;
X- char	*ruser;		/* name of remote user				*/
X  int	rmthost();
X  #endif
X  
X--- 71,76 ----
X***************
X*** 245,268 ****
X  
X  #ifdef RDUMP
X  	{ char *index();
X! 	  ruser = tape;
X! 	  host = index(tape, '@');
X  	  tape = index(host, ':');
X  	  if (tape == 0) {
X  		msg("need keyletter ``f'' and device ``host:tape''\n");
X  		exit(1);
X  	  }
X- 	  if (host == (char *)NULL)
X- 	    {
X- 	     /* There was no @ sign specified - therefor assume remote
X- 		user is the same as local user				*/
X- 	     ruser = (char *)NULL;
X- 	     host = tape;
X- 	    }
X- 	  else
X-    	    {
X- 	     *host++ = (char *)NULL;
X- 	    }
X  	  *tape++ = 0;
X  	  if (rmthost(host) == 0)
X  		exit(X_ABORT);
X--- 244,255 ----
X  
X  #ifdef RDUMP
X  	{ char *index();
X! 	  host = tape;
X  	  tape = index(host, ':');
X  	  if (tape == 0) {
X  		msg("need keyletter ``f'' and device ``host:tape''\n");
X  		exit(1);
X  	  }
X  	  *tape++ = 0;
X  	  if (rmthost(host) == 0)
X  		exit(X_ABORT);
END-of-dumpmain.diff
echo x - dumprmt.diff
sed 's/^X//' >dumprmt.diff << 'END-of-dumprmt.diff'
X*** /usr/src/sbin/dump/dumprmt.c	Thu Feb 18 14:28:05 1993
X--- /usr/src/sbin/dump/dumprmt.c.orig	Thu Feb 18 14:37:26 1993
X***************
X*** 71,78 ****
X  extern int ntrec;		/* blocking factor on tape */
X  extern void msg();
X  
X- extern char * ruser;
X- 
X  int
X  rmthost(host)
X  	char *host;
X--- 71,76 ----
X***************
X*** 112,118 ****
X  	pw = getpwuid(getuid());
X  	if (pw && pw->pw_name)
X  		name = pw->pw_name;
X! 	rmtape = rcmd(&rmtpeer, sp->s_port, name, ruser?ruser:name, _PATH_RMT, 0);
X  	size = ntrec * TP_BSIZE;
X  	while (size > TP_BSIZE &&
X  	    setsockopt(rmtape, SOL_SOCKET, SO_SNDBUF, &size, sizeof (size)) < 0)
X--- 110,116 ----
X  	pw = getpwuid(getuid());
X  	if (pw && pw->pw_name)
X  		name = pw->pw_name;
X! 	rmtape = rcmd(&rmtpeer, sp->s_port, name, name, _PATH_RMT, 0);
X  	size = ntrec * TP_BSIZE;
X  	while (size > TP_BSIZE &&
X  	    setsockopt(rmtape, SOL_SOCKET, SO_SNDBUF, &size, sizeof (size)) < 0)
END-of-dumprmt.diff
echo x - rdump.diff
sed 's/^X//' >rdump.diff << 'END-of-rdump.diff'
X*** /usr/src/sbin/dump/rdump.8	Thu Feb 18 14:34:43 1993
X--- /usr/src/sbin/dump/rdump.8.orig	Thu Feb 18 14:31:09 1993
X***************
X*** 56,65 ****
X  key must be specified and the file
X  .Ar argument
X  supplied should be of the form
X! .Pa [user@]machine:device .  
X! The 
X! .Pa user
X! part of the argument is optional.
X  .Pp
X  .Nm Rdump
X  creates a remote server,
X--- 56,62 ----
X  key must be specified and the file
X  .Ar argument
X  supplied should be of the form
X! .Pa machine:device .
X  .Pp
X  .Nm Rdump
X  creates a remote server,
END-of-rdump.diff
echo x - rrestore.diff
sed 's/^X//' >rrestore.diff << 'END-of-rrestore.diff'
X*** /usr/src/sbin/restore/rrestore.8	Thu Feb 18 15:14:17 1993
X--- /usr/src/sbin/restore/rrestore.8.orig	Thu Feb 18 15:11:39 1993
X***************
X*** 55,65 ****
X  .Cm f
X  key should be specified and the file
X  supplied should be of the form
X! .Ar [user@]machine:device .
X! The 
X! .Ar user
X! part of the argument is optional, and specifies the username which should be
X! used on the remote machine.
X  .Pp
X  .Nm Rrestore
X  creates a remote server,
X--- 55,61 ----
X  .Cm f
X  key should be specified and the file
X  supplied should be of the form
X! .Ar machine:device .
X  .Pp
X  .Nm Rrestore
X  creates a remote server,
END-of-rrestore.diff
echo x - tape.diff
sed 's/^X//' >tape.diff << 'END-of-tape.diff'
X*** /usr/src/sbin/restore/tape.c	Thu Feb 18 15:09:17 1993
X--- /usr/src/sbin/restore/tape.c.orig	Thu Feb 18 14:51:46 1993
X***************
X*** 65,74 ****
X  int		Bcvt;		/* Swap Bytes (for CCI or sun) */
X  static int	Qcvt;		/* Swap quads (for sun) */
X  u_long		swabl();
X- 
X- #ifdef RRESTORE
X- char 		* ruser;
X- #endif
X  /*
X   * Set up an input source
X   */
X--- 65,70 ----
X***************
X*** 88,106 ****
X  		newtapebuf(NTREC > HIGHDENSITYTREC ? NTREC : HIGHDENSITYTREC);
X  	terminal = stdin;
X  #ifdef RRESTORE
X! 	ruser = source;
X! 	host = index(source, '@');
X! 	tape = index(source, ':');
X! 	if(host == (char *)NULL)
X! 	  {
X! 	   /* no @ found - assume same user as on local system		*/
X! 	   host = source;
X! 	   ruser = (char *)NULL;
X! 	  }
X! 	else
X! 	  {
X! 	   *host++ = (char)0;
X! 	  }
X  	if (tape == 0) {
X  nohost:
X  		msg("need keyletter ``f'' and device ``host:tape''\n");
X--- 84,91 ----
X  		newtapebuf(NTREC > HIGHDENSITYTREC ? NTREC : HIGHDENSITYTREC);
X  	terminal = stdin;
X  #ifdef RRESTORE
X! 	host = source;
X! 	tape = index(host, ':');
X  	if (tape == 0) {
X  nohost:
X  		msg("need keyletter ``f'' and device ``host:tape''\n");
END-of-tape.diff
exit


--
==========================g89r4222@alpha.ru.ac.za============================
 Geoff Rehmet, Comp Sci Dept,    |#define DISCLAIMER These are my ramblings \
 Rhodes University, Grahamstown, |                   not the Univerisity's 
 RSA,