aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/sysinstall/tape.c
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1997-01-22 00:27:22 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1997-01-22 00:27:22 +0000
commit7e698f84f0c1ce17f08946e5b2053d07028f10b1 (patch)
tree03180f2b9a8914b9945c60726c475911a7a86342 /usr.sbin/sysinstall/tape.c
parent898f607a63d1c6494712143879dde3396e415252 (diff)
downloadsrc-7e698f84f0c1ce17f08946e5b2053d07028f10b1.tar.gz
src-7e698f84f0c1ce17f08946e5b2053d07028f10b1.zip
*groan*. I broke tape extraction with the same optimization.
Fix that too.
Notes
Notes: svn path=/head/; revision=21938
Diffstat (limited to 'usr.sbin/sysinstall/tape.c')
-rw-r--r--usr.sbin/sysinstall/tape.c60
1 files changed, 32 insertions, 28 deletions
diff --git a/usr.sbin/sysinstall/tape.c b/usr.sbin/sysinstall/tape.c
index 94bb6eace1ed..5f7587619d32 100644
--- a/usr.sbin/sysinstall/tape.c
+++ b/usr.sbin/sysinstall/tape.c
@@ -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;