Module Name:    src
Committed By:   snj
Date:           Fri Oct  9 21:11:32 UTC 2009

Modified Files:
        src/distrib/utils/sysinst: util.c

Log Message:
- Don't extract xetc to /, but rather in /.sysinst (like etc) so that we
  don't blow away existing config files.
- Wait until all sets have been unpacked to run postinstall.  Previously
  we ran it after extracting etc, which meant that /var/db/obsolete/ was
  not fully populated.


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/distrib/utils/sysinst/util.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/utils/sysinst/util.c
diff -u src/distrib/utils/sysinst/util.c:1.160 src/distrib/utils/sysinst/util.c:1.161
--- src/distrib/utils/sysinst/util.c:1.160	Thu Oct  8 06:41:43 2009
+++ src/distrib/utils/sysinst/util.c	Fri Oct  9 21:11:31 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.160 2009/10/08 06:41:43 snj Exp $	*/
+/*	$NetBSD: util.c,v 1.161 2009/10/09 21:11:31 snj Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -662,7 +662,7 @@
 
 	tarstats.nfound++;	
 	/* cd to the target root. */
-	if (update && dist->set == SET_ETC) {
+	if (update && (dist->set == SET_ETC || dist->set == SET_X11_ETC)) {
 		make_target_dir("/.sysinst");
 		target_chdir_or_die("/.sysinst");
 	} else
@@ -696,23 +696,6 @@
 		/* Plausibly we should unlink an empty xfer_dir as well */
 	}
 
-	if (update && dist->set == SET_ETC) {
-		int oldsendmail;
-		oldsendmail = run_program(RUN_DISPLAY | RUN_CHROOT |
-					  RUN_ERROR_OK | RUN_PROGRESS,
-					  "/usr/sbin/postinstall -s /.sysinst -d / check mailerconf");
-		if (oldsendmail == 1) {
-			msg_display(MSG_oldsendmail);
-			process_menu(MENU_yesno, NULL);
-			if (yesno) {
-				run_program(RUN_DISPLAY | RUN_CHROOT,
-					    "/usr/sbin/postinstall -s /.sysinst -d / fix mailerconf");
-			}
-		}
-		run_program(RUN_DISPLAY | RUN_CHROOT,
-			"/usr/sbin/postinstall -s /.sysinst -d / fix");
-	}
-
 	set_status[dist->set] |= SET_INSTALLED;
 	tarstats.nsuccess++;
 	return SET_OK;
@@ -829,6 +812,28 @@
 		msg_clear();
 	}
 
+	/*
+	 * postinstall needs to be run after extracting all sets, because
+	 * otherwise /var/db/obsolete will only have current information
+	 * from the base, comp, and etc sets.
+	 */
+	if (update && (set_status[SET_ETC] & SET_INSTALLED)) {
+		int oldsendmail;
+		oldsendmail = run_program(RUN_DISPLAY | RUN_CHROOT |
+					  RUN_ERROR_OK | RUN_PROGRESS,
+					  "/usr/sbin/postinstall -s /.sysinst -d / check mailerconf");
+		if (oldsendmail == 1) {
+			msg_display(MSG_oldsendmail);
+			process_menu(MENU_yesno, NULL);
+			if (yesno) {
+				run_program(RUN_DISPLAY | RUN_CHROOT,
+					    "/usr/sbin/postinstall -s /.sysinst -d / fix mailerconf");
+			}
+		}
+		run_program(RUN_DISPLAY | RUN_CHROOT,
+			"/usr/sbin/postinstall -s /.sysinst -d / fix");
+	}
+
 	/* Configure the system */
 	if (set_status[SET_BASE] & SET_INSTALLED)
 		run_makedev();

Reply via email to