Remember which sets we sucessfully installed (so we know when to

restore /etc).
Improve handling of absent directories in get_via_localdir.
distname[] isn't needed (twice)
This commit is contained in:
dsl 2003-07-18 09:49:18 +00:00
parent da36837548
commit 0bf9a036c9
1 changed files with 23 additions and 27 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: util.c,v 1.103 2003/07/10 13:36:48 dsl Exp $ */
/* $NetBSD: util.c,v 1.104 2003/07/18 09:49:18 dsl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -134,6 +134,7 @@ static int check_for (unsigned int mode, const char *pathname);
unsigned int sets_valid = MD_SETS_VALID;
unsigned int sets_selected = (MD_SETS_SELECTED) & (MD_SETS_VALID);
unsigned int sets_installed = 0;
int
@ -238,7 +239,6 @@ run_makedev(void)
int
get_via_floppy(void)
{
char distname[STRSIZE];
char fddev[STRSIZE] = "/dev/fd0a";
char fname[STRSIZE];
char full_name[STRSIZE];
@ -260,8 +260,6 @@ get_via_floppy(void)
continue;
}
strcpy(post, ".aa");
snprintf(distname, sizeof distname, "%s%s",
list->name, dist_postfix);
while (sets_selected & list->set) {
snprintf(fname, sizeof fname, "%s%s", list->name, post);
snprintf(full_name, sizeof full_name, "/mnt2/%s",
@ -292,8 +290,8 @@ get_via_floppy(void)
mounted = 1;
first = 0;
}
sprintf(catcmd, "/bin/cat %s >> %s",
full_name, distname);
sprintf(catcmd, "/bin/cat %s >> %s%s",
full_name, list->name, dist_postfix);
if (logging)
(void)fprintf(logfp, "%s\n", catcmd);
if (scripting)
@ -424,8 +422,7 @@ get_via_localdir(void)
again:
/* Complain if not a directory */
if (dir_exists_p(localfs_dir) == 0) {
msg_display(MSG_badlocalsetdir, localfs_dir);
msg_display_add(MSG_badlocalsetdir, localfs_dir);
process_menu(MENU_localdirbad, NULL);
if (!yesno)
return (0);
@ -435,7 +432,7 @@ again:
/* Verify distribution files exist. */
if (distribution_sets_exist_p(localfs_dir) == 0) {
msg_display(MSG_badsetdir, localfs_dir);
msg_display_add(MSG_badsetdir, localfs_dir);
process_menu(MENU_localdirbad, NULL);
if (!yesno)
return (0);
@ -749,7 +746,6 @@ extract_file(char *path)
int
extract_dist(void)
{
char distname[STRSIZE];
char fname[STRSIZE];
distinfo *list;
int punt;
@ -773,13 +769,13 @@ extract_dist(void)
process_menu(MENU_ok, NULL);
}
#endif
(void)snprintf(distname, sizeof distname, "%s%s",
list->name, dist_postfix);
(void)snprintf(fname, sizeof fname, "%s/%s",
ext_dir, distname);
(void)snprintf(fname, sizeof fname, "%s/%s%s",
ext_dir, list->name, dist_postfix);
/* if extraction failed and user aborted, punt. */
punt = extract_file(fname);
if (!punt)
sets_installed |= list->set;
}
}