Source-Changes-HG archive

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

[src/trunk]: src/distrib/utils/sysinst Use new kern.root_partition sysctl to ...



details:   https://anonhg.NetBSD.org/src/rev/2f3de7817b46
branches:  trunk
changeset: 552565:2f3de7817b46
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sat Sep 27 10:47:17 2003 +0000

description:
Use new kern.root_partition sysctl to find out whether we are installing
over the current root (ie the one we are booted from).
Remove all the stuff that tried to find this out by other means.
A few other message changes.

diffstat:

 distrib/utils/sysinst/defs.h     |    6 +-
 distrib/utils/sysinst/disks.c    |    8 +-
 distrib/utils/sysinst/install.c  |   10 +-
 distrib/utils/sysinst/msg.mbr.en |   10 +-
 distrib/utils/sysinst/msg.mi.en  |   20 +--
 distrib/utils/sysinst/msg.mi.fr  |   14 +--
 distrib/utils/sysinst/msg.mi.pl  |   13 +--
 distrib/utils/sysinst/target.c   |  209 ++++----------------------------------
 distrib/utils/sysinst/upgrade.c  |   18 +---
 9 files changed, 50 insertions(+), 258 deletions(-)

diffs (truncated from 507 to 300 lines):

diff -r 09aa35eecaee -r 2f3de7817b46 distrib/utils/sysinst/defs.h
--- a/distrib/utils/sysinst/defs.h      Sat Sep 27 10:44:03 2003 +0000
+++ b/distrib/utils/sysinst/defs.h      Sat Sep 27 10:47:17 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.103 2003/08/10 14:51:48 dsl Exp $   */
+/*     $NetBSD: defs.h,v 1.104 2003/09/27 10:47:17 dsl Exp $   */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -74,7 +74,6 @@
 #define RUN_FATAL      0x0002          /* errors are fatal */
 #define RUN_CHROOT     0x0004          /* chroot to target disk */
 #define RUN_FULLSCREEN 0x0008          /* fullscreen (use with RUN_DISPLAY) */
-#define RUN_SYSTEM     0x0010          /* just use system(3) */
 
 /* Installation sets */
 #define SET_KERNEL     0x000000ffu     /* allow 8 kernels */
@@ -381,7 +380,6 @@
 void   customise_sets(void);
 
 /* from target.c */
-int    must_mount_root(void);
 const  char *concat_paths(const char *, const char *);
 char   *target_realpath(const char *, char *);
 const  char *target_expand(const char *);
@@ -396,7 +394,7 @@
 int    target_already_root(void);
 FILE   *target_fopen(const char *, const char *);
 int    target_collect_file(int, char **, const char *);
-int    is_active_rootpart(const char *);
+int    is_active_rootpart(const char *, int);
 int    cp_to_target(const char *, const char *);
 void   dup_file_into_target(const char *);
 void   mv_within_target_or_die(const char *, const char *);
diff -r 09aa35eecaee -r 2f3de7817b46 distrib/utils/sysinst/disks.c
--- a/distrib/utils/sysinst/disks.c     Sat Sep 27 10:44:03 2003 +0000
+++ b/distrib/utils/sysinst/disks.c     Sat Sep 27 10:47:17 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disks.c,v 1.71 2003/08/10 14:51:48 dsl Exp $ */
+/*     $NetBSD: disks.c,v 1.72 2003/09/27 10:47:17 dsl Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -304,9 +304,11 @@
                 * point defined, or is marked preserve, don't touch it!
                 */
                ptn = ptn_order[i];
+               if (!PI_ISBSDFS(&bsdlabel[ptn]))
+                       continue;
+               if (is_active_rootpart(diskdev, ptn))
+                       continue;
                snprintf(partname, STRSIZE, "%s%c", diskdev, 'a' + ptn);
-               if (!PI_ISBSDFS(&bsdlabel[ptn]) || is_active_rootpart(partname))
-                       continue;
                error = do_flfs_newfs(partname, ptn, bsdlabel[ptn].pi_mount);
                if (error)
                        return error;
