Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib/utils/sysinst Throw out all the crap to do with etc....



details:   https://anonhg.NetBSD.org/src/rev/2ff105d086f5
branches:  trunk
changeset: 565719:2ff105d086f5
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sun Apr 18 21:34:56 2004 +0000

description:
Throw out all the crap to do with etc.old, instead install etc/tgz
into /.sysinst and use /etc/postinstall to do the merge.

diffstat:

 distrib/utils/sysinst/defs.h    |   7 ++++---
 distrib/utils/sysinst/install.c |   4 ++--
 distrib/utils/sysinst/main.c    |   4 +++-
 distrib/utils/sysinst/upgrade.c |  16 +++++++++++-----
 distrib/utils/sysinst/util.c    |  27 ++++++++++++++++++---------
 5 files changed, 38 insertions(+), 20 deletions(-)

diffs (226 lines):

diff -r a122ad8a0d55 -r 2ff105d086f5 distrib/utils/sysinst/defs.h
--- a/distrib/utils/sysinst/defs.h      Sun Apr 18 21:00:35 2004 +0000
+++ b/distrib/utils/sysinst/defs.h      Sun Apr 18 21:34:56 2004 +0000
@@ -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 @@
 /* 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   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);
diff -r a122ad8a0d55 -r 2ff105d086f5 distrib/utils/sysinst/install.c
--- a/distrib/utils/sysinst/install.c   Sun Apr 18 21:00:35 2004 +0000
+++ b/distrib/utils/sysinst/install.c   Sun Apr 18 21:34:56 2004 +0000
@@ -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 @@
        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();
diff -r a122ad8a0d55 -r 2ff105d086f5 distrib/utils/sysinst/main.c
--- a/distrib/utils/sysinst/main.c      Sun Apr 18 21:00:35 2004 +0000
+++ b/distrib/utils/sysinst/main.c      Sun Apr 18 21:34:56 2004 +0000
@@ -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 @@
 
        (void)time(&tloc);
 
+#if 0
        restore_etc();
+#endif
        /* Ensure we aren't inside the target tree */
        chdir(getenv("HOME"));
        unwind_mounts();
diff -r a122ad8a0d55 -r 2ff105d086f5 distrib/utils/sysinst/upgrade.c
--- a/distrib/utils/sysinst/upgrade.c   Sun Apr 18 21:00:35 2004 +0000
+++ b/distrib/utils/sysinst/upgrade.c   Sun Apr 18 21:34:56 2004 +0000
@@ -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 @@
        if (save_X())
                return;
 
+#if 0
        /*
         * Move target /etc -> target /etc.old so existing configuration
         * isn't overwritten by upgrade.
@@ -95,6 +96,7 @@
                merge_X();
                return;
        }
+#endif
 
        /* Do any md updating of the file systems ... e.g. bootblocks,
           copy file systems ... */
@@ -109,17 +111,20 @@
        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 @@
 
        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 @@
                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();
diff -r a122ad8a0d55 -r 2ff105d086f5 distrib/utils/sysinst/util.c
--- a/distrib/utils/sysinst/util.c      Sun Apr 18 21:00:35 2004 +0000
+++ b/distrib/utils/sysinst/util.c      Sun Apr 18 21:34:56 2004 +0000
@@ -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 @@
        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 @@
 }
 
 static int
-extract_file(char *path)
+extract_file(int set, int update, char *path)
 {
        char *owd;
        int   tarexit;
@@ -702,7 +702,11 @@
 
        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 @@
                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 @@
  */
 
 static int
-extract_dist(void)
+extract_dist(int update)
 {
        char fname[STRSIZE];
        distinfo *list;
@@ -762,7 +771,7 @@
                    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 @@
  * 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 @@
        }
 
        /* Extract the distribution, abort on errors. */
-       if (extract_dist())
+       if (extract_dist(update))
                return 1;
 
        /* Configure the system */



Home | Main Index | Thread Index | Old Index