Throw out all the crap to do with etc.old, instead install etc/tgz

into /.sysinst and use /etc/postinstall to do the merge.
This commit is contained in:
dsl 2004-04-18 21:34:56 +00:00
parent db6a0b431a
commit 5d2ed42cb6
5 changed files with 38 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: defs.h,v 1.111 2004/03/26 19:55:13 dsl Exp $ */
/* $NetBSD: defs.h,v 1.112 2004/04/18 21:34:56 dsl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -138,8 +138,9 @@ deconst(const void *p)
/* Types */
typedef struct distinfo {
const char *name;
int set;
uint set;
const char *desc;
const char *marker_file; /* set assumed installed if exists */
} distinfo;
typedef struct _partinfo {
@ -365,7 +366,7 @@ void cd_dist_dir(const char *);
void show_cur_distsets(void);
void make_ramdisk_dir(const char *);
void ask_verbose_dist(void);
int get_and_unpack_sets(msg, msg);
int get_and_unpack_sets(int, msg, msg);
int sanity_check(void);
int set_timezone(void);
int set_crypt_type(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: install.c,v 1.38 2003/09/27 10:47:17 dsl Exp $ */
/* $NetBSD: install.c,v 1.39 2004/04/18 21:34:56 dsl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -124,7 +124,7 @@ do_install(void)
wrefresh(stdscr);
/* Unpack the distribution. */
if (get_and_unpack_sets(MSG_extractcomplete, MSG_abortinst) != 0)
if (get_and_unpack_sets(0, MSG_extractcomplete, MSG_abortinst) != 0)
return;
set_timezone();

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.42 2003/10/19 20:17:31 dsl Exp $ */
/* $NetBSD: main.c,v 1.43 2004/04/18 21:34:56 dsl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -338,7 +338,9 @@ cleanup(void)
(void)time(&tloc);
#if 0
restore_etc();
#endif
/* Ensure we aren't inside the target tree */
chdir(getenv("HOME"));
unwind_mounts();

View File

@ -1,4 +1,4 @@
/* $NetBSD: upgrade.c,v 1.44 2003/12/28 05:30:47 christos Exp $ */
/* $NetBSD: upgrade.c,v 1.45 2004/04/18 21:34:56 dsl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -87,6 +87,7 @@ do_upgrade(void)
if (save_X())
return;
#if 0
/*
* Move target /etc -> target /etc.old so existing configuration
* isn't overwritten by upgrade.
@ -95,6 +96,7 @@ do_upgrade(void)
merge_X();
return;
}
#endif
/* Do any md updating of the file systems ... e.g. bootblocks,
copy file systems ... */
@ -109,17 +111,20 @@ do_upgrade(void)
wclear(stdscr);
wrefresh(stdscr);
if (get_and_unpack_sets(MSG_upgrcomplete, MSG_abortupgr) != 0)
if (get_and_unpack_sets(1, MSG_upgrcomplete, MSG_abortupgr) != 0)
return;
#if 0
/* Copy back any files we should restore after the upgrade.*/
if (sets_installed & SET_ETC)
merge_etc();
#endif
merge_X();
sanity_check();
}
#if 0
/*
* save target /etc files.
* if target /etc.old exists, print a warning message and give up.
@ -197,10 +202,11 @@ restore_etc(void)
tp = target_prefix();
run_program(0, "mv -f %s/etc.old/* %s/etc", tp, tp);
run_program(0, "rmdir %s/etc.old", tp);
/* rmdir isn't in our root, chroot and use the one in the target */
run_program(RUN_CHROOT, "rmdir /etc.old");
etc_saved = 0;
}
#endif
/*
* Save X symlink to X.old so it can be recovered later
@ -285,7 +291,7 @@ do_reinstall_sets(void)
return;
/* Unpack the distribution. */
if (get_and_unpack_sets(MSG_unpackcomplete, MSG_abortunpack) != 0)
if (get_and_unpack_sets(0, MSG_unpackcomplete, MSG_abortunpack) != 0)
return;
sanity_check();

View File

@ -1,4 +1,4 @@
/* $NetBSD: util.c,v 1.118 2004/04/18 20:42:19 dsl Exp $ */
/* $NetBSD: util.c,v 1.119 2004/04/18 21:34:56 dsl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -119,8 +119,8 @@ struct tarstats {
int nskipped;
} tarstats;
static int extract_file(char *path);
static int extract_dist(void);
static int extract_file(int, int, char *path);
static int extract_dist(int);
int distribution_sets_exist_p(const char *path);
static int check_for(unsigned int mode, const char *pathname);
@ -684,7 +684,7 @@ ask_verbose_dist(void)
}
static int
extract_file(char *path)
extract_file(int set, int update, char *path)
{
char *owd;
int tarexit;
@ -702,7 +702,11 @@ extract_file(char *path)
tarstats.nfound++;
/* cd to the target root. */
target_chdir_or_die("/");
if (update && set == SET_ETC) {
make_target_dir("/.sysinst");
target_chdir_or_die("/.sysinst");
} else
target_chdir_or_die("/");
/* now extract set files files into "./". */
if (verbose == 1)
@ -726,6 +730,11 @@ extract_file(char *path)
return yesno;
}
if (update && set == SET_ETC) {
run_program(RUN_DISPLAY | RUN_CHROOT,
"/etc/postinstall -s /.sysinst -d / fix");
}
tarstats.nsuccess++;
return 2;
}
@ -738,7 +747,7 @@ extract_file(char *path)
*/
static int
extract_dist(void)
extract_dist(int update)
{
char fname[STRSIZE];
distinfo *list;
@ -762,7 +771,7 @@ extract_dist(void)
ext_dir, list->name, dist_postfix);
/* if extraction failed and user aborted, punt. */
extracted = extract_file(fname);
extracted = extract_file(list->set, update, fname);
if (extracted == 2)
sets_installed |= list->set;
}
@ -792,7 +801,7 @@ extract_dist(void)
* success_msg and failure_msg must both be 0-adic messages.
*/
int
get_and_unpack_sets(msg success_msg, msg failure_msg)
get_and_unpack_sets(int update, msg success_msg, msg failure_msg)
{
int got_dist;
@ -823,7 +832,7 @@ get_and_unpack_sets(msg success_msg, msg failure_msg)
}
/* Extract the distribution, abort on errors. */
if (extract_dist())
if (extract_dist(update))
return 1;
/* Configure the system */