Source-Changes-HG archive

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

[src/trunk]: src/distrib/utils/sysinst Force localfs_dir to be an absolute pa...



details:   https://anonhg.NetBSD.org/src/rev/8c5bf1908fc5
branches:  trunk
changeset: 549988:8c5bf1908fc5
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sun Jul 27 08:57:27 2003 +0000

description:
Force localfs_dir to be an absolute path - fixes PR install/14130.
Put disklabel info into /tmp/disktab in case / isn't writable,
fixes PR 17347.  Note the /etc/disktab isn't the target /etc anyway...

diffstat:

 distrib/utils/sysinst/disks.c        |   4 ++--
 distrib/utils/sysinst/savenewlabel.c |  10 +++-------
 distrib/utils/sysinst/util.c         |  18 ++++++++++++++----
 3 files changed, 19 insertions(+), 13 deletions(-)

diffs (89 lines):

diff -r a43f9a444dbb -r 8c5bf1908fc5 distrib/utils/sysinst/disks.c
--- a/distrib/utils/sysinst/disks.c     Sun Jul 27 07:56:37 2003 +0000
+++ b/distrib/utils/sysinst/disks.c     Sun Jul 27 08:57:27 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disks.c,v 1.66 2003/07/27 07:45:08 dsl Exp $ */
+/*     $NetBSD: disks.c,v 1.67 2003/07/27 08:57:27 dsl Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -263,7 +263,7 @@
 #ifdef DISKLABEL_CMD
        /* disklabel the disk */
        return run_prog(RUN_DISPLAY, MSG_cmdfail,
-           "%s %s %s", DISKLABEL_CMD, diskdev, bsddiskname);
+           "%s -f /tmp/disktab %s %s", DISKLABEL_CMD, diskdev, bsddiskname);
 #else
        return 0;
 #endif
diff -r a43f9a444dbb -r 8c5bf1908fc5 distrib/utils/sysinst/savenewlabel.c
--- a/distrib/utils/sysinst/savenewlabel.c      Sun Jul 27 07:56:37 2003 +0000
+++ b/distrib/utils/sysinst/savenewlabel.c      Sun Jul 27 08:57:27 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: savenewlabel.c,v 1.4 2003/07/07 12:30:22 dsl Exp $     */
+/*     $NetBSD: savenewlabel.c,v 1.5 2003/07/27 08:57:27 dsl Exp $     */
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: savenewlabel.c,v 1.4 2003/07/07 12:30:22 dsl Exp $");
+__RCSID("$NetBSD: savenewlabel.c,v 1.5 2003/07/27 08:57:27 dsl Exp $");
 #endif
 
 #include <sys/types.h>
@@ -59,12 +59,8 @@
        FILE *f;
        int i;
 
-#ifdef DEBUG
-       f = fopen("/tmp/disktab", "a");
-#else
        /* Create the disktab.preinstall */
-       f = fopen("/etc/disktab", "w");
-#endif
+       f = fopen("/tmp/disktab", "w");
        if (logging)
                (void)fprintf(logfp, "Creating disklabel %s\n", bsddiskname);
        scripting_fprintf(NULL, "cat <<EOF >>/etc/disktab\n");
diff -r a43f9a444dbb -r 8c5bf1908fc5 distrib/utils/sysinst/util.c
--- a/distrib/utils/sysinst/util.c      Sun Jul 27 07:56:37 2003 +0000
+++ b/distrib/utils/sysinst/util.c      Sun Jul 27 08:57:27 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: util.c,v 1.108 2003/07/27 07:45:09 dsl Exp $   */
+/*     $NetBSD: util.c,v 1.109 2003/07/27 08:57:27 dsl Exp $   */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -421,8 +421,18 @@
        process_menu(MENU_localdirsource, NULL);
 
        /* Complain if not a directory or distribution files absent */
-       while ((dir_exists_p(localfs_dir) == 0 && (errmsg = MSG_badlocalsetdir)) ||
-           (distribution_sets_exist_p(localfs_dir) == 0 && (errmsg = MSG_badsetdir))) {
+       for (;;) {
+               /*
+                * We have to have an absolute path ('cos pax runs in a
+                * different directory), make it so.
+                */
+               if (localfs_dir[0] != '/') {
+                       memmove(localfs_dir + 1, localfs_dir, sizeof localfs_dir - 1);
+                       localfs_dir[0] = '/';
+               }
+               if ((errmsg = MSG_badlocalsetdir, dir_exists_p(localfs_dir)) &&
+                   (errmsg = MSG_badsetdir, distribution_sets_exist_p(localfs_dir)))
+                       break;
                process_menu(MENU_localdirbad, &errmsg);
                if (!yesno)
                        return (0);
@@ -431,7 +441,7 @@
        }
 
        /* return location, don't clean... */
-       strlcpy(ext_dir, localfs_dir, STRSIZE);
+       strlcpy(ext_dir, localfs_dir, sizeof ext_dir);
        clean_dist_dir = 0;
        mnt2_mounted = 0;
        return 1;



Home | Main Index | Thread Index | Old Index