Source-Changes-HG archive

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

[src/netbsd-1-5]: src/distrib/utils/sysinst Pull up to netbsd-1-5 branch, OK'...



details:   https://anonhg.NetBSD.org/src/rev/bd8af27a502f
branches:  netbsd-1-5
changeset: 489418:bd8af27a502f
user:      hubertf <hubertf%NetBSD.org@localhost>
date:      Fri Sep 08 23:57:19 2000 +0000

description:
Pull up to netbsd-1-5 branch, OK'd by thorpej:

Revisions:
 > cvs rdiff -r1.55 -r1.56 basesrc/distrib/utils/sysinst/defs.h
 > cvs rdiff -r1.65 -r1.66 basesrc/distrib/utils/sysinst/msg.mi.en
 > cvs rdiff -r1.22 -r1.23 basesrc/distrib/utils/sysinst/target.c
 > cvs rdiff -r1.20 -r1.21 basesrc/distrib/utils/sysinst/upgrade.c

Log message:
 > When upgrading and /usr/X11R6/bin/X is a symlink, move it aside (X.old)
 > before extracting sets, and move it back afterwards, to save the information
 > which X server to use.
 >
 > Adresses PR 10935 by Dan McMahill <dmcmahill%netbsd.org@localhost>

diffstat:

 distrib/utils/sysinst/defs.h    |   3 +-
 distrib/utils/sysinst/msg.mi.en |  16 +++++++++++-
 distrib/utils/sysinst/target.c  |  23 +++++++++++++++--
 distrib/utils/sysinst/upgrade.c |  53 ++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 89 insertions(+), 6 deletions(-)

diffs (203 lines):

diff -r 60ae362c4052 -r bd8af27a502f distrib/utils/sysinst/defs.h
--- a/distrib/utils/sysinst/defs.h      Fri Sep 08 14:30:34 2000 +0000
+++ b/distrib/utils/sysinst/defs.h      Fri Sep 08 23:57:19 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.53.2.1 2000/08/15 02:12:52 hubertf Exp $    */
+/*     $NetBSD: defs.h,v 1.53.2.2 2000/09/08 23:57:19 hubertf Exp $    */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -348,5 +348,6 @@
 int    target_test __P((const char*, const char*));
 int    target_dir_exists_p __P((const char *path));
 int    target_file_exists_p __P((const char *path));
+int    target_symlink_exists_p __P((const char *path));
 void   unwind_mounts __P((void));
 
diff -r 60ae362c4052 -r bd8af27a502f distrib/utils/sysinst/msg.mi.en
--- a/distrib/utils/sysinst/msg.mi.en   Fri Sep 08 14:30:34 2000 +0000
+++ b/distrib/utils/sysinst/msg.mi.en   Fri Sep 08 23:57:19 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg.mi.en,v 1.62.2.3 2000/08/15 02:12:53 hubertf Exp $ */
+/*     $NetBSD: msg.mi.en,v 1.62.2.4 2000/09/08 23:57:19 hubertf Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -625,6 +625,20 @@
 
 Aborting upgrade.}
 
+message X_oldexists
+{I cannot save /usr/X11R6/bin/X as /usr/X11R6/bin/X.old, because the
+target disk already has an /usr/X11R6/bin/X.old. Please fix this before
+continuing.
+
+One way is to start a shell from the Utilities menu, examine the
+target /usr/X11R6/bin/X and /usr/X11R6/bin/X.old.  If
+/usr/X11R6/bin/X.old is from a completed upgrade, you can rm -f
+/usr/X11R6/bin/X.old and restart.  Or if /usr/X11R6/bin/X.old is from
+a recent, incomplete upgrade, you can rm -f /usr/X11R6/bin/X and mv
+/usr/X11R6/bin/X.old to /usr/X11R6/bin/X.
+
+Aborting upgrade.}
+
 message netnotup
 {There was a problem in setting up the network.  Either your gateway
 or your nameserver was not reachable by a ping.  Do you want to
diff -r 60ae362c4052 -r bd8af27a502f distrib/utils/sysinst/target.c
--- a/distrib/utils/sysinst/target.c    Fri Sep 08 14:30:34 2000 +0000
+++ b/distrib/utils/sysinst/target.c    Fri Sep 08 23:57:19 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: target.c,v 1.22 1999/06/20 06:08:15 cgd Exp $  */
+/*     $NetBSD: target.c,v 1.22.10.1 2000/09/08 23:57:19 hubertf Exp $ */
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: target.c,v 1.22 1999/06/20 06:08:15 cgd Exp $");
+__RCSID("$NetBSD: target.c,v 1.22.10.1 2000/09/08 23:57:19 hubertf Exp $");
 #endif
 
 /*
@@ -78,6 +78,7 @@
 int    target_test(const char *test, const char *path);
 int    target_test_dir __P((const char *path));        /* deprecated */
 int    target_test_file __P((const char *path));       /* deprecated */