diff -r 09aa35eecaee -r 2f3de7817b46 distrib/utils/sysinst/install.c
--- a/distrib/utils/sysinst/install.c   Sat Sep 27 10:44:03 2003 +0000
+++ b/distrib/utils/sysinst/install.c   Sat Sep 27 10:47:17 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: install.c,v 1.37 2003/07/25 08:26:21 dsl Exp $ */
+/*     $NetBSD: install.c,v 1.38 2003/09/27 10:47:17 dsl Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -73,14 +73,6 @@
 
        process_menu(MENU_distset, NULL);
 
-       /* if we need the user to mount root, ask them to. */
-       if (must_mount_root()) {
-               msg_display(MSG_pleasemountroot,
-                   diskdev, diskdev, diskdev, diskdev);
-               process_menu(MENU_ok, NULL);
-               return;
-       }
-
        if (!md_get_info()) {
                msg_display(MSG_abort);
                process_menu(MENU_ok, NULL);
diff -r 09aa35eecaee -r 2f3de7817b46 distrib/utils/sysinst/msg.mbr.en
--- a/distrib/utils/sysinst/msg.mbr.en  Sat Sep 27 10:44:03 2003 +0000
+++ b/distrib/utils/sysinst/msg.mbr.en  Sat Sep 27 10:47:17 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg.mbr.en,v 1.9 2003/07/14 09:59:00 dsl Exp $ */
+/*     $NetBSD: msg.mbr.en,v 1.10 2003/09/27 10:47:17 dsl Exp $        */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -140,7 +140,13 @@
 message get_ptn_id {Partition kind (0..255)}
 
 message editparttable
-{Edit your DOS partition table. The partition table currently looks like:
+{The Current MBR partition table is shown below. 
+Flgs: a => Active partition,
+.if BOOTSEL
+d => bootselect default,
+.endif
+I => Install here. 
+Select the partition you wish to change:
 
 }
 
diff -r 09aa35eecaee -r 2f3de7817b46 distrib/utils/sysinst/msg.mi.en
--- a/distrib/utils/sysinst/msg.mi.en   Sat Sep 27 10:44:03 2003 +0000
+++ b/distrib/utils/sysinst/msg.mi.en   Sat Sep 27 10:47:17 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg.mi.en,v 1.120 2003/08/19 14:33:16 dsl Exp $        */
+/*     $NetBSD: msg.mi.en,v 1.121 2003/09/27 10:47:17 dsl Exp $        */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -67,15 +67,17 @@
 message hello
 {Welcome to sysinst, the NetBSD-@@VERSION@@ system installation tool.
 This menu-driven tool is designed to help you install NetBSD to a hard
-disk, or upgrade an existing NetBSD system, with a minimum of work.
+disk, or upgrade an existing NetBSD system, with a minimum of work. 
 In the following menus, you may change the current selection by
-either typing the reference letter (a, b, c, ...).  Arrow keys may also work.
+either typing the reference letter (a, b, c, ...) or CTRL+N and CTRL+P.
+Arrow keys and Page-up/Page-down may also work. 
 You activate the current selection from the menu by typing the enter key.
 
 }
 
 message thanks
 {Thank you for using NetBSD!
+
 }
 
 message installusure
@@ -130,18 +132,6 @@
 message Available_disks
 {Available disks}
 
-message pleasemountroot
-{The root device is not mounted.  Please mount it.
-
-Your selected target disk %s also holds the current root device.  I
-need to know whether I'm currently running out of the target root
-(%sa), or out of an alternate root (say, in %sb, your swap partition).
-I can't tell unless you mount the root from which you booted read/write
-(eg 'mount /dev/%sb /').
-
-I'm aborting back to the main menu so you can fork a subshell.
-}
-
 message cylinders
 {cylinders}
 
diff -r 09aa35eecaee -r 2f3de7817b46 distrib/utils/sysinst/msg.mi.fr
--- a/distrib/utils/sysinst/msg.mi.fr   Sat Sep 27 10:44:03 2003 +0000
+++ b/distrib/utils/sysinst/msg.mi.fr   Sat Sep 27 10:47:17 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg.mi.fr,v 1.69 2003/08/19 14:33:16 dsl Exp $ */
+/*     $NetBSD: msg.mi.fr,v 1.70 2003/09/27 10:47:17 dsl Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -137,18 +137,6 @@
 message Available_disks        /* XXX translate */
 {Available disks}
 
-message pleasemountroot
-{Le système de fichiers racine n'est pas monté. Veuillez le monter.
-
-Votre disque de destination %s contient aussi le système de fichiers racine.
-J'ai besoin de savoir si je suis exécuté hors de la racine de
-destination (%sa), ou hors d'une racine alternative (disons %sb,
-votre partition de swap).
-Je ne peux pas le savoir tant que vous ne montez pas la racine de destination.
-
-J'abandonne et retourne au menu principal pour que vous lanciez un shell.
-}
-
 message cylinders
 {cylindres}
 
diff -r 09aa35eecaee -r 2f3de7817b46 distrib/utils/sysinst/msg.mi.pl
--- a/distrib/utils/sysinst/msg.mi.pl   Sat Sep 27 10:44:03 2003 +0000
+++ b/distrib/utils/sysinst/msg.mi.pl   Sat Sep 27 10:47:17 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg.mi.pl,v 1.31 2003/08/19 14:33:17 dsl Exp $ */
+/*     $NetBSD: msg.mi.pl,v 1.32 2003/09/27 10:47:17 dsl Exp $ */
 /*     Based on english version: */
 /*     NetBSD: msg.mi.en,v 1.86 2002/04/04 14:26:44 ad Exp     */
 
@@ -133,17 +133,6 @@
 message Available_disks        /* XXX translate */
 {Available disks}
 
-message pleasemountroot
-{Glowny dysk nie jest zamountowany. Zamountuj go.
-
-Wybrany przez ciebie dysk docelowy %s jest takze aktualnym glownym dyskiem.
-Musze wiedziec czy aktualnie dzialam poza docelowym dyskiem (%sa), czy 
-poza alternatywnym (powiedzmy, w %sb, twojej partycji wymiany).
-Nie moge tego stwierdzic dopoki nie zamountujesz glownej partycji z ktorej uruchomiles system zapis/odczyt (np 'mount /dev/%sb /').
-
-Przerywam i wracam do glownego menu, abys mogl uruchomic powloke.
-}
-
 message cylinders
 {cylindry}
 
diff -r 09aa35eecaee -r 2f3de7817b46 distrib/utils/sysinst/target.c
--- a/distrib/utils/sysinst/target.c    Sat Sep 27 10:44:03 2003 +0000
+++ b/distrib/utils/sysinst/target.c    Sat Sep 27 10:47:17 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: target.c,v 1.42 2003/08/07 09:28:01 agc Exp $  */
+/*     $NetBSD: target.c,v 1.43 2003/09/27 10:47:17 dsl Exp $  */
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -71,7 +71,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: target.c,v 1.42 2003/08/07 09:28:01 agc Exp $");
+__RCSID("$NetBSD: target.c,v 1.43 2003/09/27 10:47:17 dsl Exp $");
 #endif
 
 /*
@@ -103,10 +103,6 @@
 /*
  * local  prototypes 
  */
-static const char* get_rootdev (void);
-static const char* mounted_rootpart (void);
-int target_on_current_disk (void);
-int must_mount_root (void);
 
 static void make_prefixed_dir (const char *prefix, const char *path);
 static int do_target_chdir (const char *dir, int flag);
@@ -149,206 +145,53 @@
 }
 #endif
 
