- Change enum for partition numbers from [A..Z] to PART_[A..P] (16 is enough)

- Rename run_prog() to run_program() and remove the 'errmsg' argument (almost
  never used).
- Be consistent about #define<space> in defs.h
- Allow BSDFFS partitions to be FFSv1 or FFSv2 (fixes PR install/23547)
- i386: install correct bootblocks for root filesystem type.
- Do 'fsck -p' before all mounts (but never a full fsck), rename fsck_xxx()
  to mount_xxx() and remove some wrapper functions.
- Allow root to be an APPLEUFS partition - and allow them to be newfsed,
  should fix PR install/23198
- Redo fstab processing for upgrade to avoid large static data items and
  memory leaks.  Change walk() to abort on user defined error.
  (the fstab stuff really needs more work though...)
- i386: 'Warp' cursor to alternate option when selecting console/bootblocks,
  should fix PR port-i386/23546.
- Allow MENU_ok and MENU_yesno to take user defined title.
- Ensure that mountpoint not defined for swap (and similar issues) when
  editing netbsd label.
- Tweaks to error handling in run_program(), allow user to say that errors
  are expected or that the display shouldn't be cleared before returning.
- Remove some old code that has been festering under #if 0
This commit is contained in:
dsl 2003-11-30 14:36:43 +00:00
parent 020176e538
commit 31d8f670de
68 changed files with 830 additions and 953 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: aout2elf.c,v 1.8 2003/08/06 13:56:58 itojun Exp $ /* $NetBSD: aout2elf.c,v 1.9 2003/11/30 14:36:43 dsl Exp $
* *
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
* All rights reserved. * All rights reserved.
@ -120,7 +120,7 @@ handle_aout_x_libs(const char *srcdir, const char *tgtdir)
snprintf(src, MAXPATHLEN, "%s/%s", srcdir, x_libs[i]); snprintf(src, MAXPATHLEN, "%s/%s", srcdir, x_libs[i]);
if (!is_aout_shared_lib(src)) if (!is_aout_shared_lib(src))
continue; continue;
run_prog(0, NULL, "mv -f %s %s", src, tgtdir); run_program(0, "mv -f %s %s", src, tgtdir);
} }
/* /*
@ -178,7 +178,7 @@ handle_aout_libs(const char *dir, int op, const void *arg)
n++; n++;
break; break;
case LIB_MOVE: case LIB_MOVE:
run_prog(0, NULL, "mv -f %s %s/%s", run_program(0, "mv -f %s %s/%s",
full_name, destdir, dp->d_name); full_name, destdir, dp->d_name);
break; break;
} }
@ -192,6 +192,14 @@ endloop:
return n; return n;
} }
static void
abort_libupdate(void)
{
msg_display(MSG_aoutfail);
process_menu(MENU_ok, NULL);
exit(1);
}
int int
move_aout_libs(void) move_aout_libs(void)
{ {
@ -216,7 +224,7 @@ move_aout_libs(void)
if (target_realpath("/emul", prefix) == NULL || stat(prefix, &st) < 0) { if (target_realpath("/emul", prefix) == NULL || stat(prefix, &st) < 0) {
strlcpy(prefix, target_expand("/emul"), sizeof(prefix)); strlcpy(prefix, target_expand("/emul"), sizeof(prefix));
if (lstat(prefix, &st) == 0) { if (lstat(prefix, &st) == 0) {
run_prog(0, NULL, "mv -f %s %s", prefix, run_program(0, "mv -f %s %s", prefix,
target_expand("/emul.old")); target_expand("/emul.old"));
backedup = 1; backedup = 1;
} }
@ -234,7 +242,7 @@ move_aout_libs(void)
*/ */
strlcpy(src, concat_paths(prefix, "aout"), sizeof(src)); strlcpy(src, concat_paths(prefix, "aout"), sizeof(src));
if (lstat(src, &st) == 0) { if (lstat(src, &st) == 0) {
run_prog(0, NULL, "mv -f %s %s", src, run_program(0, "mv -f %s %s", src,
concat_paths(prefix, "aout.old")); concat_paths(prefix, "aout.old"));
backedup = 1; backedup = 1;
} }
@ -245,9 +253,10 @@ move_aout_libs(void)
* avoid overflowing the root partition. * avoid overflowing the root partition.
*/ */
strlcpy(prefix, target_expand("/usr/aout"), sizeof(prefix)); strlcpy(prefix, target_expand("/usr/aout"), sizeof(prefix));
run_prog(RUN_FATAL, MSG_aoutfail, "mkdir -p %s", prefix); if (run_program(0, "mkdir -p %s", prefix))
run_prog(RUN_FATAL, MSG_aoutfail, "ln -s %s %s", abort_libupdate();
"/usr/aout", src); if (run_program(0, "ln -s %s %s", "/usr/aout", src))
abort_libupdate();
domove: domove:
/* /*
@ -260,26 +269,26 @@ domove:
* and ld.so respectively will find them. * and ld.so respectively will find them.
*/ */
strlcpy(src, concat_paths(prefix, "usr/lib"), sizeof(src)); strlcpy(src, concat_paths(prefix, "usr/lib"), sizeof(src));
run_prog(0, NULL, "mv -f %s %s", src, run_program(0, "mv -f %s %s", src, concat_paths(prefix, "usr/lib.old"));
concat_paths(prefix, "usr/lib.old"));
strlcpy(src, concat_paths(prefix, "etc/ld.so.conf"), sizeof(src)); strlcpy(src, concat_paths(prefix, "etc/ld.so.conf"), sizeof(src));
run_prog(0, NULL, "mv -f %s %s", src, run_program(0, "mv -f %s %s",
concat_paths(prefix, "etc/ld.so.conf.old")); src, concat_paths(prefix, "etc/ld.so.conf.old"));
run_prog(RUN_FATAL, MSG_aoutfail, "mkdir -p %s ", if (run_program(0, "mkdir -p %s ", concat_paths(prefix, "usr/lib")))
concat_paths(prefix, "usr/lib")); abort_libupdate();
run_prog(RUN_FATAL, MSG_aoutfail, "mkdir -p %s ", if (run_program(0, "mkdir -p %s ", concat_paths(prefix, "etc")))
concat_paths(prefix, "etc")); abort_libupdate();
strlcpy(src, target_expand("/etc/ld.so.conf"), sizeof(src)); strlcpy(src, target_expand("/etc/ld.so.conf"), sizeof(src));
run_prog(RUN_FATAL, MSG_aoutfail, "mv -f %s %s", src, if (run_program(0, "mv -f %s %s",
concat_paths(prefix, "etc/ld.so.conf")); src, concat_paths(prefix, "etc/ld.so.conf")))
abort_libupdate();
strlcpy(src, target_expand("/usr/lib"), sizeof(src)); strlcpy(src, target_expand("/usr/lib"), sizeof(src));
n = handle_aout_libs(src, LIB_MOVE, n = handle_aout_libs(src, LIB_MOVE, concat_paths(prefix, "usr/lib"));
concat_paths(prefix, "usr/lib"));
run_prog(RUN_FATAL, MSG_aoutfail, "mkdir -p %s ", if (run_program(0, "mkdir -p %s ",
concat_paths(prefix, "usr/X11R6/lib")); concat_paths(prefix, "usr/X11R6/lib")))
abort_libupdate();
strlcpy(src, target_expand("/usr/X11R6/lib"), sizeof(src)); strlcpy(src, target_expand("/usr/X11R6/lib"), sizeof(src));
handle_aout_x_libs(src, concat_paths(prefix, "usr/X11R6/lib")); handle_aout_x_libs(src, concat_paths(prefix, "usr/X11R6/lib"));

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.14 2003/10/19 20:17:32 dsl Exp $ */ /* $NetBSD: md.c,v 1.15 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -286,7 +286,7 @@ md_post_newfs(void)
#if 0 #if 0
/* XXX boot blocks ... */ /* XXX boot blocks ... */
printf(msg_string(MSG_dobootblks), diskdev); printf(msg_string(MSG_dobootblks), diskdev);
run_prog(RUN_DISPLAY, NULL, "/sbin/disklabel -B %s /dev/r%sc", run_program(RUN_DISPLAY, "/sbin/disklabel -B %s /dev/r%sc",
"-b /usr/mdec/rzboot -s /usr/mdec/bootrz", diskdev); "-b /usr/mdec/rzboot -s /usr/mdec/bootrz", diskdev);
#endif #endif
return 0; return 0;
@ -331,9 +331,9 @@ md_cleanup_install(void)
#ifndef DEBUG #ifndef DEBUG
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
#endif #endif
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.8 2003/07/25 08:26:23 dsl Exp $ */ /* $NetBSD: md.h,v 1.9 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -44,9 +44,9 @@
/* Megs required for a full X installation. */ /* Megs required for a full X installation. */
#define XNEEDMB 60 #define XNEEDMB 60
#define PART_REST D #define PART_REST PART_D
#define PART_USR E #define PART_USR PART_E
#define PART_FIRST_FREE F #define PART_FIRST_FREE PART_F
/* /*
* Default filesets to fetch and install during installation * Default filesets to fetch and install during installation

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.15 2003/10/19 20:17:32 dsl Exp $ */ /* $NetBSD: md.c,v 1.16 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -285,7 +285,7 @@ md_post_newfs(void)
#if 0 #if 0
/* XXX boot blocks ... */ /* XXX boot blocks ... */
printf(msg_string(MSG_dobootblks), diskdev); printf(msg_string(MSG_dobootblks), diskdev);
run_prog(RUN_DISPLAY, NULL, "/sbin/disklabel -B %s /dev/r%sc", run_program(RUN_DISPLAY, "/sbin/disklabel -B %s /dev/r%sc",
"-b /usr/mdec/rzboot -s /usr/mdec/bootrz", diskdev); "-b /usr/mdec/rzboot -s /usr/mdec/bootrz", diskdev);
#endif #endif
return 0; return 0;
@ -331,9 +331,9 @@ md_cleanup_install(void)
#ifndef DEBUG #ifndef DEBUG
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
#endif #endif
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.11 2003/07/25 08:26:24 dsl Exp $ */ /* $NetBSD: md.h,v 1.12 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -44,9 +44,9 @@
/* Megs required for a full X installation. */ /* Megs required for a full X installation. */
#define XNEEDMB 60 #define XNEEDMB 60
#define PART_REST D #define PART_REST PART_D
#define PART_USR E #define PART_USR PART_E
#define PART_FIRST_FREE F #define PART_FIRST_FREE PART_F
/* /*
* Default filesets to fetch and install during installation * Default filesets to fetch and install during installation

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.36 2003/08/30 13:53:28 dsl Exp $ */ /* $NetBSD: md.c,v 1.37 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -126,10 +126,14 @@ md_post_disklabel(void)
int int
md_post_newfs(void) md_post_newfs(void)
{ {
printf (msg_string(MSG_dobootblks), diskdev); printf (msg_string(MSG_dobootblks), diskdev);
cp_to_target("/usr/mdec/boot", "/boot"); cp_to_target("/usr/mdec/boot", "/boot");
run_prog(RUN_DISPLAY, "Warning: disk is probably not bootable", if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/sbin/installboot /dev/r%sc /usr/mdec/bootxx_ffs", diskdev); "/usr/sbin/installboot /dev/r%sc /usr/mdec/bootxx_ffs",
diskdev))
process_menu(MENU_ok, "Warning: disk is probably not bootable");
return 0; return 0;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.16 2003/08/30 13:53:28 dsl Exp $ */ /* $NetBSD: md.h,v 1.17 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -44,9 +44,9 @@
/* /*
* Symbolic names for disk partitions. * Symbolic names for disk partitions.
*/ */
#define PART_ROOT A #define PART_ROOT PART_A
#define PART_RAW C #define PART_RAW PART_C
#define PART_USR D #define PART_USR PART_D
/* Megs required for a full X installation. */ /* Megs required for a full X installation. */
#define XNEEDMB 50 /* XXXTHORPEJ */ #define XNEEDMB 50 /* XXXTHORPEJ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.14 2003/10/19 20:17:32 dsl Exp $ */ /* $NetBSD: md.c,v 1.15 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -75,9 +75,8 @@ md_post_newfs(void)
{ {
/* boot blocks ... */ /* boot blocks ... */
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, diskdev);
return run_prog(RUN_DISPLAY, NULL, return run_program(RUN_DISPLAY,
"/usr/mdec/installboot -v /usr/mdec/xxboot /dev/r%sa", "/usr/mdec/installboot -v /usr/mdec/xxboot /dev/r%sa", diskdev);
diskdev);
} }
int int
@ -115,9 +114,9 @@ md_cleanup_install(void)
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.20 2003/10/19 20:17:32 dsl Exp $ */ /* $NetBSD: md.c,v 1.21 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -90,7 +90,7 @@ md_post_disklabel(void)
/* Sector forwarding / badblocks ... */ /* Sector forwarding / badblocks ... */
if (*doessf) { if (*doessf) {
msg_display(MSG_dobad144); msg_display(MSG_dobad144);
return run_prog(RUN_DISPLAY, NULL, "/usr/sbin/bad144 %s 0", return run_program(RUN_DISPLAY, "/usr/sbin/bad144 %s 0",
diskdev); diskdev);
} }
return 0; return 0;
@ -153,9 +153,9 @@ md_cleanup_install(void)
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.15 2003/10/19 20:17:32 dsl Exp $ */ /* $NetBSD: md.c,v 1.16 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -85,8 +85,7 @@ md_post_newfs(void)
{ {
/* boot blocks ... */ /* boot blocks ... */
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, diskdev);
return run_prog(RUN_DISPLAY, NULL, return run_program(RUN_DISPLAY, "/usr/mdec/installboot -v /dev/r%sc",
"/usr/mdec/installboot -v /dev/r%sc",
diskdev); diskdev);
} }
@ -106,7 +105,7 @@ md_make_bsd_partitions(void)
msg_display(MSG_infoahdilabel, diskdev); msg_display(MSG_infoahdilabel, diskdev);
process_menu(MENU_noyes, NULL); process_menu(MENU_noyes, NULL);
if (yesno) { if (yesno) {
run_prog(RUN_DISPLAY, NULL, "ahdilabel /dev/r%sc", diskdev); run_program(RUN_DISPLAY, "ahdilabel /dev/r%sc", diskdev);
} }
if (!make_bsd_partitions()) if (!make_bsd_partitions())
return 0; return 0;
@ -144,9 +143,9 @@ md_cleanup_install(void)
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.12 2003/07/25 08:26:25 dsl Exp $ */ /* $NetBSD: md.h,v 1.13 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -46,11 +46,11 @@
#include <unistd.h> #include <unistd.h>
/* constants and defines */ /* constants and defines */
#define PART_ROOT A #define PART_ROOT PART_A
#define PART_SWAP B #define PART_SWAP PART_B
#define PART_RAW C #define PART_RAW PART_C
#define PART_USR D /* Can be after PART_FIRST_FREE */ #define PART_USR PART_D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE E #define PART_FIRST_FREE PART_E
#define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */ #define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */
#define DEFROOTSIZE 20 /* Default root size */ #define DEFROOTSIZE 20 /* Default root size */

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.43 2003/10/19 20:17:32 dsl Exp $ */ /* $NetBSD: md.c,v 1.44 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -80,7 +80,7 @@ md_post_disklabel(void)
/* Sector forwarding / badblocks ... */ /* Sector forwarding / badblocks ... */
if (*doessf) { if (*doessf) {
printf ("%s", msg_string (MSG_dobad144)); printf ("%s", msg_string (MSG_dobad144));
return run_prog(RUN_DISPLAY, NULL, "/usr/sbin/bad144 %s 0", return run_program(RUN_DISPLAY, "/usr/sbin/bad144 %s 0",
diskdev); diskdev);
} }
return 0; return 0;
@ -91,9 +91,9 @@ md_post_newfs(void)
{ {
/* boot blocks ... */ /* boot blocks ... */
printf (msg_string(MSG_dobootblks), diskdev); printf (msg_string(MSG_dobootblks), diskdev);
run_prog (RUN_DISPLAY, NULL, run_program(RUN_DISPLAY,
"/usr/mdec/installboot -v /usr/mdec/biosboot.sym " "/usr/mdec/installboot -v /usr/mdec/biosboot.sym /dev/r%sa",
"/dev/r%sa", diskdev); diskdev);
return 0; return 0;
} }
@ -105,7 +105,7 @@ md_copy_filesystem(void)
} }
/* Copy the instbin(s) to the disk */ /* Copy the instbin(s) to the disk */
if (run_prog(RUN_DISPLAY, NULL, if (run_program(RUN_DISPLAY | RUN_PROGRESS,
"pax -X -O -r -w -pe / %s", targetroot_mnt) != 0) "pax -X -O -r -w -pe / %s", targetroot_mnt) != 0)
return 1; return 1;
@ -149,9 +149,9 @@ md_cleanup_install(void)
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.13 2003/10/19 20:17:32 dsl Exp $ */ /* $NetBSD: md.c,v 1.14 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -138,7 +138,7 @@ md_post_newfs(void)
#if 0 #if 0
/* XXX boot blocks ... */ /* XXX boot blocks ... */
printf(msg_string(MSG_dobootblks), diskdev); printf(msg_string(MSG_dobootblks), diskdev);
run_prog(RUN_DISPLAY, NULL, "/sbin/disklabel -B %s /dev/r%sc", run_program(RUN_DISPLAY, "/sbin/disklabel -B %s /dev/r%sc",
"-b /usr/mdec/rzboot -s /usr/mdec/bootrz", diskdev); "-b /usr/mdec/rzboot -s /usr/mdec/bootrz", diskdev);
#endif #endif
return 0; return 0;
@ -184,9 +184,9 @@ md_cleanup_install(void)
#ifndef DEBUG #ifndef DEBUG
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
#endif #endif
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.14 2003/10/19 20:17:32 dsl Exp $ */ /* $NetBSD: md.c,v 1.15 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -157,9 +157,9 @@ md_cleanup_install(void)
#ifndef DEBUG #ifndef DEBUG
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
#endif #endif
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.18 2003/10/19 20:17:32 dsl Exp $ */ /* $NetBSD: md.c,v 1.19 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997,2002 Piermont Information Systems Inc. * Copyright 1997,2002 Piermont Information Systems Inc.
@ -80,7 +80,7 @@ md_post_disklabel(void)
/* Sector forwarding / badblocks ... */ /* Sector forwarding / badblocks ... */
if (*doessf) { if (*doessf) {
printf ("%s", msg_string (MSG_dobad144)); printf ("%s", msg_string (MSG_dobad144));
return run_prog(RUN_DISPLAY, NULL, "/usr/sbin/bad144 %s 0", return run_program(RUN_DISPLAY, "/usr/sbin/bad144 %s 0",
diskdev); diskdev);
} }
return 0; return 0;
@ -93,9 +93,9 @@ md_post_newfs(void)
#if 0 #if 0
/* boot blocks ... */ /* boot blocks ... */
printf (msg_string(MSG_dobootblks), diskdev); printf (msg_string(MSG_dobootblks), diskdev);
run_prog (RUN_DISPLAY, NULL, run_program(RUN_DISPLAY,
"/usr/mdec/installboot -v /usr/mdec/biosboot.sym " "/usr/mdec/installboot -v /usr/mdec/biosboot.sym /dev/r%sa",
"/dev/r%sa", diskdev); diskdev);
#endif #endif
return 0; return 0;
} }
@ -108,7 +108,7 @@ md_copy_filesystem(void)
} }
/* Copy the instbin(s) to the disk */ /* Copy the instbin(s) to the disk */
if (run_prog(RUN_DISPLAY, NULL, if (run_program(RUN_DISPLAY | RUN_PROGRESS,
"pax -X -O -r -w -pe / %s", targetroot_mnt) != 0) "pax -X -O -r -w -pe / %s", targetroot_mnt) != 0)
return 1; return 1;
@ -152,9 +152,9 @@ md_cleanup_install(void)
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.12 2003/10/19 20:17:32 dsl Exp $ */ /* $NetBSD: md.c,v 1.13 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -147,9 +147,10 @@ md_post_newfs(void)
/* boot blocks ... */ /* boot blocks ... */
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, diskdev);
cp_to_target("/usr/mdec/boot", "/boot"); cp_to_target("/usr/mdec/boot", "/boot");
run_prog(RUN_DISPLAY, "Warning: disk is probably not bootable", if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/mdec/installboot /usr/mdec/uboot.lif /dev/r%sa", "/usr/mdec/installboot /usr/mdec/uboot.lif /dev/r%sa",
diskdev); diskdev))
process_menu(MENU_ok, "Warning: disk is probably not bootable");
return (0); return (0);
} }
@ -180,18 +181,18 @@ int
md_check_partitions(void) md_check_partitions(void)
{ {
/* hp300 partitions must be in order of the range. */ /* hp300 partitions must be in order of the range. */
int part, start = 0, last = A-1; int part, start = 0, last = PART_A-1;
for (part = A; part < 8; part++) { for (part = PART_A; part < 8; part++) {
if (part == C) if (part == PART_C)
continue; continue;
if (last >= A && bsdlabel[part].pi_size > 0) { if (last >= PART_A && bsdlabel[part].pi_size > 0) {
msg_display(MSG_emptypart, part+'a'); msg_display(MSG_emptypart, part+'a');
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return (0); return (0);
} }
if (bsdlabel[part].pi_size == 0) { if (bsdlabel[part].pi_size == 0) {
if (last < A) if (last < PART_A)
last = part; last = part;
} else { } else {
if (start >= bsdlabel[part].pi_offset) { if (start >= bsdlabel[part].pi_offset) {
@ -228,9 +229,9 @@ md_cleanup_install(void)
#ifdef notyet /* sed is too large for ramdisk */ #ifdef notyet /* sed is too large for ramdisk */
enable_rc_conf(); enable_rc_conf();
#endif #endif
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.7 2003/07/25 08:26:27 dsl Exp $ */ /* $NetBSD: md.h,v 1.8 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -52,11 +52,11 @@
/* /*
* Symbolic names for disk partitions. * Symbolic names for disk partitions.
*/ */
#define PART_ROOT A #define PART_ROOT PART_A
#define PART_SWAP B #define PART_SWAP PART_B
#define PART_RAW C #define PART_RAW PART_C
#define PART_USR D /* Can be after PART_FIRST_FREE */ #define PART_USR PART_D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE E #define PART_FIRST_FREE PART_E
#define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */ #define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */
#define DEFROOTSIZE 20 /* Default root size */ #define DEFROOTSIZE 20 /* Default root size */

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.35 2003/10/19 20:17:32 dsl Exp $ */ /* $NetBSD: md.c,v 1.36 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -85,7 +85,7 @@ md_post_disklabel(void)
/* Sector forwarding / badblocks ... */ /* Sector forwarding / badblocks ... */
if (*doessf) { if (*doessf) {
msg_display(MSG_dobad144); msg_display(MSG_dobad144);
return run_prog(RUN_DISPLAY, NULL, "/usr/sbin/bad144 %s 0", return run_program(RUN_DISPLAY, "/usr/sbin/bad144 %s 0",
diskdev); diskdev);
} }
return 0; return 0;
@ -138,9 +138,9 @@ md_cleanup_install(void)
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.98 2003/10/19 20:17:33 dsl Exp $ */ /* $NetBSD: md.c,v 1.99 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -68,6 +68,7 @@ static int mbr_root_above_chs(void);
static void md_upgrade_mbrtype(void); static void md_upgrade_mbrtype(void);
static int md_read_bootcode(const char *, struct mbr_sector *); static int md_read_bootcode(const char *, struct mbr_sector *);
static unsigned int get_bootmodel(void); static unsigned int get_bootmodel(void);
static char *md_bootxx_name(void);
int int
@ -280,6 +281,7 @@ md_post_newfs(void)
size_t len; size_t len;
int td, sd; int td, sd;
char bootxx[8192 + 4]; char bootxx[8192 + 4];
char *bootxx_filename;
static struct x86_boot_params boottype = static struct x86_boot_params boottype =
{sizeof boottype, 0, 10, 0, 9600, ""}; {sizeof boottype, 0, 10, 0, 9600, ""};
static int conmib[] = {CTL_MACHDEP, CPU_CONSDEV}; static int conmib[] = {CTL_MACHDEP, CPU_CONSDEV};
@ -318,7 +320,9 @@ md_post_newfs(void)
snprintf(bootxx, sizeof bootxx, "/dev/r%s%c", diskdev, 'a' + rootpart); snprintf(bootxx, sizeof bootxx, "/dev/r%s%c", diskdev, 'a' + rootpart);
td = open(bootxx, O_RDWR, 0); td = open(bootxx, O_RDWR, 0);
sd = open("/usr/mdec/bootxx_ffsv1", O_RDONLY); bootxx_filename = md_bootxx_name();
sd = open(bootxx_filename, O_RDONLY);
free(bootxx_filename);
if (td == -1 || sd == -1) if (td == -1 || sd == -1)
goto bad_bootxx; goto bad_bootxx;
len = read(sd, bootxx, sizeof bootxx); len = read(sd, bootxx, sizeof bootxx);
@ -373,7 +377,17 @@ md_pre_update(void)
int int
md_check_partitions(void) md_check_partitions(void)
{ {
return 1; int rval;
char *bootxx;
/* check we have boot code for the root partition type */
bootxx = md_bootxx_name();
rval = access(bootxx, R_OK);
free(bootxx);
if (rval == 0)
return 1;
process_menu(MENU_ok, deconst(MSG_No_Bootcode));
return 0;
} }
@ -435,18 +449,18 @@ md_cleanup_install(void)
* Otherwise, run getty on 4 VTs. * Otherwise, run getty on 4 VTs.
*/ */
if (sets_selected & SET_KERNEL_TINY) if (sets_selected & SET_KERNEL_TINY)
run_prog(0, NULL, "sed -an -e '/^screen/s/^/#/;/^mux/s/^/#/;" run_program(0, "sed -an -e '/^screen/s/^/#/;/^mux/s/^/#/;"
"H;$!d;g;w %s/etc/wscons.conf' %s/etc/wscons.conf", "H;$!d;g;w %s/etc/wscons.conf' %s/etc/wscons.conf",
tp, tp); tp, tp);
else else
#endif #endif
run_prog(0, NULL, "sed -an -e '/^ttyE[1-9]/s/off/on/;" run_program(0, "sed -an -e '/^ttyE[1-9]/s/off/on/;"
"H;$!d;g;w %s/etc/ttys' %s/etc/ttys", "H;$!d;g;w %s/etc/ttys' %s/etc/ttys",
tp, tp); tp, tp);
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int
@ -594,3 +608,27 @@ md_set_sizemultname(void)
set_sizemultname_meg(); set_sizemultname_meg();
} }
static char *
md_bootxx_name(void)
{
int fstype;
const char *bootfs = 0;
char *bootxx;
/* check we have boot code for the root partition type */
fstype = bsdlabel[rootpart].pi_fstype;
if (fstype == FS_BSDFFS)
if (bsdlabel[rootpart].pi_flags & PIF_FFSv2)
bootfs = "ffsv2";
else
bootfs = "ffsv1";
else
bootfs = mountnames[fstype];
if (bootfs == NULL)
return NULL;
asprintf(&bootxx, "/usr/mdec/bootxx_%s", bootfs);
return bootxx;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: menus.md,v 1.9 2003/10/19 20:17:33 dsl Exp $ */ /* $NetBSD: menus.md,v 1.10 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -38,28 +38,34 @@
/* Menu definitions for sysinst. i386 version, machine dependent. */ /* Menu definitions for sysinst. i386 version, machine dependent. */
menu getboottype, title MSG_Bootblocks_selection, y=10, exit; menu getboottype, title MSG_Bootblocks_selection, y=10, exit, no clear;
display action { msg_display(MSG_getboottype); display action { msg_display(MSG_getboottype);
if (((struct x86_boot_params *)arg)->bp_consdev == 0) switch (((struct x86_boot_params *)arg)->bp_consdev) {
case ~0:
msg_display_add(MSG_console_unchanged);
break;
case 0:
msg_display_add(MSG_console_PC); msg_display_add(MSG_console_PC);
else break;
default:
msg_display_add(MSG_console_com, msg_display_add(MSG_console_com,
((struct x86_boot_params *)arg)->bp_consdev - 1, ((struct x86_boot_params *)arg)->bp_consdev - 1,
((struct x86_boot_params *)arg)->bp_conspeed); ((struct x86_boot_params *)arg)->bp_conspeed);
}
}; };
option MSG_Use_normal_bootblocks, action option MSG_Use_normal_bootblocks, action
{((struct x86_boot_params *)arg)->bp_consdev = 0;}; {((struct x86_boot_params *)arg)->bp_consdev = 0; m->cursel = 7;};
option MSG_Use_serial_com0, action option MSG_Use_serial_com0, action
{((struct x86_boot_params *)arg)->bp_consdev = 1;}; {((struct x86_boot_params *)arg)->bp_consdev = 1; m->cursel = 5;};
option MSG_Use_serial_com1, action option MSG_Use_serial_com1, action
{((struct x86_boot_params *)arg)->bp_consdev = 2;}; {((struct x86_boot_params *)arg)->bp_consdev = 2; m->cursel = 5;};
option MSG_Use_serial_com2, action option MSG_Use_serial_com2, action
{((struct x86_boot_params *)arg)->bp_consdev = 3;}; {((struct x86_boot_params *)arg)->bp_consdev = 3; m->cursel = 5;};
option MSG_Use_serial_com3, action option MSG_Use_serial_com3, action
{((struct x86_boot_params *)arg)->bp_consdev = 4;}; {((struct x86_boot_params *)arg)->bp_consdev = 4; m->cursel = 5;};
option MSG_serial_baud_rate, sub menu consolebaud; option MSG_serial_baud_rate, sub menu consolebaud;
option MSG_Use_existing_bootblocks, action option MSG_Use_existing_bootblocks, action
{((struct x86_boot_params *)arg)->bp_consdev = ~0;}; {((struct x86_boot_params *)arg)->bp_consdev = ~0; m->cursel = 7;};
menu consolebaud, title MSG_serial_baud_rate, x=40, y=13; menu consolebaud, title MSG_serial_baud_rate, x=40, y=13;
display action { display action {

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.en,v 1.43 2003/10/19 20:17:33 dsl Exp $ */ /* $NetBSD: msg.md.en,v 1.44 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -58,6 +58,7 @@ Selected bootblock: }
message console_PC {BIOS console} message console_PC {BIOS console}
message console_com {Serial port com%d at %d baud} message console_com {Serial port com%d at %d baud}
message console_unchanged {Unchanged}
message Bootblocks_selection message Bootblocks_selection
{Bootblocks selection} {Bootblocks selection}
@ -69,6 +70,8 @@ message Use_serial_com3 {Use serial port com3}
message serial_baud_rate {Serial baud rate} message serial_baud_rate {Serial baud rate}
message Use_existing_bootblocks {Use existing bootblocks} message Use_existing_bootblocks {Use existing bootblocks}
message No_Bootcode {No bootcode for root partition}
message dobootblks message dobootblks
{Installing boot blocks on %s.... {Installing boot blocks on %s....
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.fr,v 1.32 2003/08/27 16:00:30 lukem Exp $ */ /* $NetBSD: msg.md.fr,v 1.33 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -54,6 +54,7 @@ Selected bootblock: }
message console_PC {BIOS console} message console_PC {BIOS console}
message console_com {Serial port com%d, baud rate %d} message console_com {Serial port com%d, baud rate %d}
message console_unchanged {Unchanged}
message Bootblocks_selection message Bootblocks_selection
{Bootblocks selection} {Bootblocks selection}
@ -65,20 +66,7 @@ message Use_serial_com3 {Use serial port com3}
message serial_baud_rate {Serial baud rate} message serial_baud_rate {Serial baud rate}
message Use_existing_bootblocks {Use existing bootblocks} message Use_existing_bootblocks {Use existing bootblocks}
.if 0 message No_Bootcode {No bootcode for root partition}
message Bootblocks_selection
{Sélection de Bootblocks}
message Use_normal_bootblocks
{Utilisez normal le bootblocks}
message Use_serial_9600_bootblocks
{Utilisez serial (9600) le bootblocks}
message Use_serial_38400_bootblocks
{Utilisez serial (38400) le bootblocks}
message Use_serial_57600_bootblocks
{Utilisez serial (57600) le bootblocks}
message Use_serial_115200_bootblocks
{Utilisez serial (115200) le bootblocks}
.endif
message dobootblks message dobootblks
{Installation des block de démarrage sur %s ... {Installation des block de démarrage sur %s ...

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.pl,v 1.17 2003/08/27 16:00:30 lukem Exp $ */ /* $NetBSD: msg.md.pl,v 1.18 2003/11/30 14:36:45 dsl Exp $ */
/* Based on english version: */ /* Based on english version: */
/* NetBSD: msg.md.en,v 1.24 2001/01/27 07:34:39 jmc Exp */ /* NetBSD: msg.md.en,v 1.24 2001/01/27 07:34:39 jmc Exp */
@ -56,6 +56,7 @@ Selected bootblock: }
message console_PC {BIOS console} message console_PC {BIOS console}
message console_com {Serial port com%d, baud rate %d} message console_com {Serial port com%d, baud rate %d}
message console_unchanged {Unchanged}
message Bootblocks_selection message Bootblocks_selection
{Wybor bootblokow} {Wybor bootblokow}
@ -67,18 +68,7 @@ message Use_serial_com3 {Use serial port com3}
message serial_baud_rate {Serial baud rate} message serial_baud_rate {Serial baud rate}
message Use_existing_bootblocks {Use existing bootblocks} message Use_existing_bootblocks {Use existing bootblocks}
.if 0 message No_Bootcode {No bootcode for root partition}
message Use_normal_bootblocks
{Uzyj normalnych bootblokow}
message Use_serial_9600_bootblocks
{Uzyj bootblokow na zewn. konsole (9600)}
message Use_serial_38400_bootblocks
{Uzyj bootblokow na zewn. konsole (38400)}
message Use_serial_57600_bootblocks
{Uzyj bootblokow na zewn. konsole (57600)}
message Use_serial_115200_bootblocks
{Uzyj bootblokow na zewn. konsole (115200)}
.endif
message dobootblks message dobootblks
{Instalowanie bootblokow na %s.... {Instalowanie bootblokow na %s....

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.39 2003/10/19 20:17:33 dsl Exp $ */ /* $NetBSD: md.c,v 1.40 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -1024,7 +1024,7 @@ md_make_bsd_partitions(void)
strcpy (bsddiskname, diskdev); strcpy (bsddiskname, diskdev);
/* Create the disktab.preinstall */ /* Create the disktab.preinstall */
run_prog (0, NULL, "cp /etc/disktab.preinstall /etc/disktab"); run_program(0, "cp /etc/disktab.preinstall /etc/disktab");
#ifdef DEBUG #ifdef DEBUG
f = fopen ("/tmp/disktab", "a"); f = fopen ("/tmp/disktab", "a");
#else #else
@ -1089,9 +1089,9 @@ md_cleanup_install(void)
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.31 2003/08/30 13:53:28 dsl Exp $ */ /* $NetBSD: md.c,v 1.32 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -131,7 +131,7 @@ md_post_newfs(void)
printf (msg_string(MSG_dobootblks), diskdev); printf (msg_string(MSG_dobootblks), diskdev);
cp_to_target("/usr/mdec/ofwboot", bootfile); cp_to_target("/usr/mdec/ofwboot", bootfile);
sync(); sync();
run_prog(RUN_DISPLAY, NULL, "/usr/sbin/installboot /dev/r%sa %s %s", run_program(RUN_DISPLAY, "/usr/sbin/installboot /dev/r%sa %s %s",
diskdev, "/usr/mdec/bootxx", bootfile); diskdev, "/usr/mdec/bootxx", bootfile);
return 0; return 0;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.13 2003/08/30 13:53:28 dsl Exp $ */ /* $NetBSD: md.h,v 1.14 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -44,9 +44,9 @@
/* /*
* Symbolic names for disk partitions. * Symbolic names for disk partitions.
*/ */
#define PART_ROOT A #define PART_ROOT PART_A
#define PART_RAW C #define PART_RAW PART_C
#define PART_USR G #define PART_USR PART_G
/* Megs required for a full X installation. */ /* Megs required for a full X installation. */
#define XNEEDMB 35 /* XXXTHORPEJ */ #define XNEEDMB 35 /* XXXTHORPEJ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.7 2003/10/19 20:17:33 dsl Exp $ */ /* $NetBSD: md.c,v 1.8 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -141,6 +141,7 @@ md_post_disklabel(void)
int int
md_post_newfs(void) md_post_newfs(void)
{ {
/* XXX boot blocks ... */ /* XXX boot blocks ... */
if (target_already_root()) { if (target_already_root()) {
/* /usr is empty and we must already have bootblocks?*/ /* /usr is empty and we must already have bootblocks?*/
@ -149,8 +150,9 @@ md_post_newfs(void)
printf(msg_string(MSG_dobootblks), diskdev); printf(msg_string(MSG_dobootblks), diskdev);
cp_to_target("/usr/mdec/boot", "/boot"); cp_to_target("/usr/mdec/boot", "/boot");
run_prog(RUN_DISPLAY, "Warning: disk is probably not bootable", if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/mdec/installboot /dev/r%sc /usr/mdec/bootxx_ffs", diskdev); "/usr/mdec/installboot /dev/r%sc /usr/mdec/bootxx_ffs", diskdev))
process_menu(MENU_ok, "Warning: disk is probably not bootable");
return 0; return 0;
} }
@ -201,9 +203,9 @@ md_cleanup_install(void)
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.8 2003/07/25 08:26:29 dsl Exp $ */ /* $NetBSD: md.h,v 1.9 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -47,11 +47,11 @@
/* /*
* Symbolic names for disk partitions. * Symbolic names for disk partitions.
*/ */
#define PART_ROOT A #define PART_ROOT PART_A
#define PART_SWAP B #define PART_SWAP PART_B
#define PART_RAW C #define PART_RAW PART_C
#define PART_USR D /* Can be after PART_FIRST_FREE */ #define PART_USR PART_D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE E #define PART_FIRST_FREE PART_E
#define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */ #define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */
#define DEFROOTSIZE 64 /* Default root size */ #define DEFROOTSIZE 64 /* Default root size */

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.11 2003/10/19 20:17:33 dsl Exp $ */ /* $NetBSD: md.c,v 1.12 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -147,9 +147,10 @@ md_post_newfs(void)
/* boot blocks ... */ /* boot blocks ... */
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, diskdev);
cp_to_target("/usr/mdec/bootsd", "/.bootsd"); cp_to_target("/usr/mdec/bootsd", "/.bootsd");
run_prog(RUN_DISPLAY, "Warning: disk is probably not bootable", if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/mdec/installboot %s /usr/mdec/bootxx /dev/r%sa", "/usr/mdec/installboot %s /usr/mdec/bootxx /dev/r%sa",
target_expand("/.bootsd"), diskdev); target_expand("/.bootsd"), diskdev))
process_menu(MENU_ok, "Warning: disk is probably not bootable");
return (0); return (0);
} }
@ -180,18 +181,18 @@ int
md_check_partitions(void) md_check_partitions(void)
{ {
/* mvme68k partitions must be in order of the range. */ /* mvme68k partitions must be in order of the range. */
int part, start = 0, last = A-1; int part, start = 0, last = PART_A-1;
for (part = A; part < 8; part++) { for (part = PART_A; part < 8; part++) {
if (part == C) if (part == PART_C)
continue; continue;
if (last >= A && bsdlabel[part].pi_size > 0) { if (last >= PART_A && bsdlabel[part].pi_size > 0) {
msg_display(MSG_emptypart, part+'a'); msg_display(MSG_emptypart, part+'a');
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return (0); return (0);
} }
if (bsdlabel[part].pi_size == 0) { if (bsdlabel[part].pi_size == 0) {
if (last < A) if (last < PART_A)
last = part; last = part;
} else { } else {
if (start > bsdlabel[part].pi_offset) { if (start > bsdlabel[part].pi_offset) {
@ -228,9 +229,9 @@ md_cleanup_install(void)
#ifdef notyet /* sed is too large for ramdisk */ #ifdef notyet /* sed is too large for ramdisk */
enable_rc_conf(); enable_rc_conf();
#endif #endif
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.7 2003/07/25 08:26:29 dsl Exp $ */ /* $NetBSD: md.h,v 1.8 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -52,11 +52,11 @@
/* /*
* Symbolic names for disk partitions. * Symbolic names for disk partitions.
*/ */
#define PART_ROOT A #define PART_ROOT PART_A
#define PART_SWAP B #define PART_SWAP PART_B
#define PART_RAW C #define PART_RAW PART_C
#define PART_USR D /* Can be after PART_FIRST_FREE */ #define PART_USR PART_D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE E #define PART_FIRST_FREE PART_E
#define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */ #define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */
#define DEFROOTSIZE 20 /* Default root size */ #define DEFROOTSIZE 20 /* Default root size */

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.20 2003/10/19 20:17:33 dsl Exp $ */ /* $NetBSD: md.c,v 1.21 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -144,7 +144,7 @@ md_post_newfs()
printf(msg_string(MSG_dobootblks), diskdev); printf(msg_string(MSG_dobootblks), diskdev);
cp_to_target("/usr/mdec/boot", bootfile); cp_to_target("/usr/mdec/boot", bootfile);
sync(); sync();
run_prog(RUN_DISPLAY, NULL, "/usr/sbin/installboot /dev/r%sc %s %s", run_program(RUN_DISPLAY, "/usr/sbin/installboot /dev/r%sc %s %s",
diskdev, "/usr/mdec/bootxx", bootfile); diskdev, "/usr/mdec/bootxx", bootfile);
return 0; return 0;
} }
@ -197,8 +197,8 @@ md_cleanup_install()
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.17 2003/07/25 08:26:30 dsl Exp $ */ /* $NetBSD: md.h,v 1.18 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -44,11 +44,11 @@
/* /*
* Symbolic names for disk partitions * Symbolic names for disk partitions
*/ */
#define PART_ROOT A #define PART_ROOT PART_A
#define PART_SWAP B #define PART_SWAP PART_B
#define PART_RAW C #define PART_RAW PART_C
#define PART_USR G /* Can be after PART_FIRST_FREE */ #define PART_USR PART_G /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE D #define PART_FIRST_FREE PART_D
#define DEFSWAPRAM 16 /* Assume at least this RAM for swap calc */ #define DEFSWAPRAM 16 /* Assume at least this RAM for swap calc */
#define DEFROOTSIZE 32 /* Default root size */ #define DEFROOTSIZE 32 /* Default root size */

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.9 2003/10/19 20:17:33 dsl Exp $ */ /* $NetBSD: md.c,v 1.10 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -144,7 +144,7 @@ md_post_newfs()
printf (msg_string(MSG_dobootblks), diskdev); printf (msg_string(MSG_dobootblks), diskdev);
cp_to_target("/usr/mdec/boot", bootfile); cp_to_target("/usr/mdec/boot", bootfile);
sync(); sync();
run_prog(RUN_DISPLAY, NULL, "/usr/sbin/installboot /dev/r%sc %s %s", run_program(RUN_DISPLAY, "/usr/sbin/installboot /dev/r%sc %s %s",
diskdev, "/usr/mdec/bootxx", bootfile); diskdev, "/usr/mdec/bootxx", bootfile);
return 0; return 0;
} }
@ -196,8 +196,8 @@ md_cleanup_install()
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.7 2003/07/25 08:26:30 dsl Exp $ */ /* $NetBSD: md.h,v 1.8 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -44,11 +44,11 @@
/* /*
* Symbolic names for disk partitions * Symbolic names for disk partitions
*/ */
#define PART_ROOT A #define PART_ROOT PART_A
#define PART_SWAP B #define PART_SWAP PART_B
#define PART_RAW C #define PART_RAW PART_C
#define PART_USR G /* Can be after PART_FIRST_FREE */ #define PART_USR PART_G /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE D #define PART_FIRST_FREE PART_D
#define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */ #define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */
#define DEFROOTSIZE 64 /* Default root size */ #define DEFROOTSIZE 64 /* Default root size */

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.15 2003/07/25 08:26:31 dsl Exp $ */ /* $NetBSD: md.h,v 1.16 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -44,7 +44,7 @@
#define XNEEDMB 50 #define XNEEDMB 50
/* Size of boot partition */ /* Size of boot partition */
#define PART_BOOT D #define PART_BOOT PART_D
#define BOOT_HIGH #define BOOT_HIGH
#define BOOT_SIZE 80 #define BOOT_SIZE 80

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.14 2003/10/19 20:17:33 dsl Exp $ */ /* $NetBSD: md.c,v 1.15 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -91,7 +91,7 @@ md_post_disklabel()
/* Sector forwarding / badblocks ... */ /* Sector forwarding / badblocks ... */
if (*doessf) { if (*doessf) {
msg_display(MSG_dobad144); msg_display(MSG_dobad144);
return (run_prog(RUN_DISPLAY, NULL, "/usr/sbin/bad144 %s 0", return (run_program(RUN_DISPLAY, "/usr/sbin/bad144 %s 0",
diskdev)); diskdev));
} }
@ -141,9 +141,9 @@ md_cleanup_install()
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.10 2003/07/25 08:26:31 dsl Exp $ */ /* $NetBSD: md.h,v 1.11 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -47,11 +47,11 @@
#include "mbr.h" #include "mbr.h"
#define PART_ROOT A #define PART_ROOT PART_A
#define PART_SWAP B #define PART_SWAP PART_B
#define PART_RAW C #define PART_RAW PART_C
#define PART_USR D #define PART_USR PART_D
#define PART_FIRST_FREE D #define PART_FIRST_FREE PART_D
#define DEFSWAPRAM 64 /* Assume at least this RAM for swap calc */ #define DEFSWAPRAM 64 /* Assume at least this RAM for swap calc */
#define DEFROOTSIZE 32 /* Default root size */ #define DEFROOTSIZE 32 /* Default root size */

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.53 2003/10/19 20:17:33 dsl Exp $ */ /* $NetBSD: md.c,v 1.54 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -149,8 +149,9 @@ md_post_newfs(void)
printf(msg_string(MSG_dobootblks), diskdev); printf(msg_string(MSG_dobootblks), diskdev);
cp_to_target("/usr/mdec/boot.pmax", "/boot.pmax"); cp_to_target("/usr/mdec/boot.pmax", "/boot.pmax");
run_prog(RUN_DISPLAY, "Warning: disk is probably not bootable", if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/sbin/installboot /dev/r%sc /usr/mdec/bootxx_ffs", diskdev); "/usr/sbin/installboot /dev/r%sc /usr/mdec/bootxx_ffs", diskdev))
process_menu(MENU_ok, "Warning: disk is probably not bootable");
return 0; return 0;
} }
@ -201,9 +202,9 @@ md_cleanup_install(void)
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.26 2003/07/25 08:26:32 dsl Exp $ */ /* $NetBSD: md.h,v 1.27 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -43,11 +43,11 @@
/* /*
* Symbolic names for disk partitions. * Symbolic names for disk partitions.
*/ */
#define PART_ROOT A #define PART_ROOT PART_A
#define PART_SWAP B #define PART_SWAP PART_B
#define PART_RAW C #define PART_RAW PART_C
#define PART_USR D /* Can be after PART_FIRST_FREE */ #define PART_USR PART_D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE E #define PART_FIRST_FREE PART_E
#define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */ #define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */
#define DEFROOTSIZE 64 /* Default root size */ #define DEFROOTSIZE 64 /* Default root size */

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.18 2003/10/19 20:17:33 dsl Exp $ */ /* $NetBSD: md.c,v 1.19 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -88,7 +88,7 @@ md_post_disklabel(void)
/* Sector forwarding / badblocks ... */ /* Sector forwarding / badblocks ... */
if (*doessf) { if (*doessf) {
msg_display(MSG_dobad144); msg_display(MSG_dobad144);
return run_prog(RUN_DISPLAY, NULL, "/usr/sbin/bad144 %s 0", return run_program(RUN_DISPLAY, "/usr/sbin/bad144 %s 0",
diskdev); diskdev);
} }
return 0; return 0;
@ -143,9 +143,9 @@ md_cleanup_install(void)
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.8 2003/07/25 08:26:32 dsl Exp $ */ /* $NetBSD: md.h,v 1.9 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -49,11 +49,11 @@
#include "mbr.h" #include "mbr.h"
/* constants and defines */ /* constants and defines */
#define PART_ROOT A #define PART_ROOT PART_A
#define PART_SWAP B #define PART_SWAP PART_B
#define PART_RAW C #define PART_RAW PART_C
#define PART_USR D /* Can be after PART_FIRST_FREE */ #define PART_USR PART_D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE E #define PART_FIRST_FREE PART_E
#define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */ #define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */
#define DEFROOTSIZE 24 /* Default root size */ #define DEFROOTSIZE 24 /* Default root size */

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.20 2003/10/19 20:17:33 dsl Exp $ */ /* $NetBSD: md.c,v 1.21 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -79,7 +79,7 @@ md_post_disklabel(void)
/* Sector forwarding / badblocks ... */ /* Sector forwarding / badblocks ... */
if (*doessf) { if (*doessf) {
printf ("%s", msg_string (MSG_dobad144)); printf ("%s", msg_string (MSG_dobad144));
return run_prog(RUN_DISPLAY, NULL, "/usr/sbin/bad144 %s 0", return run_program(RUN_DISPLAY, "/usr/sbin/bad144 %s 0",
diskdev); diskdev);
} }
return 0; return 0;
@ -90,9 +90,9 @@ md_post_newfs(void)
{ {
/* boot blocks ... */ /* boot blocks ... */
printf (msg_string(MSG_dobootblks), diskdev); printf (msg_string(MSG_dobootblks), diskdev);
run_prog (RUN_DISPLAY, NULL, run_program(RUN_DISPLAY,
"/usr/mdec/installboot -v /usr/mdec/biosboot.sym " "/usr/mdec/installboot -v /usr/mdec/biosboot.sym /dev/r%sa",
"/dev/r%sa", diskdev); diskdev);
return 0; return 0;
} }
@ -104,7 +104,7 @@ md_copy_filesystem (void)
} }
/* Copy the instbin(s) to the disk */ /* Copy the instbin(s) to the disk */
if (run_prog(RUN_DISPLAY, NULL, if (run_program(RUN_DISPLAY | RUN_PROGRESS,
"pax -X -O -r -w -pe / %s", targetroot_mnt) != 0) "pax -X -O -r -w -pe / %s", targetroot_mnt) != 0)
return 1; return 1;
@ -151,9 +151,9 @@ md_cleanup_install(void)
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.13 2003/11/13 08:03:03 sekiya Exp $ */ /* $NetBSD: md.c,v 1.14 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -114,16 +114,16 @@ md_post_disklabel(void)
{ {
set_swap(diskdev, bsdlabel); set_swap(diskdev, bsdlabel);
if (strstr(instsys.version, "(INSTALL32_IP3x)")) if (strstr(instsys.version, "(INSTALL32_IP3x)"))
return run_prog(RUN_DISPLAY, MSG_cmdfail, return run_program(RUN_DISPLAY,
"%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip3xboot", "%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip3xboot",
diskdev); diskdev);
else else
run_prog(RUN_DISPLAY, MSG_cmdfail, run_program(RUN_DISPLAY,
"%s %s", "/usr/mdec/sgivol -f -w aoutboot /usr/mdec/aoutboot", "%s %s", "/usr/mdec/sgivol -f -w aoutboot /usr/mdec/aoutboot",
diskdev); diskdev);
return run_prog(RUN_DISPLAY, MSG_cmdfail, return run_program(RUN_DISPLAY,
"%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip2xboot", "%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip2xboot",
diskdev); diskdev);
} }
int int
@ -174,9 +174,9 @@ md_cleanup_install(void)
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.14 2003/11/13 02:33:39 sekiya Exp $ */ /* $NetBSD: md.h,v 1.15 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -43,12 +43,12 @@
/* /*
* Symbolic names for disk partitions. * Symbolic names for disk partitions.
*/ */
#define PART_ROOT A #define PART_ROOT PART_A
#define PART_SWAP B #define PART_SWAP PART_B
#define PART_RAW C #define PART_RAW PART_C
#define PART_BOOT D #define PART_BOOT PART_D
#define PART_USR E /* Can be after PART_FIRST_FREE */ #define PART_USR PART_E /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE F #define PART_FIRST_FREE PART_F
#define BOOT_SIZE MEG /* Size in bytes, rounded to cylinders later */ #define BOOT_SIZE MEG /* Size in bytes, rounded to cylinders later */

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.14 2003/10/19 20:17:33 dsl Exp $ */ /* $NetBSD: md.c,v 1.15 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -158,9 +158,9 @@ md_cleanup_install(void)
#ifndef DEBUG #ifndef DEBUG
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
#endif #endif
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.40 2003/10/19 20:17:33 dsl Exp $ */ /* $NetBSD: md.c,v 1.41 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -138,9 +138,9 @@ md_post_newfs(void)
/* boot blocks ... */ /* boot blocks ... */
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, diskdev);
return (run_prog(RUN_DISPLAY, NULL, "/sbin/disklabel -W %s", diskdev) || return (run_program(RUN_DISPLAY, "/sbin/disklabel -W %s", diskdev) ||
run_prog(RUN_DISPLAY, NULL, run_program(RUN_DISPLAY, "/usr/mdec/binstall ffs %s",
"/usr/mdec/binstall ffs %s", targetroot_mnt)); targetroot_mnt));
} }
/* /*
@ -191,9 +191,9 @@ md_cleanup_install(void)
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.19 2003/07/25 08:26:34 dsl Exp $ */ /* $NetBSD: md.h,v 1.20 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -44,11 +44,11 @@
/* /*
* Symbolic names for disk partitions. * Symbolic names for disk partitions.
*/ */
#define PART_ROOT A #define PART_ROOT PART_A
#define PART_SWAP B #define PART_SWAP PART_B
#define PART_RAW C #define PART_RAW PART_C
#define PART_USR G /* Can be after PART_FIRST_FREE */ #define PART_USR PART_G /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE D #define PART_FIRST_FREE PART_D
#define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */ #define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */
#define DEFROOTSIZE 32 /* Default root size */ #define DEFROOTSIZE 32 /* Default root size */

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.14 2003/10/19 20:17:33 dsl Exp $ */ /* $NetBSD: md.c,v 1.15 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -177,14 +177,14 @@ md_cleanup_install(void)
/* Install boot blocks now that we have a full system ... */ /* Install boot blocks now that we have a full system ... */
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, diskdev);
run_prog(RUN_DISPLAY, NULL, "/sbin/disklabel -W %s", diskdev); run_program(RUN_DISPLAY, "/sbin/disklabel -W %s", diskdev);
run_prog(RUN_DISPLAY, NULL, "/usr/mdec/binstall ffs %s", targetroot_mnt); run_program(RUN_DISPLAY, "/usr/mdec/binstall ffs %s", targetroot_mnt);
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.10 2003/07/25 08:26:34 dsl Exp $ */ /* $NetBSD: md.h,v 1.11 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -44,11 +44,11 @@
/* /*
* Symbolic names for disk partitions. * Symbolic names for disk partitions.
*/ */
#define PART_ROOT A #define PART_ROOT PART_A
#define PART_SWAP B #define PART_SWAP PART_B
#define PART_RAW C #define PART_RAW PART_C
#define PART_USR G /* Can be after PART_FIRST_FREE */ #define PART_USR PART_G /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE D #define PART_FIRST_FREE PART_D
#define DEFSWAPRAM 64 /* Assume at least this RAM for swap calc */ #define DEFSWAPRAM 64 /* Assume at least this RAM for swap calc */
#define DEFROOTSIZE 64 /* Default root size */ #define DEFROOTSIZE 64 /* Default root size */

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.25 2003/10/19 20:17:33 dsl Exp $ */ /* $NetBSD: md.c,v 1.26 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -135,7 +135,7 @@ md_post_newfs(void)
{ {
printf(msg_string(MSG_dobootblks), diskdev); printf(msg_string(MSG_dobootblks), diskdev);
run_prog(0, NULL, "/sbin/installboot /dev/r%s%c %.2sboot", run_program(0, "/sbin/installboot /dev/r%s%c %.2sboot",
diskdev, 'a' + getrawpartition(), diskdev); diskdev, 'a' + getrawpartition(), diskdev);
return 0; return 0;
} }
@ -188,9 +188,9 @@ md_cleanup_install(void)
enable_rc_conf(); enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.16 2003/07/25 08:26:34 dsl Exp $ */ /* $NetBSD: md.h,v 1.17 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -44,11 +44,11 @@
/* /*
* Symbolic names for disk partitions. * Symbolic names for disk partitions.
*/ */
#define PART_ROOT A #define PART_ROOT PART_A
#define PART_SWAP B #define PART_SWAP PART_B
#define PART_RAW C #define PART_RAW PART_C
#define PART_USR D /* Can be after PART_FIRST_FREE */ #define PART_USR PART_D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE E #define PART_FIRST_FREE PART_E
#define DEFSWAPRAM 16 /* Assume at least this RAM for swap calc */ #define DEFSWAPRAM 16 /* Assume at least this RAM for swap calc */
#define DEFROOTSIZE 32 /* Default root size */ #define DEFROOTSIZE 32 /* Default root size */

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.26 2003/10/19 20:17:33 dsl Exp $ */ /* $NetBSD: md.c,v 1.27 2003/11/30 14:36:45 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -199,7 +199,7 @@ md_newdisk(void)
{ {
msg_display(MSG_newdisk, diskdev, diskdev); msg_display(MSG_newdisk, diskdev, diskdev);
return run_prog(RUN_FATAL|RUN_DISPLAY, MSG_NONE, return run_program(RUN_FATAL|RUN_DISPLAY,
"/usr/mdec/newdisk -v %s", diskdev); "/usr/mdec/newdisk -v %s", diskdev);
} }
@ -241,9 +241,10 @@ md_post_newfs(void)
/* boot blocks ... */ /* boot blocks ... */
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, diskdev);
cp_to_target("/usr/mdec/boot", "/boot"); cp_to_target("/usr/mdec/boot", "/boot");
run_prog(RUN_DISPLAY, "Warning: disk is probably not bootable", if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/mdec/installboot.new /usr/mdec/sdboot_ufs /dev/r%sa", "/usr/mdec/installboot.new /usr/mdec/sdboot_ufs /dev/r%sa",
diskdev); diskdev))
process_menu(MENU_ok, "Warning: disk is probably not bootable");
return 0; return 0;
} }
@ -272,18 +273,18 @@ int
md_check_partitions(void) md_check_partitions(void)
{ {
/* X68k partitions must be in order of the range. */ /* X68k partitions must be in order of the range. */
int part, start = 0, last = A-1; int part, start = 0, last = PART_A-1;
for (part = A; part < 8; part++) { for (part = PART_A; part < 8; part++) {
if (part == C) if (part == PART_C)
continue; continue;
if (last >= A && bsdlabel[part].pi_size > 0) { if (last >= PART_A && bsdlabel[part].pi_size > 0) {
msg_display(MSG_emptypart, part+'a'); msg_display(MSG_emptypart, part+'a');
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return 0; return 0;
} }
if (bsdlabel[part].pi_size == 0) { if (bsdlabel[part].pi_size == 0) {
if (last < A) if (last < PART_A)
last = part; last = part;
} else { } else {
if (start >= bsdlabel[part].pi_offset) { if (start >= bsdlabel[part].pi_offset) {
@ -319,9 +320,9 @@ md_cleanup_install(void)
#ifdef notyet /* sed is too large for ramdisk */ #ifdef notyet /* sed is too large for ramdisk */
enable_rc_conf(); enable_rc_conf();
#endif #endif
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst")); run_program(0, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap")); run_program(0, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile")); run_program(0, "rm -f %s", target_expand("/.profile"));
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.h,v 1.13 2003/07/25 08:26:35 dsl Exp $ */ /* $NetBSD: md.h,v 1.14 2003/11/30 14:36:46 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -52,11 +52,11 @@
/* /*
* Symbolic names for disk partitions. * Symbolic names for disk partitions.
*/ */
#define PART_ROOT A #define PART_ROOT PART_A
#define PART_SWAP B #define PART_SWAP PART_B
#define PART_RAW C #define PART_RAW PART_C
#define PART_USR D /* Can be after PART_FIRST_FREE */ #define PART_USR PART_D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE E #define PART_FIRST_FREE PART_E
#define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */ #define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */
#define DEFROOTSIZE 20 /* Default root size */ #define DEFROOTSIZE 20 /* Default root size */

View File

@ -1,4 +1,4 @@
/* $NetBSD: bsddisklabel.c,v 1.25 2003/11/20 09:47:53 dsl Exp $ */ /* $NetBSD: bsddisklabel.c,v 1.26 2003/11/30 14:36:43 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -65,10 +65,10 @@
/* Defaults for things that might be defined in md.h */ /* Defaults for things that might be defined in md.h */
#ifndef PART_ROOT #ifndef PART_ROOT
#define PART_ROOT A #define PART_ROOT PART_A
#endif #endif
#ifndef PART_SWAP #ifndef PART_SWAP
#define PART_SWAP B #define PART_SWAP PART_B
#endif #endif
#ifndef PART_USR #ifndef PART_USR
#define PART_USR PART_ANY #define PART_USR PART_ANY
@ -555,15 +555,15 @@ make_bsd_partitions(void)
/* Whole disk partition */ /* Whole disk partition */
part_raw = getrawpartition(); part_raw = getrawpartition();
if (part_raw == -1) if (part_raw == -1)
part_raw = C; /* for sanity... */ part_raw = PART_C; /* for sanity... */
bsdlabel[part_raw].pi_offset = 0; bsdlabel[part_raw].pi_offset = 0;
bsdlabel[part_raw].pi_size = dlsize; bsdlabel[part_raw].pi_size = dlsize;
if (part_raw == D) { if (part_raw == PART_D) {
/* Probably a system that expects an i386 style mbr */ /* Probably a system that expects an i386 style mbr */
part_bsd = C; part_bsd = PART_C;
bsdlabel[C].pi_offset = ptstart; bsdlabel[PART_C].pi_offset = ptstart;
bsdlabel[C].pi_size = ptsize; bsdlabel[PART_C].pi_size = ptsize;
} else { } else {
part_bsd = part_raw; part_bsd = part_raw;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: defs.h,v 1.106 2003/11/15 12:53:34 sekiya Exp $ */ /* $NetBSD: defs.h,v 1.107 2003/11/30 14:36:43 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -45,11 +45,18 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/disklabel.h> #include <sys/disklabel.h>
extern const char * const fstypenames[]; extern const char * const fstypenames[];
extern const char * const mountnames[];
static inline void *
deconst(const void *p)
{
return (char *)0 + ((const char *)p - (const char *)0);
}
#include "msg_defs.h" #include "msg_defs.h"
#define min(a,b) ((a) < (b) ? (a) : (b)) #define min(a,b) ((a) < (b) ? (a) : (b))
#define max(a,b) ((a) > (b) ? (a) : (b)) #define max(a,b) ((a) > (b) ? (a) : (b))
/* Define for external varible use */ /* Define for external varible use */
#ifdef MAIN #ifdef MAIN
@ -66,8 +73,8 @@ extern const char * const fstypenames[];
#define SSTRSIZE 30 #define SSTRSIZE 30
/* For run.c: collect() */ /* For run.c: collect() */
#define T_FILE 0 #define T_FILE 0
#define T_OUTPUT 1 #define T_OUTPUT 1
/* run_prog flags */ /* run_prog flags */
#define RUN_DISPLAY 0x0001 /* Display program output */ #define RUN_DISPLAY 0x0001 /* Display program output */
@ -75,9 +82,10 @@ extern const char * const fstypenames[];
#define RUN_CHROOT 0x0004 /* chroot to target disk */ #define RUN_CHROOT 0x0004 /* chroot to target disk */
#define RUN_FULLSCREEN 0x0008 /* fullscreen (use with RUN_DISPLAY) */ #define RUN_FULLSCREEN 0x0008 /* fullscreen (use with RUN_DISPLAY) */
#define RUN_SILENT 0x0010 /* Do not show output */ #define RUN_SILENT 0x0010 /* Do not show output */
#define RUN_DISPLAY_ERR 0x0020 /* Display on error */ #define RUN_SILENT_ERR 0x0020 /* Remain silent even if cmd fails */
#define RUN_ERROR_OK 0x0040 /* Don't wait for error confirmation */ #define RUN_ERROR_OK 0x0040 /* Don't wait for error confirmation */
#define RUN_PROGRESS 0x0080 /* Output is just progess test */ #define RUN_PROGRESS 0x0080 /* Output is just progess test */
#define RUN_NO_CLEAR 0x0100 /* Leave program output after error */
/* Installation sets */ /* Installation sets */
#define SET_KERNEL 0x000000ffu /* allow 8 kernels */ #define SET_KERNEL 0x000000ffu /* allow 8 kernels */
@ -108,18 +116,18 @@ extern const char * const fstypenames[];
#define SET_X11_MISC 0x02000000u /* X11 miscelllaneous */ #define SET_X11_MISC 0x02000000u /* X11 miscelllaneous */
#define SET_MD 0xf0000000u /* All machine dependant sets */ #define SET_MD 0xf0000000u /* All machine dependant sets */
#define SET_MD_1 0x10000000u /* Machine dependant set */ #define SET_MD_1 0x10000000u /* Machine dependant set */
#define SET_MD_2 0x20000000u /* Machine dependant set */ #define SET_MD_2 0x20000000u /* Machine dependant set */
#define SET_MD_3 0x40000000u /* Machine dependant set */ #define SET_MD_3 0x40000000u /* Machine dependant set */
#define SET_MD_4 0x80000000u /* Machine dependant set */ #define SET_MD_4 0x80000000u /* Machine dependant set */
/* Macros */ /* Macros */
#define nelem(x) (sizeof (x) / sizeof *(x)) #define nelem(x) (sizeof (x) / sizeof *(x))
/* Round up to the next full cylinder size */ /* Round up to the next full cylinder size */
#define ROUNDDOWN(n,d) (((n)/(d)) * (d)) #define ROUNDDOWN(n,d) (((n)/(d)) * (d))
#define DIVUP(n,d) (((n) + (d) - 1) / (d)) #define DIVUP(n,d) (((n) + (d) - 1) / (d))
#define ROUNDUP(n,d) (DIVUP((n), (d)) * (d)) #define ROUNDUP(n,d) (DIVUP((n), (d)) * (d))
#define NUMSEC(size, sizemult, cylsize) \ #define NUMSEC(size, sizemult, cylsize) \
((size) == -1 ? -1 : (sizemult) == 1 ? (size) : \ ((size) == -1 ? -1 : (sizemult) == 1 ? (size) : \
ROUNDUP((size) * (sizemult), (cylsize))) ROUNDUP((size) * (sizemult), (cylsize)))
@ -144,10 +152,11 @@ typedef struct _partinfo {
#define pi_frag pi_partition.p_frag #define pi_frag pi_partition.p_frag
#define pi_cpg pi_partition.p_cpg #define pi_cpg pi_partition.p_cpg
char pi_mount[20]; char pi_mount[20];
uint pi_isize; /* bytes per inode */ uint pi_isize; /* bytes per inode (for # inodes) */
uint pi_flags; uint pi_flags;
#define PIF_NEWFS 0x0001 /* need to 'newfs' partition */ #define PIF_NEWFS 0x0001 /* need to 'newfs' partition */
#define PIF_MOUNT 0x0002 /* need to mount partition */ #define PIF_FFSv2 0x0002 /* newfs with FFSv2, not FFSv1 */
#define PIF_MOUNT 0x0004 /* need to mount partition */
#define PIF_ASYNC 0x0010 /* mount -o async */ #define PIF_ASYNC 0x0010 /* mount -o async */
#define PIF_NOATIME 0x0020 /* mount -o noatime */ #define PIF_NOATIME 0x0020 /* mount -o noatime */
#define PIF_NODEV 0x0040 /* mount -o nodev */ #define PIF_NODEV 0x0040 /* mount -o nodev */
@ -202,7 +211,8 @@ EXTERN int current_cylsize;
EXTERN int root_limit; EXTERN int root_limit;
/* Information for the NetBSD disklabel */ /* Information for the NetBSD disklabel */
enum DLTR {A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z}; enum DLTR { PART_A, PART_B, PART_C, PART_D, PART_E, PART_F, PART_G, PART_H,
PART_I, PART_J, PART_K, PART_L, PART_M, PART_N, PART_O, PART_P};
#define partition_name(x) ('a' + (x)) #define partition_name(x) ('a' + (x))
EXTERN partinfo oldlabel[MAXPARTITIONS]; /* What we found on the disk */ EXTERN partinfo oldlabel[MAXPARTITIONS]; /* What we found on the disk */
EXTERN partinfo bsdlabel[MAXPARTITIONS]; /* What we want it to look like */ EXTERN partinfo bsdlabel[MAXPARTITIONS]; /* What we want it to look like */
@ -218,15 +228,15 @@ EXTERN int clean_dist_dir INIT(0);
/* Absolute path name where the distribution should be extracted from. */ /* Absolute path name where the distribution should be extracted from. */
#if !defined(SYSINST_FTP_HOST) #if !defined(SYSINST_FTP_HOST)
#define SYSINST_FTP_HOST "ftp.NetBSD.org" #define SYSINST_FTP_HOST "ftp.NetBSD.org"
#endif #endif
#if !defined(SYSINST_FTP_DIR) #if !defined(SYSINST_FTP_DIR)
#define SYSINST_FTP_DIR "pub/NetBSD/NetBSD-" REL "/" MACH #define SYSINST_FTP_DIR "pub/NetBSD/NetBSD-" REL "/" MACH
#endif #endif
#if !defined(SYSINST_CDROM_DIR) #if !defined(SYSINST_CDROM_DIR)
#define SYSINST_CDROM_DIR "/" MACH #define SYSINST_CDROM_DIR "/" MACH
#endif #endif
EXTERN char ext_dir[STRSIZE] INIT(""); EXTERN char ext_dir[STRSIZE] INIT("");
@ -260,13 +270,6 @@ extern unsigned int sets_valid;
extern unsigned int sets_selected; extern unsigned int sets_selected;
extern unsigned int sets_installed; extern unsigned int sets_installed;
/* Variables for upgrade. */
#if 0
#define MAXFS 16
EXTERN char fs_dev[MAXFS][STRSIZE];
EXTERN char fs_mount[MAXFS][STRSIZE];
#endif
/* needed prototypes */ /* needed prototypes */
void set_menu_numopts(int, int); void set_menu_numopts(int, int);
@ -296,7 +299,7 @@ void disp_cur_fspart(int, int);
int write_disklabel(void); int write_disklabel(void);
int make_filesystems(void); int make_filesystems(void);
int make_fstab(void); int make_fstab(void);
int fsck_disks(void); int mount_disks(void);
int set_swap(const char *, partinfo *); int set_swap(const char *, partinfo *);
int check_swap(const char *, int); int check_swap(const char *, int);
@ -304,7 +307,6 @@ int check_swap(const char *, int);
int fs_is_lfs(void *); int fs_is_lfs(void *);
/* from label.c */ /* from label.c */
const char *get_last_mounted(int, int); const char *get_last_mounted(int, int);
void emptylabel(partinfo *); void emptylabel(partinfo *);
int savenewlabel(partinfo *, int); int savenewlabel(partinfo *, int);
@ -312,8 +314,9 @@ int incorelabel(const char *, partinfo *);
int edit_and_check_label(partinfo *, int, int, int); int edit_and_check_label(partinfo *, int, int, int);
int getpartoff(int); int getpartoff(int);
int getpartsize(int, int); int getpartsize(int, int);
int set_bsize(partinfo *, int); void set_bsize(partinfo *, int);
int set_fsize(partinfo *, int); void set_fsize(partinfo *, int);
void set_ptype(partinfo *, int, int, int);
/* from install.c */ /* from install.c */
void do_install(void); void do_install(void);
@ -338,7 +341,7 @@ void mnt_net_config(void);
/* From run.c */ /* From run.c */
int collect(int, char **, const char *, ...); int collect(int, char **, const char *, ...);
int run_prog(int, msg, const char *, ...); int run_program(int, const char *, ...);
void do_logging(void); void do_logging(void);
int do_system(const char *); int do_system(const char *);
@ -348,7 +351,6 @@ void do_reinstall_sets(void);
void restore_etc(void); void restore_etc(void);
/* from util.c */ /* from util.c */
int askyesno(int);
int dir_exists_p(const char *); int dir_exists_p(const char *);
int file_exists_p(const char *); int file_exists_p(const char *);
int file_mode_match(const char *, unsigned int); int file_mode_match(const char *, unsigned int);
@ -402,7 +404,7 @@ int cp_to_target(const char *, const char *);
void dup_file_into_target(const char *); void dup_file_into_target(const char *);
void mv_within_target_or_die(const char *, const char *); void mv_within_target_or_die(const char *, const char *);
int cp_within_target(const char *, const char *); int cp_within_target(const char *, const char *);
int target_mount(const char *, const char *, const char *); int target_mount(const char *, const char *, int, const char *);
int target_test(unsigned int, const char *); int target_test(unsigned int, const char *);
int target_dir_exists_p(const char *); int target_dir_exists_p(const char *);
int target_file_exists_p(const char *); int target_file_exists_p(const char *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: disks.c,v 1.73 2003/10/19 20:17:31 dsl Exp $ */ /* $NetBSD: disks.c,v 1.74 2003/11/30 14:36:43 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -51,6 +51,7 @@
#include <ufs/ufs/dinode.h> #include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h> #include <ufs/ffs/fs.h>
#define FSTYPENAMES #define FSTYPENAMES
#define MOUNTNAMES
#define static #define static
#include <sys/disklabel.h> #include <sys/disklabel.h>
#undef static #undef static
@ -80,14 +81,9 @@ struct disk_desc {
#define dd_totsec dg.dg_totsec #define dd_totsec dg.dg_totsec
/* Local prototypes */ /* Local prototypes */
static void foundffs(struct data *, size_t); static int foundffs(struct data *, size_t);
static int do_fsck(const char *); static int mount_root(void);
static int fsck_root(void); static int fsck_preen(const char *, int, const char *);
static int do_flfs_newfs(const char *, int, const char *);
static int fsck_num(const char *);
static int fsck_with_error_menu(const char *);
static int target_mount_with_error_menu(const char *, char *, const char *);
#ifndef DISK_NAMES #ifndef DISK_NAMES
#define DISK_NAMES "wd", "sd", "ld" #define DISK_NAMES "wd", "sd", "ld"
@ -210,21 +206,28 @@ fmt_fspart(menudesc *m, int ptn, void *arg)
int poffset, psize, pend; int poffset, psize, pend;
const char *desc; const char *desc;
static const char *Yes, *No; static const char *Yes, *No;
partinfo *p = bsdlabel + ptn;
if (Yes == NULL) { if (Yes == NULL) {
Yes = msg_string(MSG_Yes); Yes = msg_string(MSG_Yes);
No = msg_string(MSG_No); No = msg_string(MSG_No);
} }
poffset = bsdlabel[ptn].pi_offset / sizemult; poffset = p->pi_offset / sizemult;
psize = bsdlabel[ptn].pi_size / sizemult; psize = p->pi_size / sizemult;
if (psize == 0) if (psize == 0)
pend = 0; pend = 0;
else else
pend = (bsdlabel[ptn].pi_offset + pend = (p->pi_offset + p->pi_size) / sizemult - 1;
bsdlabel[ptn].pi_size) / sizemult - 1;
if (p->pi_fstype == FS_BSDFFS)
if (p->pi_flags & PIF_FFSv2)
desc = "FFSv2";
else
desc = "FFSv1";
else
desc = fstypenames[p->pi_fstype];
desc = fstypenames[bsdlabel[ptn].pi_fstype];
#ifdef PART_BOOT #ifdef PART_BOOT
if (ptn == PART_BOOT) if (ptn == PART_BOOT)
desc = msg_string(MSG_Boot_partition_cant_change); desc = msg_string(MSG_Boot_partition_cant_change);
@ -232,17 +235,15 @@ fmt_fspart(menudesc *m, int ptn, void *arg)
if (ptn == getrawpartition()) if (ptn == getrawpartition())
desc = msg_string(MSG_Whole_disk_cant_change); desc = msg_string(MSG_Whole_disk_cant_change);
else { else {
if (ptn == C) if (ptn == PART_C)
desc = msg_string(MSG_NetBSD_partition_cant_change); desc = msg_string(MSG_NetBSD_partition_cant_change);
} }
wprintw(m->mw, msg_string(MSG_fspart_row), wprintw(m->mw, msg_string(MSG_fspart_row),
poffset, pend, psize, desc, poffset, pend, psize, desc,
PI_ISBSDFS(&bsdlabel[ptn]) ? p->pi_flags & PIF_NEWFS ? Yes : "",
bsdlabel[ptn].pi_flags & PIF_NEWFS ? Yes : No : "", p->pi_flags & PIF_MOUNT ? Yes : "",
bsdlabel[ptn].pi_mount[0] == '/' ? p->pi_mount);
bsdlabel[ptn].pi_flags & PIF_MOUNT ? Yes : No : "",
bsdlabel[ptn].pi_mount);
} }
/* /*
@ -262,8 +263,7 @@ write_disklabel (void)
#ifdef DISKLABEL_CMD #ifdef DISKLABEL_CMD
/* disklabel the disk */ /* disklabel the disk */
return run_prog(RUN_DISPLAY, MSG_cmdfail, return run_program(RUN_DISPLAY, "%s -f /tmp/disktab %s '%s'",
"%s -f /tmp/disktab %s '%s'",
DISKLABEL_CMD, diskdev, bsddiskname); DISKLABEL_CMD, diskdev, bsddiskname);
#else #else
return 0; return 0;
@ -284,9 +284,12 @@ make_filesystems(void)
int i; int i;
int ptn; int ptn;
int ptn_order[nelem(bsdlabel)]; int ptn_order[nelem(bsdlabel)];
char partname[STRSIZE]; int error = 0;
int error;
int maxpart = getmaxpartitions(); int maxpart = getmaxpartitions();
char *newfs;
const char *mnt_opts;
const char *fsname;
partinfo *lbl;
if (maxpart > nelem(bsdlabel)) if (maxpart > nelem(bsdlabel))
maxpart = nelem(bsdlabel); maxpart = nelem(bsdlabel);
@ -305,62 +308,68 @@ make_filesystems(void)
* point defined, or is marked preserve, don't touch it! * point defined, or is marked preserve, don't touch it!
*/ */
ptn = ptn_order[i]; ptn = ptn_order[i];
if (!PI_ISBSDFS(&bsdlabel[ptn])) lbl = bsdlabel + ptn;
continue;
if (is_active_rootpart(diskdev, ptn)) if (is_active_rootpart(diskdev, ptn))
continue; continue;
snprintf(partname, STRSIZE, "%s%c", diskdev, 'a' + ptn);
error = do_flfs_newfs(partname, ptn, bsdlabel[ptn].pi_mount);
if (error)
return error;
}
return 0;
}
/* newfs and mount an ffs filesystem. */ if (*lbl->pi_mount == 0)
static int /* No mount point */
do_flfs_newfs(const char *partname, int partno, const char *mountpoint) continue;
{
char dev_name[STRSIZE];
char options[16];
int error;
const char *newfs;
if (!*mountpoint) newfs = NULL;
return 0; mnt_opts = NULL;
fsname = NULL;
if (bsdlabel[partno].pi_flags & PIF_NEWFS) { switch (lbl->pi_fstype) {
switch (bsdlabel[partno].pi_fstype) { case FS_APPLEUFS:
asprintf(&newfs, "/sbin/newfs %s%.0d",
lbl->pi_isize != 0 ? "-i" : "", lbl->pi_isize);
mnt_opts = "-tffs -o async";
fsname = "ffs";
break;
case FS_BSDFFS: case FS_BSDFFS:
newfs = "/sbin/newfs"; asprintf(&newfs, "/sbin/newfs -O %d -b %d -f %d %s%.0d",
lbl->pi_flags & PIF_FFSv2 ? 2 : 1,
lbl->pi_fsize * lbl->pi_frag, lbl->pi_fsize,
lbl->pi_isize != 0 ? "-i" : "", lbl->pi_isize);
mnt_opts = "-tffs -o async";
fsname = "ffs";
break; break;
case FS_BSDLFS: case FS_BSDLFS:
newfs = "/sbin/newfs_lfs"; asprintf(&newfs, "/sbin/newfs_lfs -b %d",
lbl->pi_fsize * lbl->pi_frag);
mnt_opts = "-tlfs";
fsname = "lfs";
break;
case FS_MSDOS:
mnt_opts = "-tmsdos";
fsname = "msdos";
break; break;
default:
return 0;
} }
if (bsdlabel[partno].pi_isize > 0) if (lbl->pi_flags & PIF_NEWFS && newfs != NULL) {
snprintf(options, sizeof options, " -i%d", error = run_program(RUN_DISPLAY | RUN_PROGRESS,
bsdlabel[partno].pi_isize); "%s /dev/r%s%c", newfs, diskdev, 'a' + ptn);
else } else {
options[0] = 0; /* We'd better check it isn't dirty */
error = run_prog(RUN_DISPLAY | RUN_PROGRESS, MSG_cmdfail, error = fsck_preen(diskdev, ptn, fsname);
"%s%s /dev/r%s", newfs, options, partname); }
} else free(newfs);
error = 0; if (error != 0)
return error;
if (error == 0 && bsdlabel[partno].pi_flags & PIF_MOUNT) { if (lbl->pi_flags & PIF_MOUNT && mnt_opts != NULL) {
snprintf(dev_name, sizeof(dev_name), "/dev/%s", partname); make_target_dir(lbl->pi_mount);
make_target_dir(mountpoint); error = target_mount(mnt_opts, diskdev, ptn,
error = target_mount(bsdlabel[partno].pi_fstype == FS_BSDFFS ? lbl->pi_mount);
"-v -o async" : "-v", dev_name, mountpoint); if (error) {
if (error) { msg_display(MSG_mountfail,
msg_display(MSG_mountfail, dev_name, mountpoint); diskdev, 'a' + ptn, lbl->pi_mount);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return error;
}
} }
} }
return error; return 0;
} }
int int
@ -414,7 +423,7 @@ make_fstab(void)
fstype = "lfs"; fstype = "lfs";
/* FALLTHROUGH */ /* FALLTHROUGH */
case FS_BSDFFS: case FS_BSDFFS:
fsck_pass = fsck_num(mp); fsck_pass = (strcmp(mp, "/") == 0) ? 1 : 2;
dump_freq = 1; dump_freq = 1;
break; break;
case FS_MSDOS: case FS_MSDOS:
@ -468,167 +477,100 @@ make_fstab(void)
return 0; return 0;
} }
/* Return the appropriate fs_passno field, as specified by fstab(5) */
static int static int
fsck_num(const char *mp)
{
return (strcmp(mp, "/") == 0) ? 1 : 2;
}
/* Get information on the file systems mounted from the root filesystem.
* Offer to convert them into 4.4BSD inodes if they are not 4.4BSD
* inodes. Fsck them. Mount them.
*/
static struct lookfor fstabbuf[] = {
{"/dev/", "/dev/%s %s ffs %s", "c", NULL, 0, 0, foundffs},
{"/dev/", "/dev/%s %s ufs %s", "c", NULL, 0, 0, foundffs},
};
static size_t numfstabbuf = sizeof(fstabbuf) / sizeof(struct lookfor);
#define MAXDEVS 40
static char dev[MAXDEVS][SSTRSIZE];
static char mnt[MAXDEVS][STRSIZE];
static int devcnt = 0;
static void
/*ARGSUSED*/ /*ARGSUSED*/
foundffs(struct data *list, size_t num) foundffs(struct data *list, size_t num)
{ {
if (strcmp(list[1].u.s_val, "/") != 0 && int error;
strstr(list[2].u.s_val, "noauto") == NULL) {
strncpy(dev[devcnt], list[0].u.s_val, SSTRSIZE);
strncpy(mnt[devcnt], list[1].u.s_val, STRSIZE);
devcnt++;
}
}
/* if (num < 2 || strcmp(list[1].u.s_val, "/") == 0 ||
* Run a check on the specified filesystem. strstr(list[2].u.s_val, "noauto") != NULL)
*/ return 0;
static int
do_fsck(const char *diskpart)
{
char rraw[SSTRSIZE];
const char *prog = "/sbin/fsck";
int err;
/* cons up raw partition name. */ error = fsck_preen(list[0].u.s_val, ' '-'a', "ffs");
snprintf (rraw, sizeof(rraw), "/dev/r%s", diskpart); if (error != 0)
return error;
#ifndef DEBUG_SETS error = target_mount("", list[0].u.s_val, ' '-'a', list[1].u.s_val);
err = run_prog(RUN_DISPLAY, NULL, "%s %s", prog, rraw); if (error != 0)
#else return error;
err = run_prog(RUN_DISPLAY, NULL, "%s -f %s", prog, rraw); return 0;
#endif
wrefresh(stdscr);
return err;
} }
/* /*
* Do an fsck. On failure, inform the user by showing a warning * Do an fsck. On failure, inform the user by showing a warning
* message and doing menu_ok() before proceeding. * message and doing menu_ok() before proceeding.
* acknowledge the warning before continuing. * Returns 0 on success, or nonzero return code from fsck() on failure.
* Returns 0 on success, or nonzero return code from do_fsck() on failure.
*/ */
int static int
fsck_with_error_menu(const char *diskpart) fsck_preen(const char *disk, int ptn, const char *fsname)
{ {
char *prog;
int error; int error;
if ((error = do_fsck(diskpart)) != 0) { ptn += 'a';
#ifdef DEBUG if (fsname == NULL)
fprintf(stderr, "sysinst: do_fsck() returned err %d\n", error); return 0;
#endif /* first check fsck program exists, if not assue ok */
msg_display(MSG_badfs, diskpart, "", error); asprintf(&prog, "/sbin/fsck_%s", fsname);
if (prog == NULL)
return 0;
if (access(prog, X_OK) != 0)
return 0;
error = run_program(0, "%s -p -q /dev/r%s%c", prog, disk, ptn);
free(prog);
if (error != 0) {
msg_display(MSG_badfs, disk, ptn, error);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
} }
return error; return error;
} }
/*
* Do target_mount, but print a message and do menu_ok() before
* proceeding, to inform the user.
* returns 0 if the mount completed without indicating errors,
* and an nonzero error code from target_mount() otherwise.
*/
int
target_mount_with_error_menu(const char *opt,
char *diskpart, const char *mntpoint)
{
int error;
char dev_name[STRSIZE];
snprintf(dev_name, sizeof(dev_name), "/dev/%s", diskpart);
#ifdef DEBUG
fprintf(stderr, "sysinst: mount_with_error_menu: %s %s %s\n",
opt, dev_name, mntpoint);
#endif
if ((error = target_mount(opt, dev_name, mntpoint)) != 0) {
msg_display (MSG_badmount, dev_name, "");
process_menu (MENU_ok, NULL);
return error;
} else {
#ifdef DEBUG
printf("mount %s %s %s OK\n", opt, diskpart, mntpoint);
#endif
}
return error;
}
/* /*
* fsck and mount the root partition. * fsck and mount the root partition.
*/ */
int int
fsck_root(void) mount_root(void)
{ {
int error; int error;
char rootdev[STRSIZE];
/* cons up the root name: partition 'a' on the target diskdev.*/ error = fsck_preen(diskdev, rootpart, "ffs");
snprintf(rootdev, STRSIZE, "%s%c", diskdev, 'a' + rootpart);
#ifdef DEBUG
printf("fsck_root: rootdev is %s\n", rootdev);
#endif
error = fsck_with_error_menu(rootdev);
if (error != 0) if (error != 0)
return error; return error;
if (target_already_root()) {
return (0);
}
/* Mount /dev/<diskdev>a on target's "". /* Mount /dev/<diskdev>a on target's "".
* If we pass "" as mount-on, Prefixing will DTRT. * If we pass "" as mount-on, Prefixing will DTRT.
* for now, use no options. * for now, use no options.
* XXX consider -o remount in case target root is * XXX consider -o remount in case target root is
* current root, still readonly from single-user? * current root, still readonly from single-user?
*/ */
error = target_mount_with_error_menu("", rootdev, ""); return target_mount("", diskdev, rootpart, "");
#ifdef DEBUG
printf("fsck_root: mount of %s returns %d\n", rootdev, error);
#endif
return (error);
} }
/* Get information on the file systems mounted from the root filesystem.
* Offer to convert them into 4.4BSD inodes if they are not 4.4BSD
* inodes. Fsck them. Mount them.
*/
int int
fsck_disks(void) mount_disks(void)
{ {
char *fstab; char *fstab;
int fstabsize; int fstabsize;
int i; int i;
int error; int error;
static struct lookfor fstabbuf[] = {
{"/dev/", "/dev/%s %s ffs %s", "c", NULL, 0, 0, foundffs},
{"/dev/", "/dev/%s %s ufs %s", "c", NULL, 0, 0, foundffs},
};
static size_t numfstabbuf = sizeof(fstabbuf) / sizeof(struct lookfor);
/* First the root device. */ /* First the root device. */
if (!target_already_root()) { if (!target_already_root()) {
error = fsck_root(); error = mount_root();
if (error != 0 && error != EBUSY) if (error != 0 && error != EBUSY)
return 0; return 0;
} }
@ -650,21 +592,10 @@ fsck_disks(void)
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return 0; return 0;
} }
walk(fstab, (size_t)fstabsize, fstabbuf, numfstabbuf); error = walk(fstab, (size_t)fstabsize, fstabbuf, numfstabbuf);
free(fstab); free(fstab);
for (i = 0; i < devcnt; i++) { return error;
if (fsck_with_error_menu(dev[i]))
return 0;
#ifdef DEBUG
printf("sysinst: mount %s\n", dev[i]);
#endif
if (target_mount_with_error_menu("", dev[i], mnt[i]) != 0)
return 0;
}
return 1;
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: label.c,v 1.41 2003/10/19 20:17:31 dsl Exp $ */ /* $NetBSD: label.c,v 1.42 2003/11/30 14:36:43 dsl Exp $ */
/* /*
* Copyright 1997 Jonathan Stone * Copyright 1997 Jonathan Stone
@ -36,7 +36,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: label.c,v 1.41 2003/10/19 20:17:31 dsl Exp $"); __RCSID("$NetBSD: label.c,v 1.42 2003/11/30 14:36:43 dsl Exp $");
#endif #endif
#include <sys/types.h> #include <sys/types.h>
@ -145,13 +145,16 @@ check_one_root(partinfo *lp, int nparts)
int foundroot = 0; int foundroot = 0;
for (part = 0; part < nparts; lp++, part++) { for (part = 0; part < nparts; lp++, part++) {
#if 0
if (!PI_ISBSDFS(lp)) if (!PI_ISBSDFS(lp))
continue; continue;
#endif
if (!(lp->pi_flags & PIF_MOUNT)) if (!(lp->pi_flags & PIF_MOUNT))
continue; continue;
if (strcmp(lp->pi_mount, "/") != 0) if (strcmp(lp->pi_mount, "/") != 0)
continue; continue;
if (foundroot) if (foundroot)
/* Duplicate */
return 0; return 0;
foundroot = 1; foundroot = 1;
/* Save partition number, a few things need to know it */ /* Save partition number, a few things need to know it */
@ -192,7 +195,15 @@ edit_fs_size(menudesc *m, void *arg)
return 0; return 0;
} }
int void
set_ptype(partinfo *p, int fstype, int flag, int bsize)
{
p->pi_fstype = fstype;
p->pi_flags = (p->pi_flags & ~PIF_FFSv2) | flag;
set_bsize(p, bsize);
}
void
set_bsize(partinfo *p, int size) set_bsize(partinfo *p, int size)
{ {
int frags, sz; int frags, sz;
@ -208,11 +219,9 @@ set_bsize(partinfo *p, int size)
p->pi_frag = frags; p->pi_frag = frags;
p->pi_fsize = size / frags; p->pi_fsize = size / frags;
return 0;
} }
int void
set_fsize(partinfo *p, int fsize) set_fsize(partinfo *p, int fsize)
{ {
int bsz = p->pi_fsize * p->pi_frag; int bsz = p->pi_fsize * p->pi_frag;
@ -225,7 +234,6 @@ set_fsize(partinfo *p, int fsize)
p->pi_fsize = fsize; p->pi_fsize = fsize;
p->pi_frag = frags; p->pi_frag = frags;
return 0;
} }
static int static int
@ -266,14 +274,6 @@ edit_fs_mountpt(menudesc *m, void *arg)
partinfo *p = arg; partinfo *p = arg;
char buff[4]; char buff[4];
if (!PI_ISBSDFS(p) && p->pi_fstype != FS_MSDOS) {
msg_prompt_win(MSG_nomount, -1, 18, 0, 0,
"OK", buff, sizeof buff,
'a' + p - bsdlabel);
p->pi_mount[0] = 0;
return 0;
}
msg_prompt_win(MSG_mountpoint, -1, 18, 0, 0, msg_prompt_win(MSG_mountpoint, -1, 18, 0, 0,
p->pi_mount, p->pi_mount, sizeof p->pi_mount); p->pi_mount, p->pi_mount, sizeof p->pi_mount);
@ -337,14 +337,14 @@ edit_ptn(menudesc *menu, void *arg)
{NULL, OPT_NOMENU, 0, edit_fs_size}, {NULL, OPT_NOMENU, 0, edit_fs_size},
#define PTN_MENU_END 3 #define PTN_MENU_END 3
{NULL, OPT_NOMENU, OPT_IGNORE, NULL}, /* displays 'end' */ {NULL, OPT_NOMENU, OPT_IGNORE, NULL}, /* displays 'end' */
#define PTN_MENU_BSIZE 4 #define PTN_MENU_NEWFS 4
{NULL, MENU_selbsize, OPT_SUB, NULL},
#define PTN_MENU_FSIZE 5
{NULL, MENU_selfsize, OPT_SUB, NULL},
#define PTN_MENU_ISIZE 6
{NULL, OPT_NOMENU, 0, edit_fs_isize},
#define PTN_MENU_NEWFS 7
{NULL, OPT_NOMENU, 0, edit_fs_preserve}, {NULL, OPT_NOMENU, 0, edit_fs_preserve},
#define PTN_MENU_ISIZE 5
{NULL, OPT_NOMENU, 0, edit_fs_isize},
#define PTN_MENU_BSIZE 6
{NULL, MENU_selbsize, OPT_SUB, NULL},
#define PTN_MENU_FSIZE 7
{NULL, MENU_selfsize, OPT_SUB, NULL},
#define PTN_MENU_MOUNT 8 #define PTN_MENU_MOUNT 8
{NULL, OPT_NOMENU, 0, edit_fs_mount}, {NULL, OPT_NOMENU, 0, edit_fs_mount},
#define PTN_MENU_MOUNTOPT 9 #define PTN_MENU_MOUNTOPT 9
@ -376,7 +376,7 @@ edit_ptn(menudesc *menu, void *arg)
} }
all_fstype_menu = new_menu(MSG_Select_the_type, all_fstype_menu = new_menu(MSG_Select_the_type,
all_fstypes, nelem(all_fstypes), all_fstypes, nelem(all_fstypes),
-1, 15, 10, 0, MC_SCROLL, 30, 6, 10, 0, MC_SCROLL,
get_fstype, NULL, NULL, NULL, MSG_unchanged); get_fstype, NULL, NULL, NULL, MSG_unchanged);
} }
@ -398,22 +398,44 @@ set_ptn_header(menudesc *m, void *arg)
{ {
partinfo *p = arg; partinfo *p = arg;
int i; int i;
int t;
msg_clear(); msg_clear();
msg_table_add(MSG_edfspart, 'a' + (p - bsdlabel)); msg_table_add(MSG_edfspart, 'a' + (p - bsdlabel));
/* Determine which of the properties can be changed */
for (i = PTN_MENU_START; i <= PTN_MENU_MOUNTPT; i++) { for (i = PTN_MENU_START; i <= PTN_MENU_MOUNTPT; i++) {
/* Default to disabled... */
m->opts[i].opt_flags |= OPT_IGNORE; m->opts[i].opt_flags |= OPT_IGNORE;
if (i == PTN_MENU_END) { t = p->pi_fstype;
if (i == PTN_MENU_END)
/* The 'end address' is calculated from the size */
continue;
if (t == FS_UNUSED || (t == FS_SWAP && i > PTN_MENU_END)) {
/* Nothing after 'size' can be set for swap/unused */
p->pi_flags &= ~(PIF_NEWFS | PIF_MOUNT);
p->pi_mount[0] = 0;
continue; continue;
} }
if (p->pi_fstype == FS_SWAP && i > PTN_MENU_END) if (i == PTN_MENU_NEWFS && t != FS_BSDFFS && t != FS_BSDLFS
continue; && t != FS_APPLEUFS) {
if (p->pi_fstype == FS_UNUSED) /* Can only newfs UFS and LFS filesystems */
continue; p->pi_flags &= ~PIF_NEWFS;
if (!PI_ISBSDFS(p)
&& i >= PTN_MENU_BSIZE && i <= PTN_MENU_ISIZE)
continue; continue;
}
if (i >= PTN_MENU_ISIZE && i <= PTN_MENU_FSIZE) {
/* Parameters for newfs... */
if (!(p->pi_flags & PIF_NEWFS))
/* Not if we aren't going to run newfs */
continue;
if (t == FS_APPLEUFS && i != PTN_MENU_ISIZE)
/* Can only set # inodes for appleufs */
continue;
if (t == FS_BSDLFS && i == PTN_MENU_FSIZE)
/* LFS doesn't have fragments */
continue;
}
/* Ok: we want this one */
m->opts[i].opt_flags &= ~OPT_IGNORE; m->opts[i].opt_flags &= ~OPT_IGNORE;
} }
} }
@ -431,6 +453,7 @@ static void
set_ptn_label(menudesc *m, int opt, void *arg) set_ptn_label(menudesc *m, int opt, void *arg)
{ {
partinfo *p = arg; partinfo *p = arg;
const char *c;
if (m->opts[opt].opt_flags & OPT_IGNORE if (m->opts[opt].opt_flags & OPT_IGNORE
&& (opt != PTN_MENU_END || p->pi_fstype == FS_UNUSED)) { && (opt != PTN_MENU_END || p->pi_fstype == FS_UNUSED)) {
@ -440,8 +463,14 @@ set_ptn_label(menudesc *m, int opt, void *arg)
switch (opt) { switch (opt) {
case PTN_MENU_FSKIND: case PTN_MENU_FSKIND:
wprintw(m->mw, msg_string(MSG_fstype_fmt), if (p->pi_fstype == FS_BSDFFS)
fstypenames[p->pi_fstype]); if (p->pi_flags & PIF_FFSv2)
c = "FFSv2";
else
c = "FFSv1";
else
c = fstypenames[p->pi_fstype];
wprintw(m->mw, msg_string(MSG_fstype_fmt), c);
break; break;
case PTN_MENU_START: case PTN_MENU_START:
disp_sector_count(m, MSG_start_fmt, p->pi_offset); disp_sector_count(m, MSG_start_fmt, p->pi_offset);
@ -452,6 +481,14 @@ set_ptn_label(menudesc *m, int opt, void *arg)
case PTN_MENU_END: case PTN_MENU_END:
disp_sector_count(m, MSG_end_fmt, p->pi_offset + p->pi_size); disp_sector_count(m, MSG_end_fmt, p->pi_offset + p->pi_size);
break; break;
case PTN_MENU_NEWFS:
wprintw(m->mw, msg_string(MSG_newfs_fmt),
msg_string(p->pi_flags & PIF_NEWFS ? MSG_Yes : MSG_No));
break;
case PTN_MENU_ISIZE:
wprintw(m->mw, msg_string(p->pi_isize > 0 ?
MSG_isize_fmt : MSG_isize_fmt_dflt), p->pi_isize);
break;
case PTN_MENU_BSIZE: case PTN_MENU_BSIZE:
wprintw(m->mw, msg_string(MSG_bsize_fmt), wprintw(m->mw, msg_string(MSG_bsize_fmt),
p->pi_fsize * p->pi_frag); p->pi_fsize * p->pi_frag);
@ -459,14 +496,6 @@ set_ptn_label(menudesc *m, int opt, void *arg)
case PTN_MENU_FSIZE: case PTN_MENU_FSIZE:
wprintw(m->mw, msg_string(MSG_fsize_fmt), p->pi_fsize); wprintw(m->mw, msg_string(MSG_fsize_fmt), p->pi_fsize);
break; break;
case PTN_MENU_ISIZE:
wprintw(m->mw, msg_string(p->pi_isize > 0 ?
MSG_isize_fmt : MSG_isize_fmt_dflt), p->pi_isize);
break;
case PTN_MENU_NEWFS:
wprintw(m->mw, msg_string(MSG_newfs_fmt),
msg_string(p->pi_flags & PIF_NEWFS ? MSG_Yes : MSG_No));
break;
case PTN_MENU_MOUNT: case PTN_MENU_MOUNT:
wprintw(m->mw, msg_string(MSG_mount_fmt), wprintw(m->mw, msg_string(MSG_mount_fmt),
msg_string(p->pi_flags & PIF_MOUNT ? MSG_Yes : MSG_No)); msg_string(p->pi_flags & PIF_MOUNT ? MSG_Yes : MSG_No));
@ -512,8 +541,8 @@ set_label_texts(menudesc *menu, void *arg)
int rawptn = getrawpartition(); int rawptn = getrawpartition();
int maxpart = getmaxpartitions(); int maxpart = getmaxpartitions();
msg_display(MSG_fspart, multname); msg_display(MSG_fspart);
msg_table_add(MSG_fspart_header); msg_table_add(MSG_fspart_header, multname, multname, multname);
for (show_unused_ptn = 0, ptn = 0; ptn < maxpart; ptn++) { for (show_unused_ptn = 0, ptn = 0; ptn < maxpart; ptn++) {
m = &menu->opts[ptn]; m = &menu->opts[ptn];
@ -524,7 +553,7 @@ set_label_texts(menudesc *menu, void *arg)
#ifdef PART_BOOT #ifdef PART_BOOT
|| ptn == PART_BOOT || ptn == PART_BOOT
#endif #endif
|| ptn == C) { || ptn == PART_C) {
m->opt_flags = OPT_IGNORE; m->opt_flags = OPT_IGNORE;
} else { } else {
m->opt_flags = 0; m->opt_flags = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: menus.mi,v 1.14 2003/10/19 20:17:31 dsl Exp $ */ /* $NetBSD: menus.mi,v 1.15 2003/11/30 14:36:43 dsl Exp $ */
/*- /*-
* Copyright (c) 2003 The NetBSD Foundation, Inc. * Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -63,27 +63,32 @@ allow dynamic menus;
allow dynamic messages; allow dynamic messages;
menu selfskind, title MSG_Select_the_type, exitstring MSG_unchanged; menu selfskind, title MSG_Select_the_type, exitstring MSG_unchanged, y=6, x=30;
display action { display action {
switch (((partinfo *)arg)->pi_fstype) { partinfo *p = arg;
switch (p->pi_fstype) {
case FS_UNUSED: menu->cursel = 0; break; case FS_UNUSED: menu->cursel = 0; break;
case FS_BSDFFS: menu->cursel = 1; break; case FS_BSDFFS:
case FS_SWAP: menu->cursel = 2; break; menu->cursel = p->pi_flags & PIF_FFSv2 ? 2 : 1;
case FS_MSDOS: menu->cursel = 3; break; break;
case FS_BSDLFS: menu->cursel = 4; break; case FS_SWAP: menu->cursel = 3; break;
default : menu->cursel = 5; break; case FS_MSDOS: menu->cursel = 4; break;
case FS_BSDLFS: menu->cursel = 5; break;
default : menu->cursel = 6; break;
}; };
}; };
option "unused", exit, action option "unused", exit, action
{ memset(arg, 0, sizeof (partinfo)); }; { memset(arg, 0, sizeof (partinfo)); };
option "4.2BSD", exit, action option "FFSv1", exit, action
{ ((partinfo *)arg)->pi_fstype = FS_BSDFFS; set_bsize(arg, 8192); }; { set_ptype(arg, FS_BSDFFS, 0, 8192); };
option "FFSv2", exit, action
{ set_ptype(arg, FS_BSDFFS, PIF_FFSv2, 8192); };
option "swap", exit, action option "swap", exit, action
{ ((partinfo *)arg)->pi_fstype = FS_SWAP; set_bsize(arg, 0); }; { set_ptype(arg, FS_SWAP, 0, 0); };
option "msdos", exit, action option "msdos", exit, action
{ ((partinfo *)arg)->pi_fstype = FS_MSDOS; set_bsize(arg, 0); }; { set_ptype(arg, FS_MSDOS, 0, 0); };
option "4.4LFS", exit, action option "LFS", exit, action
{ ((partinfo *)arg)->pi_fstype = FS_BSDLFS; set_bsize(arg, 8192); }; { set_ptype(arg, FS_BSDLFS, 0, 8192); };
option MSG_other_types, action option MSG_other_types, action
{ extern int all_fstype_menu; { extern int all_fstype_menu;
m->opts[m->cursel].opt_menu = all_fstype_menu; }; m->opts[m->cursel].opt_menu = all_fstype_menu; };
@ -165,16 +170,19 @@ menu utility, title MSG_NetBSD_VERSION_Utilities, exit;
option MSG_Halt_the_system, exit, option MSG_Halt_the_system, exit,
action (endwin) { system("/sbin/halt -q"); }; action (endwin) { system("/sbin/halt -q"); };
menu yesno, title MSG_yes_or_no; menu yesno;
display action { menu->title = arg ? arg : MSG_yes_or_no; };
option MSG_Yes, exit, action {yesno = 1;}; option MSG_Yes, exit, action {yesno = 1;};
option MSG_No, exit, action {yesno = 0;}; option MSG_No, exit, action {yesno = 0;};
menu noyes, title MSG_yes_or_no; menu noyes;
display action { menu->title = arg ? arg : MSG_yes_or_no; };
option MSG_No, exit, action {yesno = 0;}; option MSG_No, exit, action {yesno = 0;};
option MSG_Yes, exit, action {yesno = 1;}; option MSG_Yes, exit, action {yesno = 1;};
menu ok, title MSG_Hit_enter_to_continue; menu ok, no shortcut;
option MSG_ok, exit; display action { menu->title = arg; };
option MSG_Hit_enter_to_continue, exit;
menu layout, y=-1, title MSG_Choose_your_installation; menu layout, y=-1, title MSG_Choose_your_installation;
option MSG_Set_Sizes, exit, action { layoutkind = 1; }; option MSG_Set_Sizes, exit, action { layoutkind = 1; };

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mi.en,v 1.122 2003/10/19 20:17:32 dsl Exp $ */ /* $NetBSD: msg.mi.en,v 1.123 2003/11/30 14:36:43 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -215,13 +215,13 @@ message askunits
{Change input units (sectors/cylinders/MB)} {Change input units (sectors/cylinders/MB)}
message NetBSD_partition_cant_change message NetBSD_partition_cant_change
{NetBSD partition - can't change} {NetBSD partition}
message Whole_disk_cant_change message Whole_disk_cant_change
{Whole disk - can't change} {Whole disk}
message Boot_partition_cant_change message Boot_partition_cant_change
{Boot partition - can't change} {Boot partition}
message add_another_ptn message add_another_ptn
{Add a user defined partition} {Add a user defined partition}
@ -244,18 +244,18 @@ Type enter to continue
} }
message fspart message fspart
{We now have your BSD-disklabel partitions as (Start, End and Size in %s). {We now have your BSD-disklabel partitions as:
This is your last chance to change it. This is your last chance to change them.
} }
message fspart_header message fspart_header
{ Start End Size FStype Newfs Mount Mount point { Start %3s End %3s Size %3s FS type Newfs Mount Mount point
--------- --------- --------- ------ ----- ----- ----------- --------- --------- --------- ---------- ----- ----- -----------
} }
message fspart_row message fspart_row
{%9d %9d %9d %-6s %-5s %-5s %s} {%9d %9d %9d %-10s %-5s %-5s %s}
message show_all_unused_partitions message show_all_unused_partitions
{Show all unused partitions} {Show all unused partitions}
@ -412,7 +412,7 @@ message nomount
a mount point.} a mount point.}
message mountfail message mountfail
{mount of device %s on %s failed. {mount of device /dev/%s%c on %s failed.
} }
message extractcomplete message extractcomplete
@ -760,12 +760,12 @@ message makedev
} }
message badfs message badfs
{It appears that %s%s is not a BSD file system or the fsck was {It appears that /dev/%s%c is not a BSD file system or the fsck was
not successful. The upgrade has been aborted. (Error number %d.) not successful. The upgrade has been aborted. (Error number %d.)
} }
message badmount message badmount
{Your file system %s%s was not successfully mounted. Upgrade aborted.} {Your file system /dev/%s%c was not successfully mounted. Upgrade aborted.}
message rootmissing message rootmissing
{ target root is missing %s. { target root is missing %s.

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mi.fr,v 1.71 2003/10/19 20:17:32 dsl Exp $ */ /* $NetBSD: msg.mi.fr,v 1.72 2003/11/30 14:36:43 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -221,13 +221,13 @@ message askunits
{Changer d'unité (secteurs/cylindres/Mo)} {Changer d'unité (secteurs/cylindres/Mo)}
message NetBSD_partition_cant_change message NetBSD_partition_cant_change
{Partition de NetBSD - pas de changement} {Partition de NetBSD}
message Whole_disk_cant_change message Whole_disk_cant_change
{Totalité du disque - pas de changement} {Totalité du disque}
message Boot_partition_cant_change message Boot_partition_cant_change
{Partition de démarrer - pas de changement} {Partition de démarrer}
message add_another_ptn message add_another_ptn
{Ajouter une nouvelle partition manuellement} {Ajouter une nouvelle partition manuellement}
@ -248,17 +248,17 @@ La taille de la partition a
} }
message fspart message fspart
{Vos partitions NetBSD sont les suivantes (taille et décalages en %s) : {Vos partitions NetBSD sont les suivantes:
} }
message fspart_header message fspart_header
{ Debut Fin Taille Type Newfs Mount Point de montage { Debut %3s Fin %3s Taille %3s Type Newfs Mount Point de montage
--------- --------- --------- ------ ----- ----- ---------------- --------- --------- ---------- ---------- ----- ----- ----------------
} }
message fspart_row message fspart_row
{%9d %9d %9d %-6s %-5s %-5s %s} {%9d %9d %10d %-10s %-5s %-5s %s}
message show_all_unused_partitions /* XXX translate */ message show_all_unused_partitions /* XXX translate */
{Show all unused partitions} {Show all unused partitions}
@ -421,7 +421,7 @@ ni msdos et ne dispose donc d'aucun point de montage.
} }
message mountfail message mountfail
{Le montage de %s sur %s a échoué. {Le montage de /dev/%s%c sur %s a échoué.
} }
message extractcomplete message extractcomplete
@ -784,13 +784,13 @@ message makedev
} }
message badfs message badfs
{%s%s n'est pas un système de fichiers BSD ou bien sa vérification {/dev/%s%c n'est pas un système de fichiers BSD ou bien sa vérification
par fsck a rencontré un problème. par fsck a rencontré un problème.
La mise à jour a été interrompue avec un code erreur %d. La mise à jour a été interrompue avec un code erreur %d.
} }
message badmount message badmount
{Le système de fichiers %s%s n'a pas été monté correctement. {Le système de fichiers /dev/%s%c n'a pas été monté correctement.
Arrêt de la mise à jour Arrêt de la mise à jour
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mi.pl,v 1.33 2003/10/19 20:17:32 dsl Exp $ */ /* $NetBSD: msg.mi.pl,v 1.34 2003/11/30 14:36:43 dsl Exp $ */
/* Based on english version: */ /* Based on english version: */
/* NetBSD: msg.mi.en,v 1.86 2002/04/04 14:26:44 ad Exp */ /* NetBSD: msg.mi.en,v 1.86 2002/04/04 14:26:44 ad Exp */
@ -212,13 +212,13 @@ message askunits /* XXX translate */
{Change input units (sectors/cylinders/MB)} {Change input units (sectors/cylinders/MB)}
message NetBSD_partition_cant_change message NetBSD_partition_cant_change
{partycja NetBSD - nie mozna zmienic} {partycja NetBSD}
message Whole_disk_cant_change message Whole_disk_cant_change
{Caly dysk - nie mozna zmienic} {Caly dysk}
message Boot_partition_cant_change message Boot_partition_cant_change
{partycja uruchomic - nie mozna zmienic} {partycja uruchomic}
message add_another_ptn /* XXX translate */ message add_another_ptn /* XXX translate */
{Add a user defined partition} {Add a user defined partition}
@ -239,18 +239,17 @@ twojej partycji zostal zmniejszony do %d %s.
} }
message fspart message fspart
{Mamy teraz twoje partycje BSD-disklabel jako (Rozmiar i Przesuniecie w %s): {Mamy teraz twoje partycje BSD-disklabel jako:
} }
message fspart_header message fspart_header /* XXX abbreviations (or change fspart_row below) */
{ Rozmiar Przesun. Koniec Typ SP Ochrona Mount Mountpoint { Rozm %3s Prze %3s Koniec %3s Typ SP Ochrona Mount Mountpoint
--------- --------- --------- ------ ------- ----- ---------- --------- --------- ---------- ---------- ------- ----- ----------
} }
message fspart_row message fspart_row
{%9d %9d %9d %-6s %-7s %-5s %s} {%9d %9d %10d %-10s %-7s %-5s %s}
message show_all_unused_partitions /* XXX translate */ message show_all_unused_partitions /* XXX translate */
{Show all unused partitions} {Show all unused partitions}
@ -408,7 +407,7 @@ message nomount
{Typ partycji %c to nie 4.2BSD lub msdos i dlatego nie ma ona swojego mountpoint.} {Typ partycji %c to nie 4.2BSD lub msdos i dlatego nie ma ona swojego mountpoint.}
message mountfail message mountfail
{zamountowanie urzadzenia %s na %s nie powiodlo sie. {zamountowanie urzadzenia /dev/%s%c na %s nie powiodlo sie.
} }
message extractcomplete message extractcomplete
@ -751,12 +750,12 @@ message makedev
} }
message badfs message badfs
{Wyglada na to, ze %s%s nie jest systemem plikow BSD albo nie powiodlo sie {Wyglada na to, ze /dev/%s%c nie jest systemem plikow BSD albo nie powiodlo sie
jego sprawdzenie. Aktualizacja zostala przerwana. (Blad numer %d.) jego sprawdzenie. Aktualizacja zostala przerwana. (Blad numer %d.)
} }
message badmount message badmount
{System plikow %s%s nie zostal pomyslnie zamountowany. Aktualizacja przerwana.} {System plikow /dev/%s%c nie zostal pomyslnie zamountowany. Aktualizacja przerwana.}
message rootmissing message rootmissing
{ docelowy / jest zagubiony %s. { docelowy / jest zagubiony %s.

View File

@ -1,4 +1,4 @@
/* $NetBSD: net.c,v 1.99 2003/11/19 00:16:49 dsl Exp $ */ /* $NetBSD: net.c,v 1.100 2003/11/30 14:36:43 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -664,7 +664,7 @@ again:
fclose(f); fclose(f);
} }
run_prog(0, NULL, "/sbin/ifconfig lo0 127.0.0.1"); run_program(0, "/sbin/ifconfig lo0 127.0.0.1");
/* /*
* ifconfig does not allow media specifiers on IFM_MANUAL interfaces. * ifconfig does not allow media specifiers on IFM_MANUAL interfaces.
@ -683,27 +683,26 @@ again:
} }
if (*net_media != '\0') if (*net_media != '\0')
run_prog(0, NULL, "/sbin/ifconfig %s media %s", run_program(0, "/sbin/ifconfig %s media %s",
net_dev, net_media); net_dev, net_media);
#ifdef INET6 #ifdef INET6
if (v6config) { if (v6config) {
init_v6kernel(1); init_v6kernel(1);
run_prog(0, NULL, "/sbin/ifconfig %s up", net_dev); run_program(0, "/sbin/ifconfig %s up", net_dev);
sleep(get_v6wait() + 1); sleep(get_v6wait() + 1);
run_prog(RUN_DISPLAY, NULL, "/sbin/rtsol -D %s", net_dev); run_program(RUN_DISPLAY, "/sbin/rtsol -D %s", net_dev);
sleep(get_v6wait() + 1); sleep(get_v6wait() + 1);
} }
#endif #endif
if (net_ip[0] != '\0') { if (net_ip[0] != '\0') {
if (net_mask[0] != '\0') { if (net_mask[0] != '\0') {
run_prog(0, NULL, run_program(0, "/sbin/ifconfig %s inet %s netmask %s",
"/sbin/ifconfig %s inet %s netmask %s",
net_dev, net_ip, net_mask); net_dev, net_ip, net_mask);
} else { } else {
run_prog(0, NULL, run_program(0, "/sbin/ifconfig %s inet %s",
"/sbin/ifconfig %s inet %s", net_dev, net_ip); net_dev, net_ip);
} }
} }
@ -713,9 +712,8 @@ again:
/* Set a default route if one was given */ /* Set a default route if one was given */
if (net_defroute[0] != '\0') { if (net_defroute[0] != '\0') {
run_prog(0, NULL, "/sbin/route -n flush -inet"); run_program(0, "/sbin/route -n flush -inet");
run_prog(0, NULL, run_program(0, "/sbin/route -n add default %s", net_defroute);
"/sbin/route -n add default %s", net_defroute);
} }
/* /*
@ -731,21 +729,21 @@ again:
#ifdef INET6 #ifdef INET6
if (v6config && network_up) { if (v6config && network_up) {
network_up = !run_prog(RUN_DISPLAY | RUN_PROGRESS, NULL, network_up = !run_program(RUN_DISPLAY | RUN_PROGRESS,
"/sbin/ping6 -v -c 3 -n -I %s ff02::2", net_dev); "/sbin/ping6 -v -c 3 -n -I %s ff02::2", net_dev);
if (net_namesvr6[0] != '\0') if (net_namesvr6[0] != '\0')
network_up = !run_prog(RUN_DISPLAY | RUN_PROGRESS, NULL, network_up = !run_program(RUN_DISPLAY | RUN_PROGRESS,
"/sbin/ping6 -v -c 3 -n %s", net_namesvr6); "/sbin/ping6 -v -c 3 -n %s", net_namesvr6);
} }
#endif #endif
if (net_namesvr[0] != '\0' && network_up) if (net_namesvr[0] != '\0' && network_up)
network_up = !run_prog(RUN_DISPLAY | RUN_PROGRESS, NULL, network_up = !run_program(RUN_DISPLAY | RUN_PROGRESS,
"/sbin/ping -v -c 5 -w 5 -o -n %s", net_namesvr); "/sbin/ping -v -c 5 -w 5 -o -n %s", net_namesvr);
if (net_defroute[0] != '\0' && network_up) if (net_defroute[0] != '\0' && network_up)
network_up = !run_prog(RUN_DISPLAY | RUN_PROGRESS, NULL, network_up = !run_program(RUN_DISPLAY | RUN_PROGRESS,
"/sbin/ping -v -c 5 -w 5 -o -n %s", net_defroute); "/sbin/ping -v -c 5 -w 5 -o -n %s", net_defroute);
fflush(NULL); fflush(NULL);
@ -799,7 +797,7 @@ get_via_ftp(void)
* unsafe by a strict reading of RFC 1738). * unsafe by a strict reading of RFC 1738).
*/ */
if (strcmp("ftp", ftp_user) == 0 && ftp_pass[0] == 0) if (strcmp("ftp", ftp_user) == 0 && ftp_pass[0] == 0)
ret = run_prog(RUN_DISPLAY | RUN_PROGRESS, NULL, ret = run_program(RUN_DISPLAY | RUN_PROGRESS,
"/usr/bin/ftp -a ftp://%s/%s/%s", "/usr/bin/ftp -a ftp://%s/%s/%s",
ftp_host, ftp_host,
url_encode(ftp_dir_encoded, ftp_dir, url_encode(ftp_dir_encoded, ftp_dir,
@ -807,7 +805,7 @@ get_via_ftp(void)
RFC1738_SAFE_LESS_SHELL_PLUS_SLASH, 1), RFC1738_SAFE_LESS_SHELL_PLUS_SLASH, 1),
filename); filename);
else { else {
ret = run_prog(RUN_DISPLAY | RUN_PROGRESS, NULL, ret = run_program(RUN_DISPLAY | RUN_PROGRESS,
"/usr/bin/ftp ftp://%s:%s@%s/%s/%s", "/usr/bin/ftp ftp://%s:%s@%s/%s/%s",
url_encode(ftp_user_encoded, ftp_user, url_encode(ftp_user_encoded, ftp_user,
sizeof ftp_user_encoded, sizeof ftp_user_encoded,
@ -877,8 +875,7 @@ again:
umount_mnt2(); umount_mnt2();
/* Mount it */ /* Mount it */
if (run_prog(0, NULL, if (run_program(0, "/sbin/mount -r -o -2,-i,-r=1024 -t nfs %s:%s /mnt2",
"/sbin/mount -r -o -2,-i,-r=1024 -t nfs %s:%s /mnt2",
nfs_host, nfs_dir)) { nfs_host, nfs_dir)) {
msg_display(MSG_nfsbadmount, nfs_host, nfs_dir); msg_display(MSG_nfsbadmount, nfs_host, nfs_dir);
process_menu(MENU_nfsbadmount, NULL); process_menu(MENU_nfsbadmount, NULL);
@ -1058,7 +1055,7 @@ config_dhcp(char *inter)
process_menu(MENU_dhcpautoconf, NULL); process_menu(MENU_dhcpautoconf, NULL);
if (yesno) { if (yesno) {
/* spawn off dhclient and wait for parent to exit */ /* spawn off dhclient and wait for parent to exit */
dhcpautoconf = run_prog(RUN_DISPLAY, NULL, dhcpautoconf = run_program(RUN_DISPLAY,
"%s -pf /tmp/dhclient.pid -lf /tmp/dhclient.leases %s", "%s -pf /tmp/dhclient.pid -lf /tmp/dhclient.leases %s",
DHCLIENT_EX, inter); DHCLIENT_EX, inter);
return dhcpautoconf ? 0 : 1; return dhcpautoconf ? 0 : 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: run.c,v 1.54 2003/11/11 17:27:13 dsl Exp $ */ /* $NetBSD: run.c,v 1.55 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -562,7 +562,7 @@ loop:
*/ */
int int
run_prog(int flags, msg errmsg, const char *cmd, ...) run_program(int flags, const char *cmd, ...)
{ {
va_list ap; va_list ap;
struct winsize win; struct winsize win;
@ -603,7 +603,8 @@ run_prog(int flags, msg errmsg, const char *cmd, ...)
ret = launch_subwin(&actionwin, args, &win, flags, scmd, &errstr); ret = launch_subwin(&actionwin, args, &win, flags, scmd, &errstr);
if (ret != 0 && actionwin == NULL && flags & RUN_DISPLAY_ERR) /* If the command failed, show command name */
if (ret != 0 && actionwin == NULL && !(flags & RUN_SILENT_ERR))
actionwin = show_cmd(scmd, &win); actionwin = show_cmd(scmd, &win);
if (actionwin != NULL) { if (actionwin != NULL) {
@ -622,7 +623,8 @@ run_prog(int flags, msg errmsg, const char *cmd, ...)
mvaddstr(0, 13, msg_string(MSG_Finished)); mvaddstr(0, 13, msg_string(MSG_Finished));
standend(); standend();
refresh(); refresh();
if (ret != 0 || (y + x != 0 && !(flags & RUN_PROGRESS))) { if ((ret != 0 && !(flags & RUN_ERROR_OK)) ||
(y + x != 0 && !(flags & RUN_PROGRESS))) {
if (actionwin != stdscr) if (actionwin != stdscr)
move(2, 5); move(2, 5);
else if (x != 0) else if (x != 0)
@ -633,28 +635,26 @@ run_prog(int flags, msg errmsg, const char *cmd, ...)
} }
} }
va_end(ap);
/* restore tty setting we saved earlier */
reset_prog_mode();
/* clean things up */ /* clean things up */
if (actionwin != NULL) { if (actionwin != NULL) {
if (actionwin != stdscr) if (actionwin != stdscr)
delwin(actionwin); delwin(actionwin);
wclear(stdscr); if (err == 0 || !(flags & RUN_NO_CLEAR)) {
touchwin(stdscr); wclear(stdscr);
clearok(stdscr, 1); touchwin(stdscr);
refresh(); clearok(stdscr, 1);
refresh();
}
} }
va_end(ap);
/* restore tty setting we saved earlier */
reset_prog_mode();
if (ret != 0) {
if (errmsg != NULL) {
msg_display(errmsg, scmd);
process_menu(MENU_ok, NULL);
}
if (flags & RUN_FATAL)
exit(ret);
}
free(scmd); free(scmd);
free_argv(args); free_argv(args);
if (ret != 0 && flags & RUN_FATAL)
exit(ret);
return ret; return ret;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: target.c,v 1.44 2003/10/19 20:17:32 dsl Exp $ */ /* $NetBSD: target.c,v 1.45 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Jonathan Stone * Copyright 1997 Jonathan Stone
@ -71,7 +71,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: target.c,v 1.44 2003/10/19 20:17:32 dsl Exp $"); __RCSID("$NetBSD: target.c,v 1.45 2003/11/30 14:36:44 dsl Exp $");
#endif #endif
/* /*
@ -113,13 +113,12 @@ int target_test_symlink (const char *path); /* deprecated */
void backtowin(void); void backtowin(void);
void unwind_mounts (void); void unwind_mounts(void);
int mount_with_unwind (const char *fstype, const char *from, const char *on);
/* Record a mount for later unwinding of target mounts. */ /* Record a mount for later unwinding of target mounts. */
struct unwind_mount { struct unwind_mount {
struct unwind_mount *um_prev; struct unwind_mount *um_prev;
char um_mountpoint[STRSIZE]; char um_mountpoint[4]; /* Allocated longer... */
}; };
/* Unwind-mount stack */ /* Unwind-mount stack */
@ -262,7 +261,7 @@ static void
make_prefixed_dir(const char *prefix, const char *path) make_prefixed_dir(const char *prefix, const char *path)
{ {
run_prog(0, NULL, "/bin/mkdir -p %s", concat_paths(prefix, path)); run_program(0, "/bin/mkdir -p %s", concat_paths(prefix, path));
} }
/* Make a directory with a pathname relative to the installation target. */ /* Make a directory with a pathname relative to the installation target. */
@ -273,64 +272,6 @@ make_target_dir(const char *path)
make_prefixed_dir(target_prefix(), path); make_prefixed_dir(target_prefix(), path);
} }
#ifdef notdef
/* Make a directory with a pathname in the currently-mounted root. */
void
make_ramdisk_dir(const char *path)
{
make_prefixed_dir(path, "");
}
/* unused, will not work with new run.c */
/*
*
* Append |string| to the filename |path|, where |path| is
* relative to the root of the install target.
* for example,
* echo_to_target_file( "Newbie.NetBSD.ORG", "/etc/myname");
* would set the default hostname at the next reboot of the installed-on disk.
*/
void
append_to_target_file(const char *path, const char *string)
{
run_prog(RUN_FATAL, NULL, "echo %s >> %s", string, target_expand(path));
}
/*
* As append_to_target_file, but with ftrunc semantics.
*/
void
echo_to_target_file(const char *path, const char *string)
{
trunc_target_file(path);
append_to_target_file(path, string);
}
void
sprintf_to_target_file(const char *path, const char *format, ...)
{
char lines[STRSIZE];
va_list ap;
trunc_target_file(path);
va_start(ap, format);
vsnprintf(lines, STRSIZE, format, ap);
va_end(ap);
append_to_target_file(path, lines);
}
void
trunc_target_file(const char *path)
{
run_prog(RUN_FATAL, NULL, "cat < /dev/null > %s", target_expand(path));
}
#endif /* if 0 */
static int static int
do_target_chdir(const char *dir, int must_succeed) do_target_chdir(const char *dir, int must_succeed)
@ -395,7 +336,7 @@ cp_to_target(const char *srcpath, const char *tgt_path)
{ {
const char *real_path = target_expand(tgt_path); const char *real_path = target_expand(tgt_path);
return run_prog(0, NULL, "/bin/cp %s %s", srcpath, real_path); return run_program(0, "/bin/cp %s %s", srcpath, real_path);
} }
/* /*
@ -413,7 +354,7 @@ dup_file_into_target(const char *filename)
/* /*
* Do a mv where both pathnames are within the target filesystem. * Do a mv where both pathnames are within the target filesystem.
*/ */
void void
mv_within_target_or_die(const char *frompath, const char *topath) mv_within_target_or_die(const char *frompath, const char *topath)
@ -424,10 +365,10 @@ mv_within_target_or_die(const char *frompath, const char *topath)
strncpy(realfrom, target_expand(frompath), STRSIZE); strncpy(realfrom, target_expand(frompath), STRSIZE);
strncpy(realto, target_expand(topath), STRSIZE); strncpy(realto, target_expand(topath), STRSIZE);
run_prog(RUN_FATAL, NULL, "mv %s %s", realfrom, realto); run_program(RUN_FATAL, "mv %s %s", realfrom, realto);
} }
/* Do a cp where both pathnames are within the target filesystem. */ /* Do a cp where both pathnames are within the target filesystem. */
int int
cp_within_target(const char *frompath, const char *topath) cp_within_target(const char *frompath, const char *topath)
{ {
@ -437,7 +378,7 @@ cp_within_target(const char *frompath, const char *topath)
strncpy(realfrom, target_expand(frompath), STRSIZE); strncpy(realfrom, target_expand(frompath), STRSIZE);
strncpy(realto, target_expand(topath), STRSIZE); strncpy(realto, target_expand(topath), STRSIZE);
return (run_prog(0, NULL, "cp -p %s %s", realfrom, realto)); return (run_program(0, "cp -p %s %s", realfrom, realto));
} }
/* fopen a pathname in the target. */ /* fopen a pathname in the target. */
@ -449,22 +390,23 @@ target_fopen(const char *filename, const char *type)
} }
/* /*
* Do a mount and record the mountpoint in a list of mounts to * Do a mount onto a mountpoint in the install target.
* unwind after completing or aborting a mount. * Record mountpoint so we can unmount when finished.
* NB: does not prefix mount-from, which probably breaks nullfs mounts.
*/ */
int int
mount_with_unwind(const char *opts, const char *from, const char *on) target_mount(const char *opts, const char *from, int ptn, const char *on)
{ {
struct unwind_mount *m;
int error; int error;
struct unwind_mount * m; int len;
m = malloc(sizeof(*m)); len = strlen(on);
m = malloc(sizeof *m + len);
if (m == 0) if (m == 0)
return (ENOMEM); /* XXX */ return (ENOMEM); /* XXX */
strncpy(m->um_mountpoint, on, STRSIZE); memcpy(m->um_mountpoint, on, len + 1);
m->um_prev = unwind_mountlist;
unwind_mountlist = m;
#ifdef DEBUG_UNWIND #ifdef DEBUG_UNWIND
endwin(); endwin();
@ -472,9 +414,15 @@ mount_with_unwind(const char *opts, const char *from, const char *on)
backtowin(); backtowin();
#endif #endif
error = run_prog(RUN_PROGRESS, NULL, error = run_program(0, "/sbin/mount %s /dev/%s%c %s%s",
"/sbin/mount %s %s %s", opts, from, on); opts, from, 'a' + ptn, target_prefix(), on);
return (error); if (error) {
free(m);
return error;
}
m->um_prev = unwind_mountlist;
unwind_mountlist = m;
return 0;
} }
/* /*
@ -494,38 +442,20 @@ unwind_mounts(void)
return; return;
unwind_in_progress = 1; unwind_in_progress = 1;
for (m = unwind_mountlist; m; ) { while ((m = unwind_mountlist) != NULL) {
struct unwind_mount *prev; unwind_mountlist = m->um_prev;
#ifdef DEBUG_UNWIND #ifdef DEBUG_UNWIND
endwin(); endwin();
fprintf(stderr, "unmounting %s\n", m->um_mountpoint); fprintf(stderr, "unmounting %s\n", m->um_mountpoint);
backtowin(); backtowin();
#endif #endif
run_prog(0, NULL, "/sbin/umount %s", m->um_mountpoint); run_program(0, "/sbin/umount %s%s",
prev = m->um_prev; target_prefix(), m->um_mountpoint);
free(m); free(m);
m = prev;
} }
unwind_mountlist = NULL;
unwind_in_progress = 0; unwind_in_progress = 0;
} }
/*
* Do a mount onto a mountpoint in the install target.
* NB: does not prefix mount-from, which probably breaks nullfs mounts.
*/
int
target_mount(const char *fstype, const char *from, const char *on)
{
int error;
const char *realmount = target_expand(on);
/* mount and record for unmounting when done. */
error = mount_with_unwind(fstype, from, realmount);
return (error);
}
int int
target_collect_file(int kind, char **buffer, const char *name) target_collect_file(int kind, char **buffer, const char *name)
{ {

View File

@ -1,4 +1,4 @@
/* $NetBSD: txtwalk.c,v 1.9 2003/07/25 08:26:22 dsl Exp $ */ /* $NetBSD: txtwalk.c,v 1.10 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -56,20 +56,20 @@
/* prototypes */ /* prototypes */
static void process(struct lookfor *, char *); static int process(struct lookfor *, char *);
static void match(char *, struct lookfor *, size_t); static int match(char *, struct lookfor *, size_t);
static int finddata(struct lookfor *, char *, struct data *, size_t *); static int finddata(struct lookfor *, char *, struct data *, size_t *);
static char *strndup(char *, size_t);
/* /*
* Walk the buffer, call match for each line. * Walk the buffer, call match for each line.
*/ */
void int
walk(char *buffer, size_t size, struct lookfor *these, size_t numthese) walk(char *buffer, size_t size, struct lookfor *these, size_t numthese)
{ {
size_t i = 0; size_t i = 0;
size_t len; size_t len;
int line = 1; int line = 1;
int error;
while (i < size) { while (i < size) {
/* Ignore zero characters. */ /* Ignore zero characters. */
@ -85,24 +85,28 @@ walk(char *buffer, size_t size, struct lookfor *these, size_t numthese)
#ifdef DEBUG #ifdef DEBUG
printf ("%5d: %s\n", line, buffer); printf ("%5d: %s\n", line, buffer);
#endif #endif
match(buffer, these, numthese); error = match(buffer, these, numthese);
if (error != 0)
return error;
buffer += len+1; buffer += len+1;
i += len+1; i += len+1;
line++; line++;
} }
} }
return 0;
} }
/* /*
* Match the current line with a string of interest. * Match the current line with a string of interest.
* For each match in these, process the match. * For each match in these, process the match.
*/ */
static void static int
match(char *line, struct lookfor *these, size_t numthese) match(char *line, struct lookfor *these, size_t numthese)
{ {
size_t linelen; /* Line length */ size_t linelen; /* Line length */
size_t patlen; /* Pattern length */ size_t patlen; /* Pattern length */
size_t which; /* Which pattern we are using */ size_t which; /* Which pattern we are using */
int error;
linelen = strlen(line); linelen = strlen(line);
@ -110,20 +114,25 @@ match(char *line, struct lookfor *these, size_t numthese)
patlen = strlen(these[which].head); patlen = strlen(these[which].head);
if (linelen < patlen) if (linelen < patlen)
continue; continue;
if (strncmp(these[which].head, line, patlen) == 0) if (strncmp(these[which].head, line, patlen) == 0) {
process(&these[which], line); error = process(&these[which], line);
if (error != 0)
return error;
}
} }
return 0;
} }
/* process the matched line. */ /* process the matched line. */
static void static int
process(struct lookfor *item, char *line) process(struct lookfor *item, char *line)
{ {
struct data found[MAXDATA]; struct data found[MAXDATA];
size_t numfound = 0; size_t numfound = 0;
const char *p; const char *p;
size_t i, j; size_t i, j;
int error;
if (finddata(item, line, found, &numfound)) { if (finddata(item, line, found, &numfound)) {
#ifdef DEBUG #ifdef DEBUG
@ -157,10 +166,9 @@ process(struct lookfor *item, char *line)
= found[i].u.i_val; = found[i].u.i_val;
break; break;
case STR: case STR:
strncpy(*((char **)item->var+j), strlcpy(*((char **)item->var+j),
found[i].u.s_val, found[i].u.s_val,
item->size-1); item->size);
found[i].u.s_val[item->size-1] = 0;
break; break;
} }
while (isdigit(*p)) while (isdigit(*p))
@ -175,10 +183,13 @@ process(struct lookfor *item, char *line)
} }
break; break;
case 'c': /* Call a function with data. */ case 'c': /* Call a function with data. */
(*item->func)(found, numfound); error = (*item->func)(found, numfound);
if (error != 0)
return error;
break; break;
} }
} }
return 0;
} }
/* /*
@ -191,11 +202,11 @@ process(struct lookfor *item, char *line)
static int static int
finddata(struct lookfor *item, char *line, struct data *found, size_t *numfound) finddata(struct lookfor *item, char *line, struct data *found, size_t *numfound)
{ {
const char *fmt = item->fmt; const char *fmt;
size_t len; size_t len;
*numfound = 0; *numfound = 0;
while (*fmt) { for (fmt = item->fmt; *fmt; fmt++) {
if (!*line && *fmt) if (!*line && *fmt)
return 0; return 0;
if (*fmt == '%') { if (*fmt == '%') {
@ -232,49 +243,29 @@ finddata(struct lookfor *item, char *line, struct data *found, size_t *numfound)
&& line[len] != fmt[1]) && line[len] != fmt[1])
len++; len++;
found[*numfound].what = STR; found[*numfound].what = STR;
found[*numfound].u.s_val = strndup(line, len); found[(*numfound)++].u.s_val = line;
if (found[(*numfound)++].u.s_val == NULL) { line[len] = 0;
(void)fprintf(stderr, line += len + 1;
"msgwalk: strndup: out of vm.\n");
exit(1);
}
line += len;
break; break;
default: default:
return 0; return 0;
} }
continue;
} else if (*fmt == ' ') {
}
if (*fmt == ' ') {
while (*line && isspace(*line)) while (*line && isspace(*line))
line++; line++;
} else if (*line == *fmt) { continue;
line++;
} else {
/* Mis match! */
return 0;
} }
fmt++; if (*line == *fmt) {
line++;
continue;
}
/* Mis match! */
return 0;
} }
/* Ran out of fmt. */ /* Ran out of fmt. */
return 1; return 1;
} }
/*
* Utility routines....
*/
static char *
strndup(char *str, size_t len)
{
size_t alen;
char *val;
alen = strlen(str);
alen = len < alen ? len + 1 : alen + 1;
val = malloc(alen);
if (!val)
return NULL;
strlcpy(val, str, alen);
return val;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: txtwalk.h,v 1.8 2003/07/25 08:26:22 dsl Exp $ */ /* $NetBSD: txtwalk.h,v 1.9 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -57,7 +57,7 @@ struct lookfor {
void *var; /* Possible var */ void *var; /* Possible var */
size_t nument; /* Number of entries in the "array" */ size_t nument; /* Number of entries in the "array" */
size_t size; /* size of string variables */ size_t size; /* size of string variables */
void (*func) (struct data *list, size_t num); /* function to call */ int (*func) (struct data *list, size_t num); /* function to call */
}; };
/* Format string for the expected string: /* Format string for the expected string:
@ -79,7 +79,7 @@ struct lookfor {
/* prototypes */ /* prototypes */
void walk (char *, size_t, struct lookfor *, size_t); int walk(char *, size_t, struct lookfor *, size_t);
/* Maximum number of matched data elements per line! */ /* Maximum number of matched data elements per line! */

