]> git.wh0rd.org - dump.git/commitdiff
Added the device name and volume number as arguments to the end of tape script.
authorStelian Pop <stelian@popies.net>
Fri, 10 Mar 2000 10:03:09 +0000 (10:03 +0000)
committerStelian Pop <stelian@popies.net>
Fri, 10 Mar 2000 10:03:09 +0000 (10:03 +0000)
CHANGES
dump/dump.8.in
dump/tape.c

diff --git a/CHANGES b/CHANGES
index 005be8d9e49bef784f8ae92ee3fadff660fbc686..136f607a1c8f988017202231b6a072ce4730205d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,4 @@
-$Id: CHANGES,v 1.51 2000/03/09 13:12:31 stelian Exp $
+$Id: CHANGES,v 1.52 2000/03/10 10:03:09 stelian Exp $
 
 Changes between versions 0.4b15 and 0.4b16 (released ?????????????)
 ===================================================================
 
 Changes between versions 0.4b15 and 0.4b16 (released ?????????????)
 ===================================================================
@@ -23,6 +23,9 @@ Changes between versions 0.4b15 and 0.4b16 (released ?????????????)
        Thanks to Dejan Muhamedagic <dejan@quant-x.com> for the 
        patch.
 
        Thanks to Dejan Muhamedagic <dejan@quant-x.com> for the 
        patch.
 
+5.     Added the device name and the current volume number
+       as arguments to the end of tape script (dump -F option).
+
 Changes between versions 0.4b14 and 0.4b15 (released March 2, 2000)
 ===================================================================
 
 Changes between versions 0.4b14 and 0.4b15 (released March 2, 2000)
 ===================================================================
 
index 50c8fdea27d3d6210831607fdef213b3cba4c5a5..46121c1275dc5ff876dc0b361411c38cb6d886e7 100644 (file)
@@ -30,7 +30,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\"    $Id: dump.8.in,v 1.13 2000/03/02 12:07:36 stelian Exp $
+.\"    $Id: dump.8.in,v 1.14 2000/03/10 10:03:09 stelian Exp $
 .\"
 .Dd __DATE__
 .Dt DUMP 8
 .\"
 .Dd __DATE__
 .Dt DUMP 8
@@ -195,7 +195,9 @@ program is
 this can be overridden by the environment variable
 .Ev RMT .
 .It Fl F Ar script
 this can be overridden by the environment variable
 .Ev RMT .
 .It Fl F Ar script
-Run script at the end of each tape. The script must return 0 if 
+Run script at the end of each tape. The device name and the
+current volume number are passed on the command line.
+The script must return 0 if 
 .Nm
 should continue without asking the user to change the tape, 1 if 
 .Nm
 .Nm
 should continue without asking the user to change the tape, 1 if 
 .Nm
index aa8f7306edc5e408091c1b3e92fe472d7872df05..45828a52f742e782b48582be691317487a9e8070 100644 (file)
@@ -40,7 +40,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: tape.c,v 1.16 2000/03/02 12:07:36 stelian Exp $";
+       "$Id: tape.c,v 1.17 2000/03/10 10:03:09 stelian Exp $";
 #endif /* not lint */
 
 #ifdef __linux__
 #endif /* not lint */
 
 #ifdef __linux__
@@ -107,7 +107,7 @@ static      void enslave __P((void));
 static void flushtape __P((void));
 static void killall __P((void));
 static void rollforward __P((void));
 static void flushtape __P((void));
 static void killall __P((void));
 static void rollforward __P((void));
-static int system_command __P((const char *command));
+static int system_command __P((const char *, const char *, int));
 
 /*
  * Concurrent dump mods (Caltech) - disk block reading and tape writing
 
 /*
  * Concurrent dump mods (Caltech) - disk block reading and tape writing
@@ -410,8 +410,9 @@ flushtape(void)
  * Returns -1 if an error occured, the exit status of
  * the command on success.
  */
  * Returns -1 if an error occured, the exit status of
  * the command on success.
  */
-int system_command(const char *command) {
+int system_command(const char *command, const char *device, int volnum) {
        int pid, status;
        int pid, status;
+       char commandstr[4096];
 
        pid = fork();
        if (pid == -1) {
 
        pid = fork();
        if (pid == -1) {
@@ -421,7 +422,9 @@ int system_command(const char *command) {
        if (pid == 0) {
                setuid(getuid());
                setgid(getgid());
        if (pid == 0) {
                setuid(getuid());
                setgid(getgid());
-               execl("/bin/sh", "sh", "-c", command, NULL);
+               snprintf(commandstr, sizeof(commandstr), "%s %s %d", command, device, volnum);
+               commandstr[sizeof(commandstr) - 1] = '\0';
+               execl("/bin/sh", "sh", "-c", commandstr, NULL);
                perror("  DUMP: unable to execute shell");
                exit(-1);
        }
                perror("  DUMP: unable to execute shell");
                exit(-1);
        }
@@ -496,7 +499,7 @@ trewind(void)
                eot_code = 1;
                if (eot_script) {
                        msg("Launching %s\n", eot_script);
                eot_code = 1;
                if (eot_script) {
                        msg("Launching %s\n", eot_script);
-                       eot_code = system_command(eot_script);
+                       eot_code = system_command(eot_script, tape, tapeno);
                }
                if (eot_code != 0 && eot_code != 1) {
                        msg("Dump aborted by the end of tape script\n");
                }
                if (eot_code != 0 && eot_code != 1) {
                        msg("Dump aborted by the end of tape script\n");