Clear up confusion of extract_dist() extract directory source. New var

ext_dir that is absolute directory name of where files are located to
extract.  All setup routines must set that directory name correctly.
Make target.c compile if DEBUG is set.
This commit is contained in:
phil 1997-11-11 00:43:31 +00:00
parent b85d82744a
commit 4ec8d82726
5 changed files with 40 additions and 24 deletions

View File

@ -77,3 +77,5 @@ Things to do ....
-- symlinks for /tmp (/tmp -> /var/tmp or some such) -- symlinks for /tmp (/tmp -> /var/tmp or some such)
Or configure tmp on mfs. Or configure tmp on mfs.
-- Add support for SLIP (for pc532) and/or PPP.

View File

@ -1,4 +1,4 @@
/* $NetBSD: defs.h,v 1.20 1997/11/09 12:47:06 jonathan Exp $ */ /* $NetBSD: defs.h,v 1.21 1997/11/11 00:43:36 phil Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -149,8 +149,11 @@ EXTERN int fake_sel;
/* other vars for menu communication */ /* other vars for menu communication */
EXTERN int nodist; EXTERN int nodist;
EXTERN int got_dist; EXTERN int got_dist;
EXTERN char dist_dir[STRSIZE] INIT("/usr/INSTALL"); /* Relative file name for storing a distribution. */
EXTERN char dist_dir[STRSIZE] INIT("/usr/INSTALL");
EXTERN int clean_dist_dir INIT(0); EXTERN int clean_dist_dir INIT(0);
/* Absolute path name where the distribution should be extracted from. */
EXTERN char ext_dir[STRSIZE] INIT("");
EXTERN char ftp_host[STRSIZE] INIT("ftp.netbsd.org"); EXTERN char ftp_host[STRSIZE] INIT("ftp.netbsd.org");
EXTERN char ftp_dir[STRSIZE] INIT("/pub/NetBSD/NetBSD-"); EXTERN char ftp_dir[STRSIZE] INIT("/pub/NetBSD/NetBSD-");
EXTERN char ftp_user[STRSIZE] INIT("ftp"); EXTERN char ftp_user[STRSIZE] INIT("ftp");
@ -164,7 +167,7 @@ EXTERN char cdrom_dir[STRSIZE] INIT("/Release/NetBSD/NetBSD-");
EXTERN char localfs_dev[SSTRSIZE] INIT("sd0"); EXTERN char localfs_dev[SSTRSIZE] INIT("sd0");
EXTERN char localfs_fs[SSTRSIZE] INIT("ffs"); EXTERN char localfs_fs[SSTRSIZE] INIT("ffs");
EXTERN char localfs_dir[STRSIZE] INIT("/Release/NetBSD/NetBSD-" REL "/" MACH); EXTERN char localfs_dir[STRSIZE] INIT("");
EXTERN int mnt2_mounted INIT(0); EXTERN int mnt2_mounted INIT(0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: net.c,v 1.17 1997/11/09 15:54:17 phil Exp $ */ /* $NetBSD: net.c,v 1.18 1997/11/11 00:43:41 phil Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -232,6 +232,7 @@ get_via_ftp (void)
endwin(); endwin();
} else } else
list++; list++;
} }
puts (CL); /* Just to make sure. */ puts (CL); /* Just to make sure. */
wrefresh (stdscr); wrefresh (stdscr);
@ -263,7 +264,7 @@ get_via_nfs(void)
} }
/* return location, don't clean... */ /* return location, don't clean... */
strcpy (dist_dir, "/mnt2"); strcpy (ext_dir, "/mnt2");
clean_dist_dir = 0; clean_dist_dir = 0;
mnt2_mounted = 1; mnt2_mounted = 1;
return 1; return 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: target.c,v 1.8 1997/11/09 12:47:09 jonathan Exp $ */ /* $NetBSD: target.c,v 1.9 1997/11/11 00:43:47 phil Exp $ */
/* /*
* Copyright 1997 Jonathan Stone * Copyright 1997 Jonathan Stone
@ -37,7 +37,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: target.c,v 1.8 1997/11/09 12:47:09 jonathan Exp $"); __RCSID("$NetBSD: target.c,v 1.9 1997/11/11 00:43:47 phil Exp $");
#endif #endif
@ -426,8 +426,9 @@ trunc_target_file(const char *path)
static int do_target_chdir(const char *dir, int must_succeed) static int do_target_chdir(const char *dir, int must_succeed)
{ {
const char *tgt_dir; const char *tgt_dir;
int error = 0; int error;
error = 0;
tgt_dir = target_expand(dir); tgt_dir = target_expand(dir);
#ifndef DEBUG #ifndef DEBUG

View File

@ -1,4 +1,4 @@
/* $NetBSD: util.c,v 1.18 1997/11/06 09:02:37 jonathan Exp $ */ /* $NetBSD: util.c,v 1.19 1997/11/11 00:43:51 phil Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -123,7 +123,7 @@ void run_makedev (void)
} }
/* Load files from floppy. */ /* Load files from floppy. Requires a /mnt2 directory for mounting them. */
int get_via_floppy (void) int get_via_floppy (void)
{ {
char distname[STRSIZE]; char distname[STRSIZE];
@ -195,9 +195,9 @@ get_via_cdrom(void)
process_menu (MENU_cdromsource); process_menu (MENU_cdromsource);
/* Fill in final default path. */ /* Fill in final default path. */
strncat (ftp_dir, rels, STRSIZE-strlen(ftp_dir)); strncat (cdrom_dir, rels, STRSIZE-strlen(cdrom_dir));
strcat (ftp_dir, "/"); strcat (cdrom_dir, "/");
strncat (ftp_dir, machine, STRSIZE-strlen(ftp_dir)); strncat (cdrom_dir, machine, STRSIZE-strlen(cdrom_dir));
/* Mount it */ /* Mount it */
while (run_prog ("/sbin/mount -rt cd9660 /dev/%sa /mnt2", cdrom_dev)) { while (run_prog ("/sbin/mount -rt cd9660 /dev/%sa /mnt2", cdrom_dev)) {
@ -208,8 +208,8 @@ get_via_cdrom(void)
} }
/* return location, don't clean... */ /* return location, don't clean... */
strcpy (dist_dir, "/mnt2"); strcpy (ext_dir, "/mnt2");
strncat (dist_dir, cdrom_dir, STRSIZE-strlen(dist_dir)-1); strncat (ext_dir, cdrom_dir, STRSIZE-strlen(ext_dir)-1);
clean_dist_dir = 0; clean_dist_dir = 0;
mnt2_mounted = 1; mnt2_mounted = 1;
return 1; return 1;
@ -231,8 +231,8 @@ get_via_localfs(void)
} }
/* return location, don't clean... */ /* return location, don't clean... */
strcpy (dist_dir, "/mnt2"); strcpy (ext_dir, "/mnt2");
strncat (dist_dir, localfs_dir, STRSIZE-strlen(dist_dir)-1); strncat (ext_dir, localfs_dir, STRSIZE-strlen(ext_dir)-1);
clean_dist_dir = 0; clean_dist_dir = 0;
mnt2_mounted = 1; mnt2_mounted = 1;
return 1; return 1;
@ -240,6 +240,8 @@ get_via_localfs(void)
void cd_dist_dir (char *forwhat) void cd_dist_dir (char *forwhat)
{ {
char *cwd;
/* ask user for the mountpoint. */ /* ask user for the mountpoint. */
msg_prompt (MSG_distdir, dist_dir, dist_dir, STRSIZE, forwhat); msg_prompt (MSG_distdir, dist_dir, dist_dir, STRSIZE, forwhat);
@ -248,6 +250,11 @@ void cd_dist_dir (char *forwhat)
clean_dist_dir = 1; clean_dist_dir = 1;
target_chdir_or_die(dist_dir); target_chdir_or_die(dist_dir);
/* Set ext_dir for absolute path. */
cwd = getcwd (NULL,0);
strncpy (ext_dir, cwd, STRSIZE);
free (cwd);
} }
@ -308,16 +315,18 @@ extract_file (char *path)
free (owd); free (owd);
} }
/* Extract_dist **REQUIRES** an absolute path in ext_dir. Any code
* that sets up dist_dir for use by extract_dist needs to put in the
* full path name to the directory.
*/
void void
extract_dist (void) extract_dist (void)
{ {
char distname[STRSIZE]; char distname[STRSIZE];
char fname[STRSIZE]; char fname[STRSIZE];
distinfo *list; distinfo *list;
char extdir[STRSIZE];
/* For NFS, distdir is mounted in the _current_ root. */
strncpy(extdir, dist_dir, STRSIZE);
endwin(); endwin();
list = dist_list; list = dist_list;
@ -325,7 +334,7 @@ extract_dist (void)
if (list->getit) { if (list->getit) {
(void)snprintf (distname, STRSIZE, list->name, rels, (void)snprintf (distname, STRSIZE, list->name, rels,
dist_postfix); dist_postfix);
(void)snprintf (fname, STRSIZE, "%s/%s", extdir, (void)snprintf (fname, STRSIZE, "%s/%s", ext_dir,
distname); distname);
extract_file (fname); extract_file (fname);
} }
@ -361,9 +370,9 @@ void get_and_unpack_sets(int success_msg, int failure_msg)
/* Other configuration. */ /* Other configuration. */
mnt_net_config(); mnt_net_config();
/* Clean up ... */ /* Clean up dist dir (use absolute path name) */
if (clean_dist_dir) if (clean_dist_dir)
run_prog ("/bin/rm -rf %s", dist_dir); run_prog ("/bin/rm -rf %s", ext_dir);
/* Mounted dist dir? */ /* Mounted dist dir? */
if (mnt2_mounted) if (mnt2_mounted)