1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

*groan*. I broke tape extraction with the same optimization.

Fix that too.
This commit is contained in:
Jordan K. Hubbard 1997-01-22 00:27:22 +00:00
parent 898f607a63
commit 7e698f84f0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=21938
2 changed files with 64 additions and 56 deletions

View File

@ -53,32 +53,10 @@ mediaTapeBlocksize(void)
Boolean
mediaInitTape(Device *dev)
{
int i;
if (tapeInitted)
return TRUE;
msgDebug("Tape init routine called for %s (private dir is %s)\n", dev->name, dev->private);
Mkdir(dev->private);
if (chdir(dev->private)) {
msgConfirm("Unable to CD to %s before extracting tape!\n"
"Tape media not selected.", dev->private);
return FALSE;
}
/* We know the tape is already in the drive, so go for it */
msgNotify("Extracting distributions from %s...", dev->description);
if (!strcmp(dev->name, "rft0"))
i = vsystem("ft | cpio -idum %s --block-size %s", cpioVerbosity(), mediaTapeBlocksize());
else
i = vsystem("cpio -idum %s --block-size %s -I %s", cpioVerbosity(), mediaTapeBlocksize(), dev->devname);
if (!i) {
tapeInitted = TRUE;
msgDebug("Tape initialized successfully.\n");
return TRUE;
}
else
msgConfirm("Tape extract command failed with status %d!\n"
"Unable to use tape media.", i);
return FALSE;
/* This is REALLY gross, but we need to do the init later in get due to the fact
* that media is initialized BEFORE a filesystem is mounted now.
*/
return TRUE;
}
FILE *
@ -87,6 +65,33 @@ mediaGetTape(Device *dev, char *file, Boolean probe)
char buf[PATH_MAX];
FILE *fp;
int i;
if (!tapeInitted) {
msgDebug("Tape init routine called for %s (private dir is %s)\n", dev->name, dev->private);
Mkdir(dev->private);
if (chdir(dev->private)) {
msgConfirm("Unable to CD to %s before extracting tape!\n"
"Tape media is not selected and thus cannot be installed from.", dev->private);
return (FILE *)IO_ERROR;
}
/* We know the tape is already in the drive, so go for it */
msgNotify("First extracting distributions from %s...", dev->description);
if (!strcmp(dev->name, "rft0"))
i = vsystem("ft | cpio -idum %s --block-size %s", cpioVerbosity(), mediaTapeBlocksize());
else
i = vsystem("cpio -idum %s --block-size %s -I %s", cpioVerbosity(), mediaTapeBlocksize(), dev->devname);
if (!i) {
tapeInitted = TRUE;
msgDebug("Tape initialized successfully.\n");
}
else {
msgConfirm("Tape extract command failed with status %d!\n"
"Unable to use tape media.", i);
return (FILE *)IO_ERROR;
}
}
sprintf(buf, "%s/%s", (char *)dev->private, file);
if (isDebug())
msgDebug("Request for %s from tape (looking in %s)\n", file, buf);
@ -107,9 +112,8 @@ mediaShutdownTape(Device *dev)
{
if (!tapeInitted)
return;
msgDebug("Shutdown of tape device - %s will be cleaned\n", dev->private);
if (file_readable(dev->private)) {
msgNotify("Cleaning up results of tape extract..");
msgNotify("Cleaning up results of tape extract in %s..", dev->private);
(void)vsystem("rm -rf %s", (char *)dev->private);
}
tapeInitted = FALSE;

View File

@ -53,32 +53,10 @@ mediaTapeBlocksize(void)
Boolean
mediaInitTape(Device *dev)
{
int i;
if (tapeInitted)
return TRUE;
msgDebug("Tape init routine called for %s (private dir is %s)\n", dev->name, dev->private);
Mkdir(dev->private);
if (chdir(dev->private)) {
msgConfirm("Unable to CD to %s before extracting tape!\n"
"Tape media not selected.", dev->private);
return FALSE;
}
/* We know the tape is already in the drive, so go for it */
msgNotify("Extracting distributions from %s...", dev->description);
if (!strcmp(dev->name, "rft0"))
i = vsystem("ft | cpio -idum %s --block-size %s", cpioVerbosity(), mediaTapeBlocksize());
else
i = vsystem("cpio -idum %s --block-size %s -I %s", cpioVerbosity(), mediaTapeBlocksize(), dev->devname);
if (!i) {
tapeInitted = TRUE;
msgDebug("Tape initialized successfully.\n");
return TRUE;
}
else
msgConfirm("Tape extract command failed with status %d!\n"
"Unable to use tape media.", i);
return FALSE;
/* This is REALLY gross, but we need to do the init later in get due to the fact
* that media is initialized BEFORE a filesystem is mounted now.
*/
return TRUE;
}
FILE *
@ -87,6 +65,33 @@ mediaGetTape(Device *dev, char *file, Boolean probe)
char buf[PATH_MAX];
FILE *fp;
int i;
if (!tapeInitted) {
msgDebug("Tape init routine called for %s (private dir is %s)\n", dev->name, dev->private);
Mkdir(dev->private);
if (chdir(dev->private)) {
msgConfirm("Unable to CD to %s before extracting tape!\n"
"Tape media is not selected and thus cannot be installed from.", dev->private);
return (FILE *)IO_ERROR;
}
/* We know the tape is already in the drive, so go for it */
msgNotify("First extracting distributions from %s...", dev->description);
if (!strcmp(dev->name, "rft0"))
i = vsystem("ft | cpio -idum %s --block-size %s", cpioVerbosity(), mediaTapeBlocksize());
else
i = vsystem("cpio -idum %s --block-size %s -I %s", cpioVerbosity(), mediaTapeBlocksize(), dev->devname);
if (!i) {
tapeInitted = TRUE;
msgDebug("Tape initialized successfully.\n");
}
else {
msgConfirm("Tape extract command failed with status %d!\n"
"Unable to use tape media.", i);
return (FILE *)IO_ERROR;
}
}
sprintf(buf, "%s/%s", (char *)dev->private, file);
if (isDebug())
msgDebug("Request for %s from tape (looking in %s)\n", file, buf);
@ -107,9 +112,8 @@ mediaShutdownTape(Device *dev)
{
if (!tapeInitted)
return;
msgDebug("Shutdown of tape device - %s will be cleaned\n", dev->private);
if (file_readable(dev->private)) {
msgNotify("Cleaning up results of tape extract..");
msgNotify("Cleaning up results of tape extract in %s..", dev->private);
(void)vsystem("rm -rf %s", (char *)dev->private);
}
tapeInitted = FALSE;