Source-Changes-HG archive

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

[src/trunk]: src/distrib/utils/sysinst/arch/i386 Handle existing /emul symlin...



details:   https://anonhg.NetBSD.org/src/rev/e122af8b2d79
branches:  trunk
changeset: 499128:e122af8b2d79
user:      fvdl <fvdl%NetBSD.org@localhost>
date:      Sun Nov 12 15:28:48 2000 +0000

description:
Handle existing /emul symlink better when it points to nothing; same
with /emul/aout. Prevents unexpected sudden exits because during
aout lib move in upgrade.

diffstat:

 distrib/utils/sysinst/arch/i386/md.c |  21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diffs (55 lines):

diff -r 79662ed38129 -r e122af8b2d79 distrib/utils/sysinst/arch/i386/md.c
--- a/distrib/utils/sysinst/arch/i386/md.c      Sun Nov 12 07:58:36 2000 +0000
+++ b/distrib/utils/sysinst/arch/i386/md.c      Sun Nov 12 15:28:48 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.47 2000/11/07 01:14:22 fvdl Exp $ */
+/*     $NetBSD: md.c,v 1.48 2000/11/12 15:28:48 fvdl Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -787,7 +787,7 @@
 static int
 move_aout_libs()
 {
-       int n;
+       int n, backedup = 0;
        char prefix[MAXPATHLEN], src[MAXPATHLEN];
        struct stat st;
 
@@ -807,6 +807,11 @@
         */
        if (target_realpath("/emul", prefix) == NULL || stat(prefix, &st) < 0) {
                strcpy(prefix, target_expand("/emul"));
+               if (lstat(prefix, &st) == 0) {
+                       run_prog(0, NULL, "mv -f %s %s", prefix,
+                           target_expand("/emul.old"));
+                       backedup = 1;
+               }
                if (scripting)
                        fprintf(script, "mkdir %s\n", prefix);
                mkdir(prefix, 0755);
@@ -821,8 +826,11 @@
         * move it out of the way.
         */
        strcpy(src, concat_paths(prefix, "aout"));
-       run_prog(0, NULL, "mv -f %s %s", src,
-           concat_paths(prefix, "aout.old"));
+       if (lstat(src, &st) == 0) {
+               run_prog(0, NULL, "mv -f %s %s", src,
+                   concat_paths(prefix, "aout.old"));
+               backedup = 1;
+       }
 
        /*
         * We have created /emul if needed. Since no previous /emul/aout
@@ -869,5 +877,10 @@
        strcpy(src, target_expand("/usr/X11R6/lib"));
        handle_aout_x_libs(src, concat_paths(prefix, "usr/X11R6/lib"));
 
+       if (backedup) {
+               msg_display(MSG_emulbackup);
+               process_menu(MENU_ok);
+       }
+
        return n;
 }



Home | Main Index | Thread Index | Old Index