-/*
- * Get name of current root device  from kernel via sysctl. 
- * On NetBSD-1.3_ALPHA, this just returns the name of a
- * device (e.g., "sd0"), not a specific partition -- like "sd0a",
- * or "sd0b" for root-in-swap.
- */
-static const char *
-get_rootdev(void)
-{
-       int mib[2];
-       static char rootdev[STRSIZE];
-       size_t varlen;
-
-       mib[0] = CTL_KERN;
-       mib[1] = KERN_ROOT_DEVICE;
-       varlen = sizeof(rootdev);
-       if (sysctl(mib, 2, rootdev, &varlen, NULL, 0) < 0)
-               return (NULL);
-
-#ifdef DEBUG
-       printf("get_rootdev(): sysctl returns %s\n", rootdev);
-#endif
-       return (rootdev);
-}
-
-
-/*
- * Check if current root and target are on the same 
- * device (e.g., both on "sd0") or on different devices
- * e.g., target is "sd0" and root is "le0" (nfs).
- */
-int
-target_on_current_disk(void)
-{
-       int same;
-
-       if (strcmp(diskdev, "") == 0)   /* nothing selected yet */
-               same = 1;       /* bad assumption: this is a live system */
-       else
-               same = (strcmp(diskdev, get_rootdev()) == 0);
-       return (same);
-}
-
-/*
- * must_mount_root  -- check to see if the current root
- * partition  and the target root partition are on the same
- * device.  If they are, we need to have the root mounted read/write
- * in order to find out whether they're the same partition.
- * (this is arguably a bug in the kernel API.)
- *
- * check to see if they're
- */
-int
-must_mount_root(void)
-{
-       int result;
-
-#if defined(DEBUG)  || defined(DEBUG_ROOT)
-       endwin();



Home | Main Index | Thread Index | Old Index