+int    target_test_symlink __P((const char *path));    /* deprecated */
 
 void backtowin(void);
 
@@ -541,7 +542,8 @@
 /*
  * Do a mv where both pathnames are  within the target filesystem.
  */
-void mv_within_target_or_die(frompath, topath)
+void
+mv_within_target_or_die(frompath, topath)
        const char *frompath;
        const char *topath;
 {
@@ -724,6 +726,14 @@
        return target_test("-f", path);
 }
 
+int
+target_test_symlink(path)
+       const char *path;
+{
+
+       return target_test("-h", path);
+}
+
 int target_file_exists_p(path)
        const char *path;
 {
@@ -737,3 +747,10 @@
 
        return (target_test_dir(path) == 0);
 }
+
+int target_symlink_exists_p(path)
+       const char *path;
+{
+
+       return (target_test_symlink(path) == 0);
+}
diff -r 60ae362c4052 -r bd8af27a502f distrib/utils/sysinst/upgrade.c
--- a/distrib/utils/sysinst/upgrade.c   Fri Sep 08 14:30:34 2000 +0000
+++ b/distrib/utils/sysinst/upgrade.c   Fri Sep 08 23:57:19 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: upgrade.c,v 1.20 1999/06/22 06:57:01 cgd Exp $ */
+/*     $NetBSD: upgrade.c,v 1.20.10.1 2000/09/08 23:57:20 hubertf Exp $        */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -51,6 +51,8 @@
 void   check_prereqs __P((void));
 int    save_etc __P((void));
 int    merge_etc __P((void));
+int    save_X __P((void));
+int    merge_X __P((void));
 
 /*
  * Do the system upgrade.
@@ -88,6 +90,11 @@
        if (save_etc())
                return;
 
+       /*
+        * Save X symlink, ...
+        */
+       if (save_X())
+               return;
 
        /* Do any md updating of the file systems ... e.g. bootblocks,
           copy file systems ... */
@@ -106,6 +113,7 @@
 
        /* Copy back any files we should restore after the upgrade.*/
        merge_etc();
+       merge_X();
 
        sanity_check();
 }
@@ -169,6 +177,32 @@
 }
 
 /*
+ * Save X symlink to X.old so it can be recovered later
+ */
+int
+save_X()
+{
+       /* Only care for X if it's a symlink */
+       if (target_symlink_exists_p("/usr/X11R6/bin/X")) {
+               if (target_symlink_exists_p("/usr/X11R6/bin/X.old")) {
+                       msg_display(MSG_X_oldexists);
+                       process_menu(MENU_ok);
+                       return EEXIST;
+               }
+
+#ifdef DEBUG
+               printf("saving /usr/X11R6/bin/X as .../X.old ...");
+#endif
+
+               /* Move target .../X to .../X.old.  Abort on error. */
+               mv_within_target_or_die("/usr/X11R6/bin/X",
+                                       "/usr/X11R6/bin/X.old");
+       }
+
+       return 0;
+}
+
+/*
  * Merge back saved target /etc files after unpacking the new
  * sets has completed.
  */
@@ -183,6 +217,23 @@
 }
 
 /*
+ * Merge back saved target X files after unpacking the new
+ * sets has completed.
+ */
+int
+merge_X()
+{
+       if (target_symlink_exists_p("/usr/X11R6/bin/X.old")) {
+               /* Only move back X if it's a symlink - we don't want
+                * to restore old binaries */
+               mv_within_target_or_die("/usr/X11R6/bin/X.old",
+                                       "/usr/X11R6/bin/X");
+       }
+
+       return 0;       
+}
+
+/*
  * Unpacks sets,  clobbering existintg contents.
  */
 void



Home | Main Index | Thread Index | Old Index