View File

@ -1,4 +1,4 @@
/* $NetBSD: upgrade.c,v 1.42 2003/10/19 20:17:32 dsl Exp $ */ /* $NetBSD: upgrade.c,v 1.43 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -77,7 +77,7 @@ do_upgrade(void)
process_menu(MENU_distset, NULL); process_menu(MENU_distset, NULL);
if (!fsck_disks()) if (mount_disks() != 0)
return; return;
@ -196,8 +196,8 @@ restore_etc(void)
return; return;
tp = target_prefix(); tp = target_prefix();
run_prog(0, NULL, "mv -f %s/etc.old/* %s/etc", tp, tp); run_program(0, "mv -f %s/etc.old/* %s/etc", tp, tp);
run_prog(0, NULL, "rmdir %s/etc.old", tp); run_program(0, "rmdir %s/etc.old", tp);
etc_saved = 0; etc_saved = 0;
} }
@ -281,16 +281,9 @@ do_reinstall_sets(void)
process_menu(MENU_distset, NULL); process_menu(MENU_distset, NULL);
if (!fsck_disks()) if (mount_disks() != 0)
return; return;
fflush(stdout);
wrefresh(curscr);
wmove(stdscr, 0, 0);
touchwin(stdscr);
wclear(stdscr);
wrefresh(stdscr);
/* Unpack the distribution. */ /* Unpack the distribution. */
if (get_and_unpack_sets(MSG_unpackcomplete, MSG_abortunpack) != 0) if (get_and_unpack_sets(MSG_unpackcomplete, MSG_abortunpack) != 0)
return; return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: util.c,v 1.114 2003/11/15 12:53:34 sekiya Exp $ */ /* $NetBSD: util.c,v 1.115 2003/11/30 14:36:44 dsl Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -226,7 +226,7 @@ run_makedev(void)
/* make /dev, in case the user didn't extract it. */ /* make /dev, in case the user didn't extract it. */
make_target_dir("/dev"); make_target_dir("/dev");
target_chdir_or_die("/dev"); target_chdir_or_die("/dev");
run_prog(0, NULL, "/bin/sh MAKEDEV all"); run_program(0, "/bin/sh MAKEDEV all");
chdir(owd); chdir(owd);
free(owd); free(owd);
@ -275,7 +275,7 @@ get_via_floppy(void)
return 0; return 0;
else if (yesno == 2) else if (yesno == 2)
return 1; return 1;
while (run_prog(0, NULL, while (run_program(0,
"/sbin/mount -r -t %s %s /mnt2", "/sbin/mount -r -t %s %s /mnt2",
fdtype, fddev)) { fdtype, fddev)) {
msg_display(MSG_fdremount, fname); msg_display(MSG_fdremount, fname);
@ -326,7 +326,7 @@ again:
/* Mount it */ /* Mount it */
for (retries = 5;; --retries) { for (retries = 5;; --retries) {
if (run_prog(retries > 0 ? RUN_SILENT : 0, NULL, if (run_program(retries > 0 ? RUN_SILENT : 0,
"/sbin/mount -rt cd9660 /dev/%s /mnt2", cdrom_dev) == 0) "/sbin/mount -rt cd9660 /dev/%s /mnt2", cdrom_dev) == 0)
break; break;
if (retries > 0) { if (retries > 0) {
@ -377,7 +377,7 @@ again:
umount_mnt2(); umount_mnt2();
/* Mount it */ /* Mount it */
if (run_prog(0, NULL, "/sbin/mount -rt %s /dev/%s /mnt2", if (run_program(0, "/sbin/mount -rt %s /dev/%s /mnt2",
localfs_fs, localfs_dev)) { localfs_fs, localfs_dev)) {
msg_display(MSG_localfsbadmount, localfs_dir, localfs_dev); msg_display(MSG_localfsbadmount, localfs_dir, localfs_dev);
@ -707,13 +707,13 @@ extract_file(char *path)
/* now extract set files files into "./". */ /* now extract set files files into "./". */
if (verbose == 1) if (verbose == 1)
tarexit = run_prog(RUN_DISPLAY | RUN_PROGRESS, NULL, tarexit = run_program(RUN_DISPLAY | RUN_PROGRESS,
"progress -zf %s tar -xepf -", path); "progress -zf %s tar -xepf -", path);
else if (verbose == 2) else if (verbose == 2)
tarexit = run_prog(RUN_DISPLAY | RUN_PROGRESS, NULL, tarexit = run_program(RUN_DISPLAY | RUN_PROGRESS,
"tar -zxvepf %s", path); "tar -zxvepf %s", path);
else else
tarexit = run_prog(RUN_DISPLAY, NULL, tarexit = run_program(RUN_DISPLAY,
"tar -zxepf %s", path); "tar -zxepf %s", path);
chdir(owd); chdir(owd);
@ -1028,7 +1028,7 @@ get_and_unpack_sets(msg success_msg, msg failure_msg)
ext_dir + strlen(target_prefix())); ext_dir + strlen(target_prefix()));
process_menu(MENU_yesno, NULL); process_menu(MENU_yesno, NULL);
if (yesno) if (yesno)
run_prog(0, NULL, "/bin/rm -rf %s", ext_dir); run_program(0, "/bin/rm -rf %s", ext_dir);
} }
/* Mounted dist dir? */ /* Mounted dist dir? */
@ -1045,7 +1045,7 @@ umount_mnt2(void)
{ {
if (!mnt2_mounted) if (!mnt2_mounted)
return; return;
run_prog(RUN_SILENT, NULL, "/sbin/umount /mnt2"); run_program(RUN_SILENT, "/sbin/umount /mnt2");
mnt2_mounted = 0; mnt2_mounted = 0;
} }
@ -1118,51 +1118,6 @@ sanity_check(void)
return 1; return 1;
} }
#ifdef notdef
/* set reverse to 1 to default to no */
int
askyesno(int reverse)
{
WINDOW *yesnowin;
int c, found;
yesnowin = subwin(stdscr, 5, 20, getmaxy(stdscr)/2 - 2, getmaxx(stdscr)/2 - 10);
if (yesnowin == NULL) {
fprintf(stderr, "sysinst: failed to allocate yes/no box\n");
exit(1);
}
box(yesnowin, '*', '*');
wmove(yesnowin, 2,2);
if (reverse)
waddstr(yesnowin, "Yes or No: [N]");
else
waddstr(yesnowin, "Yes or No: [Y]");
wrefresh(yesnowin);
while ((c = getchar()) != 0) {
if (c == 'y' || c == 'Y') {
found = 1;
break;
} else if (c == 'n' || c == 'N' ) {
found = 0;
break;
} else if (c == '\n' || c == '\r') {
if (reverse)
found = 0;
else
found = 1;
break;
}
}
wclear(yesnowin);
wrefresh(yesnowin);
delwin(yesnowin);
refresh();
return(found);
}
#endif
/* /*
* Some globals to pass things back from callbacks * Some globals to pass things back from callbacks
*/ */
@ -1433,7 +1388,7 @@ set_root_password(void)
msg_display(MSG_rootpw); msg_display(MSG_rootpw);
process_menu(MENU_yesno, NULL); process_menu(MENU_yesno, NULL);
if (yesno) if (yesno)
run_prog(RUN_DISPLAY|RUN_CHROOT, NULL, "passwd -l root"); run_program(RUN_DISPLAY|RUN_CHROOT, "passwd -l root");
return 0; return 0;
} }
@ -1443,7 +1398,7 @@ set_root_shell(void)
msg_display(MSG_rootsh); msg_display(MSG_rootsh);
process_menu(MENU_rootsh, NULL); process_menu(MENU_rootsh, NULL);
run_prog(RUN_DISPLAY|RUN_CHROOT, NULL, "chpass -s %s root", shellpath); run_program(RUN_DISPLAY|RUN_CHROOT, "chpass -s %s root", shellpath);
return 0; return 0;
} }
@ -1490,7 +1445,7 @@ enable_rc_conf(void)
{ {
const char *tp = target_prefix(); const char *tp = target_prefix();
run_prog(0, NULL, "sed -an -e 's/^rc_configured=NO/rc_configured=YES/;" run_program(0, "sed -an -e 's/^rc_configured=NO/rc_configured=YES/;"
"H;$!d;g;w %s/etc/rc.conf' %s/etc/rc.conf", "H;$!d;g;w %s/etc/rc.conf' %s/etc/rc.conf",
tp, tp); tp, tp);
} }