- 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.
* 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]);
if (!is_aout_shared_lib(src))
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++;
break;
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);
break;
}
@ -192,6 +192,14 @@ endloop:
return n;
}
static void
abort_libupdate(void)
{
msg_display(MSG_aoutfail);
process_menu(MENU_ok, NULL);
exit(1);
}
int
move_aout_libs(void)
{
@ -216,7 +224,7 @@ move_aout_libs(void)
if (target_realpath("/emul", prefix) == NULL || stat(prefix, &st) < 0) {
strlcpy(prefix, target_expand("/emul"), sizeof(prefix));
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"));
backedup = 1;
}
@ -234,7 +242,7 @@ move_aout_libs(void)
*/
strlcpy(src, concat_paths(prefix, "aout"), sizeof(src));
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"));
backedup = 1;
}
@ -245,9 +253,10 @@ move_aout_libs(void)
* avoid overflowing the root partition.
*/
strlcpy(prefix, target_expand("/usr/aout"), sizeof(prefix));
run_prog(RUN_FATAL, MSG_aoutfail, "mkdir -p %s", prefix);
run_prog(RUN_FATAL, MSG_aoutfail, "ln -s %s %s",
"/usr/aout", src);
if (run_program(0, "mkdir -p %s", prefix))
abort_libupdate();
if (run_program(0, "ln -s %s %s", "/usr/aout", src))
abort_libupdate();
domove:
/*
@ -260,26 +269,26 @@ domove:
* and ld.so respectively will find them.
*/
strlcpy(src, concat_paths(prefix, "usr/lib"), sizeof(src));
run_prog(0, NULL, "mv -f %s %s", src,
concat_paths(prefix, "usr/lib.old"));
run_program(0, "mv -f %s %s", src, concat_paths(prefix, "usr/lib.old"));
strlcpy(src, concat_paths(prefix, "etc/ld.so.conf"), sizeof(src));
run_prog(0, NULL, "mv -f %s %s", src,
concat_paths(prefix, "etc/ld.so.conf.old"));
run_prog(RUN_FATAL, MSG_aoutfail, "mkdir -p %s ",
concat_paths(prefix, "usr/lib"));
run_prog(RUN_FATAL, MSG_aoutfail, "mkdir -p %s ",
concat_paths(prefix, "etc"));
run_program(0, "mv -f %s %s",
src, concat_paths(prefix, "etc/ld.so.conf.old"));
if (run_program(0, "mkdir -p %s ", concat_paths(prefix, "usr/lib")))
abort_libupdate();
if (run_program(0, "mkdir -p %s ", concat_paths(prefix, "etc")))
abort_libupdate();
strlcpy(src, target_expand("/etc/ld.so.conf"), sizeof(src));
run_prog(RUN_FATAL, MSG_aoutfail, "mv -f %s %s", src,
concat_paths(prefix, "etc/ld.so.conf"));
if (run_program(0, "mv -f %s %s",
src, concat_paths(prefix, "etc/ld.so.conf")))
abort_libupdate();
strlcpy(src, target_expand("/usr/lib"), sizeof(src));
n = handle_aout_libs(src, LIB_MOVE,
concat_paths(prefix, "usr/lib"));
n = handle_aout_libs(src, LIB_MOVE, concat_paths(prefix, "usr/lib"));
run_prog(RUN_FATAL, MSG_aoutfail, "mkdir -p %s ",
concat_paths(prefix, "usr/X11R6/lib"));
if (run_program(0, "mkdir -p %s ",
concat_paths(prefix, "usr/X11R6/lib")))
abort_libupdate();
strlcpy(src, target_expand("/usr/X11R6/lib"), sizeof(src));
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.
@ -286,7 +286,7 @@ md_post_newfs(void)
#if 0
/* XXX boot blocks ... */
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);
#endif
return 0;
@ -331,9 +331,9 @@ md_cleanup_install(void)
#ifndef DEBUG
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
#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.
@ -44,9 +44,9 @@
/* Megs required for a full X installation. */
#define XNEEDMB 60
#define PART_REST D
#define PART_USR E
#define PART_FIRST_FREE F
#define PART_REST PART_D
#define PART_USR PART_E
#define PART_FIRST_FREE PART_F
/*
* 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.
@ -285,7 +285,7 @@ md_post_newfs(void)
#if 0
/* XXX boot blocks ... */
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);
#endif
return 0;
@ -331,9 +331,9 @@ md_cleanup_install(void)
#ifndef DEBUG
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
#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.
@ -44,9 +44,9 @@
/* Megs required for a full X installation. */
#define XNEEDMB 60
#define PART_REST D
#define PART_USR E
#define PART_FIRST_FREE F
#define PART_REST PART_D
#define PART_USR PART_E
#define PART_FIRST_FREE PART_F
/*
* 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.
@ -126,10 +126,14 @@ md_post_disklabel(void)
int
md_post_newfs(void)
{
printf (msg_string(MSG_dobootblks), diskdev);
cp_to_target("/usr/mdec/boot", "/boot");
run_prog(RUN_DISPLAY, "Warning: disk is probably not bootable",
"/usr/sbin/installboot /dev/r%sc /usr/mdec/bootxx_ffs", diskdev);
if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/sbin/installboot /dev/r%sc /usr/mdec/bootxx_ffs",
diskdev))
process_menu(MENU_ok, "Warning: disk is probably not bootable");
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.
@ -44,9 +44,9 @@
/*
* Symbolic names for disk partitions.
*/
#define PART_ROOT A
#define PART_RAW C
#define PART_USR D
#define PART_ROOT PART_A
#define PART_RAW PART_C
#define PART_USR PART_D
/* Megs required for a full X installation. */
#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.
@ -75,9 +75,8 @@ md_post_newfs(void)
{
/* boot blocks ... */
msg_display(MSG_dobootblks, diskdev);
return run_prog(RUN_DISPLAY, NULL,
"/usr/mdec/installboot -v /usr/mdec/xxboot /dev/r%sa",
diskdev);
return run_program(RUN_DISPLAY,
"/usr/mdec/installboot -v /usr/mdec/xxboot /dev/r%sa", diskdev);
}
int
@ -115,9 +114,9 @@ md_cleanup_install(void)
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
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.
@ -90,7 +90,7 @@ md_post_disklabel(void)
/* Sector forwarding / badblocks ... */
if (*doessf) {
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);
}
return 0;
@ -153,9 +153,9 @@ md_cleanup_install(void)
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
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.
@ -85,8 +85,7 @@ md_post_newfs(void)
{
/* boot blocks ... */
msg_display(MSG_dobootblks, diskdev);
return run_prog(RUN_DISPLAY, NULL,
"/usr/mdec/installboot -v /dev/r%sc",
return run_program(RUN_DISPLAY, "/usr/mdec/installboot -v /dev/r%sc",
diskdev);
}
@ -106,7 +105,7 @@ md_make_bsd_partitions(void)
msg_display(MSG_infoahdilabel, diskdev);
process_menu(MENU_noyes, NULL);
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())
return 0;
@ -144,9 +143,9 @@ md_cleanup_install(void)
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
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.
@ -46,11 +46,11 @@
#include <unistd.h>
/* constants and defines */
#define PART_ROOT A
#define PART_SWAP B
#define PART_RAW C
#define PART_USR D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE E
#define PART_ROOT PART_A
#define PART_SWAP PART_B
#define PART_RAW PART_C
#define PART_USR PART_D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE PART_E
#define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */
#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.
@ -80,7 +80,7 @@ md_post_disklabel(void)
/* Sector forwarding / badblocks ... */
if (*doessf) {
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);
}
return 0;
@ -91,9 +91,9 @@ md_post_newfs(void)
{
/* boot blocks ... */
printf (msg_string(MSG_dobootblks), diskdev);
run_prog (RUN_DISPLAY, NULL,
"/usr/mdec/installboot -v /usr/mdec/biosboot.sym "
"/dev/r%sa", diskdev);
run_program(RUN_DISPLAY,
"/usr/mdec/installboot -v /usr/mdec/biosboot.sym /dev/r%sa",
diskdev);
return 0;
}
@ -105,7 +105,7 @@ md_copy_filesystem(void)
}
/* 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)
return 1;
@ -149,9 +149,9 @@ md_cleanup_install(void)
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
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.
@ -138,7 +138,7 @@ md_post_newfs(void)
#if 0
/* XXX boot blocks ... */
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);
#endif
return 0;
@ -184,9 +184,9 @@ md_cleanup_install(void)
#ifndef DEBUG
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
#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.
@ -157,9 +157,9 @@ md_cleanup_install(void)
#ifndef DEBUG
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
#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.
@ -80,7 +80,7 @@ md_post_disklabel(void)
/* Sector forwarding / badblocks ... */
if (*doessf) {
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);
}
return 0;
@ -93,9 +93,9 @@ md_post_newfs(void)
#if 0
/* boot blocks ... */
printf (msg_string(MSG_dobootblks), diskdev);
run_prog (RUN_DISPLAY, NULL,
"/usr/mdec/installboot -v /usr/mdec/biosboot.sym "
"/dev/r%sa", diskdev);
run_program(RUN_DISPLAY,
"/usr/mdec/installboot -v /usr/mdec/biosboot.sym /dev/r%sa",
diskdev);
#endif
return 0;
}
@ -108,7 +108,7 @@ md_copy_filesystem(void)
}
/* 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)
return 1;
@ -152,9 +152,9 @@ md_cleanup_install(void)
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
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.
@ -147,9 +147,10 @@ md_post_newfs(void)
/* boot blocks ... */
msg_display(MSG_dobootblks, diskdev);
cp_to_target("/usr/mdec/boot", "/boot");
run_prog(RUN_DISPLAY, "Warning: disk is probably not bootable",
"/usr/mdec/installboot /usr/mdec/uboot.lif /dev/r%sa",
diskdev);
if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/mdec/installboot /usr/mdec/uboot.lif /dev/r%sa",
diskdev))
process_menu(MENU_ok, "Warning: disk is probably not bootable");
return (0);
}
@ -180,18 +181,18 @@ int
md_check_partitions(void)
{
/* 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++) {
if (part == C)
for (part = PART_A; part < 8; part++) {
if (part == PART_C)
continue;
if (last >= A && bsdlabel[part].pi_size > 0) {
if (last >= PART_A && bsdlabel[part].pi_size > 0) {
msg_display(MSG_emptypart, part+'a');
process_menu(MENU_ok, NULL);
return (0);
}
if (bsdlabel[part].pi_size == 0) {
if (last < A)
if (last < PART_A)
last = part;
} else {
if (start >= bsdlabel[part].pi_offset) {
@ -228,9 +229,9 @@ md_cleanup_install(void)
#ifdef notyet /* sed is too large for ramdisk */
enable_rc_conf();
#endif
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
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.
@ -52,11 +52,11 @@
/*
* Symbolic names for disk partitions.
*/
#define PART_ROOT A
#define PART_SWAP B
#define PART_RAW C
#define PART_USR D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE E
#define PART_ROOT PART_A
#define PART_SWAP PART_B
#define PART_RAW PART_C
#define PART_USR PART_D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE PART_E
#define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */
#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.
@ -85,7 +85,7 @@ md_post_disklabel(void)
/* Sector forwarding / badblocks ... */
if (*doessf) {
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);
}
return 0;
@ -138,9 +138,9 @@ md_cleanup_install(void)
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
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.
@ -68,6 +68,7 @@ static int mbr_root_above_chs(void);
static void md_upgrade_mbrtype(void);
static int md_read_bootcode(const char *, struct mbr_sector *);
static unsigned int get_bootmodel(void);
static char *md_bootxx_name(void);
int
@ -280,6 +281,7 @@ md_post_newfs(void)
size_t len;
int td, sd;
char bootxx[8192 + 4];
char *bootxx_filename;
static struct x86_boot_params boottype =
{sizeof boottype, 0, 10, 0, 9600, ""};
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);
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)
goto bad_bootxx;
len = read(sd, bootxx, sizeof bootxx);
@ -373,7 +377,17 @@ md_pre_update(void)
int
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.
*/
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",
tp, tp);
else
#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",
tp, tp);
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
int
@ -594,3 +608,27 @@ md_set_sizemultname(void)
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.
@ -38,28 +38,34 @@
/* 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);
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);
else
break;
default:
msg_display_add(MSG_console_com,
((struct x86_boot_params *)arg)->bp_consdev - 1,
((struct x86_boot_params *)arg)->bp_conspeed);
}
};
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
{((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
{((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
{((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
{((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_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;
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.
@ -58,6 +58,7 @@ Selected bootblock: }
message console_PC {BIOS console}
message console_com {Serial port com%d at %d baud}
message console_unchanged {Unchanged}
message Bootblocks_selection
{Bootblocks selection}
@ -69,6 +70,8 @@ message Use_serial_com3 {Use serial port com3}
message serial_baud_rate {Serial baud rate}
message Use_existing_bootblocks {Use existing bootblocks}
message No_Bootcode {No bootcode for root partition}
message dobootblks
{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.
@ -54,6 +54,7 @@ Selected bootblock: }
message console_PC {BIOS console}
message console_com {Serial port com%d, baud rate %d}
message console_unchanged {Unchanged}
message Bootblocks_selection
{Bootblocks selection}
@ -65,20 +66,7 @@ message Use_serial_com3 {Use serial port com3}
message serial_baud_rate {Serial baud rate}
message Use_existing_bootblocks {Use existing bootblocks}
.if 0
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 No_Bootcode {No bootcode for root partition}
message dobootblks
{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: */
/* 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_com {Serial port com%d, baud rate %d}
message console_unchanged {Unchanged}
message Bootblocks_selection
{Wybor bootblokow}
@ -67,18 +68,7 @@ message Use_serial_com3 {Use serial port com3}
message serial_baud_rate {Serial baud rate}
message Use_existing_bootblocks {Use existing bootblocks}
.if 0
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 No_Bootcode {No bootcode for root partition}
message dobootblks
{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.
@ -1024,7 +1024,7 @@ md_make_bsd_partitions(void)
strcpy (bsddiskname, diskdev);
/* 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
f = fopen ("/tmp/disktab", "a");
#else
@ -1089,9 +1089,9 @@ md_cleanup_install(void)
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
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.
@ -131,7 +131,7 @@ md_post_newfs(void)
printf (msg_string(MSG_dobootblks), diskdev);
cp_to_target("/usr/mdec/ofwboot", bootfile);
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);
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.
@ -44,9 +44,9 @@
/*
* Symbolic names for disk partitions.
*/
#define PART_ROOT A
#define PART_RAW C
#define PART_USR G
#define PART_ROOT PART_A
#define PART_RAW PART_C
#define PART_USR PART_G
/* Megs required for a full X installation. */
#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.
@ -141,6 +141,7 @@ md_post_disklabel(void)
int
md_post_newfs(void)
{
/* XXX boot blocks ... */
if (target_already_root()) {
/* /usr is empty and we must already have bootblocks?*/
@ -149,8 +150,9 @@ md_post_newfs(void)
printf(msg_string(MSG_dobootblks), diskdev);
cp_to_target("/usr/mdec/boot", "/boot");
run_prog(RUN_DISPLAY, "Warning: disk is probably not bootable",
"/usr/mdec/installboot /dev/r%sc /usr/mdec/bootxx_ffs", diskdev);
if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/mdec/installboot /dev/r%sc /usr/mdec/bootxx_ffs", diskdev))
process_menu(MENU_ok, "Warning: disk is probably not bootable");
return 0;
}
@ -201,9 +203,9 @@ md_cleanup_install(void)
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
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.
@ -47,11 +47,11 @@
/*
* Symbolic names for disk partitions.
*/
#define PART_ROOT A
#define PART_SWAP B
#define PART_RAW C
#define PART_USR D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE E
#define PART_ROOT PART_A
#define PART_SWAP PART_B
#define PART_RAW PART_C
#define PART_USR PART_D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE PART_E
#define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */
#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.
@ -147,9 +147,10 @@ md_post_newfs(void)
/* boot blocks ... */
msg_display(MSG_dobootblks, diskdev);
cp_to_target("/usr/mdec/bootsd", "/.bootsd");
run_prog(RUN_DISPLAY, "Warning: disk is probably not bootable",
"/usr/mdec/installboot %s /usr/mdec/bootxx /dev/r%sa",
target_expand("/.bootsd"), diskdev);
if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/mdec/installboot %s /usr/mdec/bootxx /dev/r%sa",
target_expand("/.bootsd"), diskdev))
process_menu(MENU_ok, "Warning: disk is probably not bootable");
return (0);
}
@ -180,18 +181,18 @@ int
md_check_partitions(void)
{
/* 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++) {
if (part == C)
for (part = PART_A; part < 8; part++) {
if (part == PART_C)
continue;
if (last >= A && bsdlabel[part].pi_size > 0) {
if (last >= PART_A && bsdlabel[part].pi_size > 0) {
msg_display(MSG_emptypart, part+'a');
process_menu(MENU_ok, NULL);
return (0);
}
if (bsdlabel[part].pi_size == 0) {
if (last < A)
if (last < PART_A)
last = part;
} else {
if (start > bsdlabel[part].pi_offset) {
@ -228,9 +229,9 @@ md_cleanup_install(void)
#ifdef notyet /* sed is too large for ramdisk */
enable_rc_conf();
#endif
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
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.
@ -52,11 +52,11 @@
/*
* Symbolic names for disk partitions.
*/
#define PART_ROOT A
#define PART_SWAP B
#define PART_RAW C
#define PART_USR D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE E
#define PART_ROOT PART_A
#define PART_SWAP PART_B
#define PART_RAW PART_C
#define PART_USR PART_D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE PART_E
#define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */
#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.
@ -144,7 +144,7 @@ md_post_newfs()
printf(msg_string(MSG_dobootblks), diskdev);
cp_to_target("/usr/mdec/boot", bootfile);
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);
return 0;
}
@ -197,8 +197,8 @@ md_cleanup_install()
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
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.
@ -44,11 +44,11 @@
/*
* Symbolic names for disk partitions
*/
#define PART_ROOT A
#define PART_SWAP B
#define PART_RAW C
#define PART_USR G /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE D
#define PART_ROOT PART_A
#define PART_SWAP PART_B
#define PART_RAW PART_C
#define PART_USR PART_G /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE PART_D
#define DEFSWAPRAM 16 /* Assume at least this RAM for swap calc */
#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.
@ -144,7 +144,7 @@ md_post_newfs()
printf (msg_string(MSG_dobootblks), diskdev);
cp_to_target("/usr/mdec/boot", bootfile);
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);
return 0;
}
@ -196,8 +196,8 @@ md_cleanup_install()
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
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.
@ -44,11 +44,11 @@
/*
* Symbolic names for disk partitions
*/
#define PART_ROOT A
#define PART_SWAP B
#define PART_RAW C
#define PART_USR G /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE D
#define PART_ROOT PART_A
#define PART_SWAP PART_B
#define PART_RAW PART_C
#define PART_USR PART_G /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE PART_D
#define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */
#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.
@ -44,7 +44,7 @@
#define XNEEDMB 50
/* Size of boot partition */
#define PART_BOOT D
#define PART_BOOT PART_D
#define BOOT_HIGH
#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.
@ -91,7 +91,7 @@ md_post_disklabel()
/* Sector forwarding / badblocks ... */
if (*doessf) {
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));
}
@ -141,9 +141,9 @@ md_cleanup_install()
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
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.
@ -47,11 +47,11 @@
#include "mbr.h"
#define PART_ROOT A
#define PART_SWAP B
#define PART_RAW C
#define PART_USR D
#define PART_FIRST_FREE D
#define PART_ROOT PART_A
#define PART_SWAP PART_B
#define PART_RAW PART_C
#define PART_USR PART_D
#define PART_FIRST_FREE PART_D
#define DEFSWAPRAM 64 /* Assume at least this RAM for swap calc */
#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.
@ -149,8 +149,9 @@ md_post_newfs(void)
printf(msg_string(MSG_dobootblks), diskdev);
cp_to_target("/usr/mdec/boot.pmax", "/boot.pmax");
run_prog(RUN_DISPLAY, "Warning: disk is probably not bootable",
"/usr/sbin/installboot /dev/r%sc /usr/mdec/bootxx_ffs", diskdev);
if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/sbin/installboot /dev/r%sc /usr/mdec/bootxx_ffs", diskdev))
process_menu(MENU_ok, "Warning: disk is probably not bootable");
return 0;
}
@ -201,9 +202,9 @@ md_cleanup_install(void)
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
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.
@ -43,11 +43,11 @@
/*
* Symbolic names for disk partitions.
*/
#define PART_ROOT A
#define PART_SWAP B
#define PART_RAW C
#define PART_USR D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE E
#define PART_ROOT PART_A
#define PART_SWAP PART_B
#define PART_RAW PART_C
#define PART_USR PART_D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE PART_E
#define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */
#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.
@ -88,7 +88,7 @@ md_post_disklabel(void)
/* Sector forwarding / badblocks ... */
if (*doessf) {
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);
}
return 0;
@ -143,9 +143,9 @@ md_cleanup_install(void)
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
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.
@ -49,11 +49,11 @@
#include "mbr.h"
/* constants and defines */
#define PART_ROOT A
#define PART_SWAP B
#define PART_RAW C
#define PART_USR D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE E
#define PART_ROOT PART_A
#define PART_SWAP PART_B
#define PART_RAW PART_C
#define PART_USR PART_D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE PART_E
#define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */
#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.
@ -79,7 +79,7 @@ md_post_disklabel(void)
/* Sector forwarding / badblocks ... */
if (*doessf) {
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);
}
return 0;
@ -90,9 +90,9 @@ md_post_newfs(void)
{
/* boot blocks ... */
printf (msg_string(MSG_dobootblks), diskdev);
run_prog (RUN_DISPLAY, NULL,
"/usr/mdec/installboot -v /usr/mdec/biosboot.sym "
"/dev/r%sa", diskdev);
run_program(RUN_DISPLAY,
"/usr/mdec/installboot -v /usr/mdec/biosboot.sym /dev/r%sa",
diskdev);
return 0;
}
@ -104,7 +104,7 @@ md_copy_filesystem (void)
}
/* 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)
return 1;
@ -151,9 +151,9 @@ md_cleanup_install(void)
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
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.
@ -114,16 +114,16 @@ md_post_disklabel(void)
{
set_swap(diskdev, bsdlabel);
if (strstr(instsys.version, "(INSTALL32_IP3x)"))
return run_prog(RUN_DISPLAY, MSG_cmdfail,
"%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip3xboot",
diskdev);
return run_program(RUN_DISPLAY,
"%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip3xboot",
diskdev);
else
run_prog(RUN_DISPLAY, MSG_cmdfail,
"%s %s", "/usr/mdec/sgivol -f -w aoutboot /usr/mdec/aoutboot",
diskdev);
return run_prog(RUN_DISPLAY, MSG_cmdfail,
"%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip2xboot",
diskdev);
run_program(RUN_DISPLAY,
"%s %s", "/usr/mdec/sgivol -f -w aoutboot /usr/mdec/aoutboot",
diskdev);
return run_program(RUN_DISPLAY,
"%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip2xboot",
diskdev);
}
int
@ -174,9 +174,9 @@ md_cleanup_install(void)
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
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.
@ -43,12 +43,12 @@
/*
* Symbolic names for disk partitions.
*/
#define PART_ROOT A
#define PART_SWAP B
#define PART_RAW C
#define PART_BOOT D
#define PART_USR E /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE F
#define PART_ROOT PART_A
#define PART_SWAP PART_B
#define PART_RAW PART_C
#define PART_BOOT PART_D
#define PART_USR PART_E /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE PART_F
#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.
@ -158,9 +158,9 @@ md_cleanup_install(void)
#ifndef DEBUG
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
#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.
@ -138,9 +138,9 @@ md_post_newfs(void)
/* boot blocks ... */
msg_display(MSG_dobootblks, diskdev);
return (run_prog(RUN_DISPLAY, NULL, "/sbin/disklabel -W %s", diskdev) ||
run_prog(RUN_DISPLAY, NULL,
"/usr/mdec/binstall ffs %s", targetroot_mnt));
return (run_program(RUN_DISPLAY, "/sbin/disklabel -W %s", diskdev) ||
run_program(RUN_DISPLAY, "/usr/mdec/binstall ffs %s",
targetroot_mnt));
}
/*
@ -191,9 +191,9 @@ md_cleanup_install(void)
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
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.
@ -44,11 +44,11 @@
/*
* Symbolic names for disk partitions.
*/
#define PART_ROOT A
#define PART_SWAP B
#define PART_RAW C
#define PART_USR G /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE D
#define PART_ROOT PART_A
#define PART_SWAP PART_B
#define PART_RAW PART_C
#define PART_USR PART_G /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE PART_D
#define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */
#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.
@ -177,14 +177,14 @@ md_cleanup_install(void)
/* Install boot blocks now that we have a full system ... */
msg_display(MSG_dobootblks, diskdev);
run_prog(RUN_DISPLAY, NULL, "/sbin/disklabel -W %s", diskdev);
run_prog(RUN_DISPLAY, NULL, "/usr/mdec/binstall ffs %s", targetroot_mnt);
run_program(RUN_DISPLAY, "/sbin/disklabel -W %s", diskdev);
run_program(RUN_DISPLAY, "/usr/mdec/binstall ffs %s", targetroot_mnt);
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
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.
@ -44,11 +44,11 @@
/*
* Symbolic names for disk partitions.
*/
#define PART_ROOT A
#define PART_SWAP B
#define PART_RAW C
#define PART_USR G /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE D
#define PART_ROOT PART_A
#define PART_SWAP PART_B
#define PART_RAW PART_C
#define PART_USR PART_G /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE PART_D
#define DEFSWAPRAM 64 /* Assume at least this RAM for swap calc */
#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.
@ -135,7 +135,7 @@ md_post_newfs(void)
{
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);
return 0;
}
@ -188,9 +188,9 @@ md_cleanup_install(void)
enable_rc_conf();
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
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.
@ -44,11 +44,11 @@
/*
* Symbolic names for disk partitions.
*/
#define PART_ROOT A
#define PART_SWAP B
#define PART_RAW C
#define PART_USR D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE E
#define PART_ROOT PART_A
#define PART_SWAP PART_B
#define PART_RAW PART_C
#define PART_USR PART_D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE PART_E
#define DEFSWAPRAM 16 /* Assume at least this RAM for swap calc */
#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.
@ -199,7 +199,7 @@ md_newdisk(void)
{
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);
}
@ -241,9 +241,10 @@ md_post_newfs(void)
/* boot blocks ... */
msg_display(MSG_dobootblks, diskdev);
cp_to_target("/usr/mdec/boot", "/boot");
run_prog(RUN_DISPLAY, "Warning: disk is probably not bootable",
"/usr/mdec/installboot.new /usr/mdec/sdboot_ufs /dev/r%sa",
diskdev);
if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/mdec/installboot.new /usr/mdec/sdboot_ufs /dev/r%sa",
diskdev))
process_menu(MENU_ok, "Warning: disk is probably not bootable");
return 0;
}
@ -272,18 +273,18 @@ int
md_check_partitions(void)
{
/* 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++) {
if (part == C)
for (part = PART_A; part < 8; part++) {
if (part == PART_C)
continue;
if (last >= A && bsdlabel[part].pi_size > 0) {
if (last >= PART_A && bsdlabel[part].pi_size > 0) {
msg_display(MSG_emptypart, part+'a');
process_menu(MENU_ok, NULL);
return 0;
}
if (bsdlabel[part].pi_size == 0) {
if (last < A)
if (last < PART_A)
last = part;
} else {
if (start >= bsdlabel[part].pi_offset) {
@ -319,9 +320,9 @@ md_cleanup_install(void)
#ifdef notyet /* sed is too large for ramdisk */
enable_rc_conf();
#endif
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
run_program(0, "rm -f %s", target_expand("/sysinst"));
run_program(0, "rm -f %s", target_expand("/.termcap"));
run_program(0, "rm -f %s", target_expand("/.profile"));
}
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.
@ -52,11 +52,11 @@
/*
* Symbolic names for disk partitions.
*/
#define PART_ROOT A
#define PART_SWAP B
#define PART_RAW C
#define PART_USR D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE E
#define PART_ROOT PART_A
#define PART_SWAP PART_B
#define PART_RAW PART_C
#define PART_USR PART_D /* Can be after PART_FIRST_FREE */
#define PART_FIRST_FREE PART_E
#define DEFSWAPRAM 32 /* Assume at least this RAM for swap calc */
#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.
@ -65,10 +65,10 @@
/* Defaults for things that might be defined in md.h */
#ifndef PART_ROOT
#define PART_ROOT A
#define PART_ROOT PART_A
#endif
#ifndef PART_SWAP
#define PART_SWAP B
#define PART_SWAP PART_B
#endif
#ifndef PART_USR
#define PART_USR PART_ANY
@ -555,15 +555,15 @@ make_bsd_partitions(void)
/* Whole disk partition */
part_raw = getrawpartition();
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_size = dlsize;
if (part_raw == D) {
if (part_raw == PART_D) {
/* Probably a system that expects an i386 style mbr */
part_bsd = C;
bsdlabel[C].pi_offset = ptstart;
bsdlabel[C].pi_size = ptsize;
part_bsd = PART_C;
bsdlabel[PART_C].pi_offset = ptstart;
bsdlabel[PART_C].pi_size = ptsize;
} else {
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.
@ -45,11 +45,18 @@
#include <sys/types.h>
#include <sys/disklabel.h>
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"
#define min(a,b) ((a) < (b) ? (a) : (b))
#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) < (b) ? (a) : (b))
#define max(a,b) ((a) > (b) ? (a) : (b))
/* Define for external varible use */
#ifdef MAIN
@ -66,8 +73,8 @@ extern const char * const fstypenames[];
#define SSTRSIZE 30
/* For run.c: collect() */
#define T_FILE 0
#define T_OUTPUT 1
#define T_FILE 0
#define T_OUTPUT 1
/* run_prog flags */
#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_FULLSCREEN 0x0008 /* fullscreen (use with RUN_DISPLAY) */
#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_PROGRESS 0x0080 /* Output is just progess test */
#define RUN_NO_CLEAR 0x0100 /* Leave program output after error */
/* Installation sets */
#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_MD 0xf0000000u /* All machine dependant sets */
#define SET_MD_1 0x10000000u /* Machine dependant set */
#define SET_MD_2 0x20000000u /* Machine dependant set */
#define SET_MD_3 0x40000000u /* Machine dependant set */
#define SET_MD_4 0x80000000u /* Machine dependant set */
#define SET_MD_1 0x10000000u /* Machine dependant set */
#define SET_MD_2 0x20000000u /* Machine dependant set */
#define SET_MD_3 0x40000000u /* Machine dependant set */
#define SET_MD_4 0x80000000u /* Machine dependant set */
/* Macros */
#define nelem(x) (sizeof (x) / sizeof *(x))
/* Round up to the next full cylinder size */
#define ROUNDDOWN(n,d) (((n)/(d)) * (d))
#define DIVUP(n,d) (((n) + (d) - 1) / (d))
#define ROUNDUP(n,d) (DIVUP((n), (d)) * (d))
#define ROUNDDOWN(n,d) (((n)/(d)) * (d))
#define DIVUP(n,d) (((n) + (d) - 1) / (d))
#define ROUNDUP(n,d) (DIVUP((n), (d)) * (d))
#define NUMSEC(size, sizemult, cylsize) \
((size) == -1 ? -1 : (sizemult) == 1 ? (size) : \
ROUNDUP((size) * (sizemult), (cylsize)))
@ -144,10 +152,11 @@ typedef struct _partinfo {
#define pi_frag pi_partition.p_frag
#define pi_cpg pi_partition.p_cpg
char pi_mount[20];
uint pi_isize; /* bytes per inode */
uint pi_isize; /* bytes per inode (for # inodes) */
uint pi_flags;
#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_NOATIME 0x0020 /* mount -o noatime */
#define PIF_NODEV 0x0040 /* mount -o nodev */
@ -202,7 +211,8 @@ EXTERN int current_cylsize;
EXTERN int root_limit;
/* 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))
EXTERN partinfo oldlabel[MAXPARTITIONS]; /* What we found on the disk */
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. */
#if !defined(SYSINST_FTP_HOST)
#define SYSINST_FTP_HOST "ftp.NetBSD.org"
#define SYSINST_FTP_HOST "ftp.NetBSD.org"
#endif
#if !defined(SYSINST_FTP_DIR)
#define SYSINST_FTP_DIR "pub/NetBSD/NetBSD-" REL "/" MACH
#define SYSINST_FTP_DIR "pub/NetBSD/NetBSD-" REL "/" MACH
#endif
#if !defined(SYSINST_CDROM_DIR)
#define SYSINST_CDROM_DIR "/" MACH
#define SYSINST_CDROM_DIR "/" MACH
#endif
EXTERN char ext_dir[STRSIZE] INIT("");
@ -260,13 +270,6 @@ extern unsigned int sets_valid;
extern unsigned int sets_selected;
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 */
void set_menu_numopts(int, int);
@ -296,7 +299,7 @@ void disp_cur_fspart(int, int);
int write_disklabel(void);
int make_filesystems(void);
int make_fstab(void);
int fsck_disks(void);
int mount_disks(void);
int set_swap(const char *, partinfo *);
int check_swap(const char *, int);
@ -304,7 +307,6 @@ int check_swap(const char *, int);
int fs_is_lfs(void *);
/* from label.c */
const char *get_last_mounted(int, int);
void emptylabel(partinfo *);
int savenewlabel(partinfo *, int);
@ -312,8 +314,9 @@ int incorelabel(const char *, partinfo *);
int edit_and_check_label(partinfo *, int, int, int);
int getpartoff(int);
int getpartsize(int, int);
int set_bsize(partinfo *, int);
int set_fsize(partinfo *, int);
void set_bsize(partinfo *, int);
void set_fsize(partinfo *, int);
void set_ptype(partinfo *, int, int, int);
/* from install.c */
void do_install(void);
@ -338,7 +341,7 @@ void mnt_net_config(void);
/* From run.c */
int collect(int, char **, const char *, ...);
int run_prog(int, msg, const char *, ...);
int run_program(int, const char *, ...);
void do_logging(void);
int do_system(const char *);
@ -348,7 +351,6 @@ void do_reinstall_sets(void);
void restore_etc(void);
/* from util.c */
int askyesno(int);
int dir_exists_p(const char *);
int file_exists_p(const char *);
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 mv_within_target_or_die(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_dir_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.
@ -51,6 +51,7 @@
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
#define FSTYPENAMES
#define MOUNTNAMES
#define static
#include <sys/disklabel.h>
#undef static
@ -80,14 +81,9 @@ struct disk_desc {
#define dd_totsec dg.dg_totsec
/* Local prototypes */
static void foundffs(struct data *, size_t);
static int do_fsck(const char *);
static int fsck_root(void);
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 *);
static int foundffs(struct data *, size_t);
static int mount_root(void);
static int fsck_preen(const char *, int, const char *);
#ifndef DISK_NAMES
#define DISK_NAMES "wd", "sd", "ld"
@ -210,21 +206,28 @@ fmt_fspart(menudesc *m, int ptn, void *arg)
int poffset, psize, pend;
const char *desc;
static const char *Yes, *No;
partinfo *p = bsdlabel + ptn;
if (Yes == NULL) {
Yes = msg_string(MSG_Yes);
No = msg_string(MSG_No);
}
poffset = bsdlabel[ptn].pi_offset / sizemult;
psize = bsdlabel[ptn].pi_size / sizemult;
poffset = p->pi_offset / sizemult;
psize = p->pi_size / sizemult;
if (psize == 0)
pend = 0;
else
pend = (bsdlabel[ptn].pi_offset +
bsdlabel[ptn].pi_size) / sizemult - 1;
pend = (p->pi_offset + p->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
if (ptn == PART_BOOT)
desc = msg_string(MSG_Boot_partition_cant_change);
@ -232,17 +235,15 @@ fmt_fspart(menudesc *m, int ptn, void *arg)
if (ptn == getrawpartition())
desc = msg_string(MSG_Whole_disk_cant_change);
else {
if (ptn == C)
if (ptn == PART_C)
desc = msg_string(MSG_NetBSD_partition_cant_change);
}
wprintw(m->mw, msg_string(MSG_fspart_row),
poffset, pend, psize, desc,
PI_ISBSDFS(&bsdlabel[ptn]) ?
bsdlabel[ptn].pi_flags & PIF_NEWFS ? Yes : No : "",
bsdlabel[ptn].pi_mount[0] == '/' ?
bsdlabel[ptn].pi_flags & PIF_MOUNT ? Yes : No : "",
bsdlabel[ptn].pi_mount);
p->pi_flags & PIF_NEWFS ? Yes : "",
p->pi_flags & PIF_MOUNT ? Yes : "",
p->pi_mount);
}
/*
@ -262,8 +263,7 @@ write_disklabel (void)
#ifdef DISKLABEL_CMD
/* disklabel the disk */
return run_prog(RUN_DISPLAY, MSG_cmdfail,
"%s -f /tmp/disktab %s '%s'",
return run_program(RUN_DISPLAY, "%s -f /tmp/disktab %s '%s'",
DISKLABEL_CMD, diskdev, bsddiskname);
#else
return 0;
@ -284,9 +284,12 @@ make_filesystems(void)
int i;
int ptn;
int ptn_order[nelem(bsdlabel)];
char partname[STRSIZE];
int error;
int error = 0;
int maxpart = getmaxpartitions();
char *newfs;
const char *mnt_opts;
const char *fsname;
partinfo *lbl;
if (maxpart > nelem(bsdlabel))
maxpart = nelem(bsdlabel);
@ -305,62 +308,68 @@ make_filesystems(void)
* point defined, or is marked preserve, don't touch it!
*/
ptn = ptn_order[i];
if (!PI_ISBSDFS(&bsdlabel[ptn]))
continue;
lbl = bsdlabel + ptn;
if (is_active_rootpart(diskdev, ptn))
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. */
static int
do_flfs_newfs(const char *partname, int partno, const char *mountpoint)
{
char dev_name[STRSIZE];
char options[16];
int error;
const char *newfs;
if (*lbl->pi_mount == 0)
/* No mount point */
continue;
if (!*mountpoint)
return 0;
if (bsdlabel[partno].pi_flags & PIF_NEWFS) {
switch (bsdlabel[partno].pi_fstype) {
newfs = NULL;
mnt_opts = NULL;
fsname = NULL;
switch (lbl->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:
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;
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;
default:
return 0;
}
if (bsdlabel[partno].pi_isize > 0)
snprintf(options, sizeof options, " -i%d",
bsdlabel[partno].pi_isize);
else
options[0] = 0;
error = run_prog(RUN_DISPLAY | RUN_PROGRESS, MSG_cmdfail,
"%s%s /dev/r%s", newfs, options, partname);
} else
error = 0;
if (lbl->pi_flags & PIF_NEWFS && newfs != NULL) {
error = run_program(RUN_DISPLAY | RUN_PROGRESS,
"%s /dev/r%s%c", newfs, diskdev, 'a' + ptn);
} else {
/* We'd better check it isn't dirty */
error = fsck_preen(diskdev, ptn, fsname);
}
free(newfs);
if (error != 0)
return error;
if (error == 0 && bsdlabel[partno].pi_flags & PIF_MOUNT) {
snprintf(dev_name, sizeof(dev_name), "/dev/%s", partname);
make_target_dir(mountpoint);
error = target_mount(bsdlabel[partno].pi_fstype == FS_BSDFFS ?
"-v -o async" : "-v", dev_name, mountpoint);
if (error) {
msg_display(MSG_mountfail, dev_name, mountpoint);
process_menu(MENU_ok, NULL);
if (lbl->pi_flags & PIF_MOUNT && mnt_opts != NULL) {
make_target_dir(lbl->pi_mount);
error = target_mount(mnt_opts, diskdev, ptn,
lbl->pi_mount);
if (error) {
msg_display(MSG_mountfail,
diskdev, 'a' + ptn, lbl->pi_mount);
process_menu(MENU_ok, NULL);
return error;
}
}
}
return error;
return 0;
}
int
@ -414,7 +423,7 @@ make_fstab(void)
fstype = "lfs";
/* FALLTHROUGH */
case FS_BSDFFS:
fsck_pass = fsck_num(mp);
fsck_pass = (strcmp(mp, "/") == 0) ? 1 : 2;
dump_freq = 1;
break;
case FS_MSDOS:
@ -468,167 +477,100 @@ make_fstab(void)
return 0;
}
/* Return the appropriate fs_passno field, as specified by fstab(5) */
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*/
foundffs(struct data *list, size_t num)
{
if (strcmp(list[1].u.s_val, "/") != 0 &&
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++;
}
}
int error;
/*
* Run a check on the specified filesystem.
*/
static int
do_fsck(const char *diskpart)
{
char rraw[SSTRSIZE];
const char *prog = "/sbin/fsck";
int err;
if (num < 2 || strcmp(list[1].u.s_val, "/") == 0 ||
strstr(list[2].u.s_val, "noauto") != NULL)
return 0;
/* cons up raw partition name. */
snprintf (rraw, sizeof(rraw), "/dev/r%s", diskpart);
error = fsck_preen(list[0].u.s_val, ' '-'a', "ffs");
if (error != 0)
return error;
#ifndef DEBUG_SETS
err = run_prog(RUN_DISPLAY, NULL, "%s %s", prog, rraw);
#else
err = run_prog(RUN_DISPLAY, NULL, "%s -f %s", prog, rraw);
#endif
wrefresh(stdscr);
return err;
error = target_mount("", list[0].u.s_val, ' '-'a', list[1].u.s_val);
if (error != 0)
return error;
return 0;
}
/*
* Do an fsck. On failure, inform the user by showing a warning
* message and doing menu_ok() before proceeding.
* acknowledge the warning before continuing.
* Returns 0 on success, or nonzero return code from do_fsck() on failure.
* Returns 0 on success, or nonzero return code from fsck() on failure.
*/
int
fsck_with_error_menu(const char *diskpart)
static int
fsck_preen(const char *disk, int ptn, const char *fsname)
{
char *prog;
int error;
if ((error = do_fsck(diskpart)) != 0) {
#ifdef DEBUG
fprintf(stderr, "sysinst: do_fsck() returned err %d\n", error);
#endif
msg_display(MSG_badfs, diskpart, "", error);
ptn += 'a';
if (fsname == NULL)
return 0;
/* first check fsck program exists, if not assue ok */
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);
}
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.
*/
int
fsck_root(void)
mount_root(void)
{
int error;
char rootdev[STRSIZE];
/* cons up the root name: partition 'a' on the target diskdev.*/
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);
error = fsck_preen(diskdev, rootpart, "ffs");
if (error != 0)
return error;
if (target_already_root()) {
return (0);
}
/* Mount /dev/<diskdev>a on target's "".
* If we pass "" as mount-on, Prefixing will DTRT.
* for now, use no options.
* XXX consider -o remount in case target root is
* current root, still readonly from single-user?
*/
error = target_mount_with_error_menu("", rootdev, "");
#ifdef DEBUG
printf("fsck_root: mount of %s returns %d\n", rootdev, error);
#endif
return (error);
return target_mount("", diskdev, rootpart, "");
}
/* 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
fsck_disks(void)
mount_disks(void)
{
char *fstab;
int fstabsize;
int i;
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. */
if (!target_already_root()) {
error = fsck_root();
error = mount_root();
if (error != 0 && error != EBUSY)
return 0;
}
@ -650,21 +592,10 @@ fsck_disks(void)
process_menu(MENU_ok, NULL);
return 0;
}
walk(fstab, (size_t)fstabsize, fstabbuf, numfstabbuf);
error = walk(fstab, (size_t)fstabsize, fstabbuf, numfstabbuf);
free(fstab);
for (i = 0; i < devcnt; i++) {
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;
return error;
}
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
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#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
#include <sys/types.h>
@ -145,13 +145,16 @@ check_one_root(partinfo *lp, int nparts)
int foundroot = 0;
for (part = 0; part < nparts; lp++, part++) {
#if 0
if (!PI_ISBSDFS(lp))
continue;
#endif
if (!(lp->pi_flags & PIF_MOUNT))
continue;
if (strcmp(lp->pi_mount, "/") != 0)
continue;
if (foundroot)
/* Duplicate */
return 0;
foundroot = 1;
/* Save partition number, a few things need to know it */
@ -192,7 +195,15 @@ edit_fs_size(menudesc *m, void *arg)
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)
{
int frags, sz;
@ -208,11 +219,9 @@ set_bsize(partinfo *p, int size)
p->pi_frag = frags;
p->pi_fsize = size / frags;
return 0;
}
int
void
set_fsize(partinfo *p, int fsize)
{
int bsz = p->pi_fsize * p->pi_frag;
@ -225,7 +234,6 @@ set_fsize(partinfo *p, int fsize)
p->pi_fsize = fsize;
p->pi_frag = frags;
return 0;
}
static int
@ -266,14 +274,6 @@ edit_fs_mountpt(menudesc *m, void *arg)
partinfo *p = arg;
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,
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},
#define PTN_MENU_END 3
{NULL, OPT_NOMENU, OPT_IGNORE, NULL}, /* displays 'end' */
#define PTN_MENU_BSIZE 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
#define PTN_MENU_NEWFS 4
{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
{NULL, OPT_NOMENU, 0, edit_fs_mount},
#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_fstypes, nelem(all_fstypes),
-1, 15, 10, 0, MC_SCROLL,
30, 6, 10, 0, MC_SCROLL,
get_fstype, NULL, NULL, NULL, MSG_unchanged);
}
@ -398,22 +398,44 @@ set_ptn_header(menudesc *m, void *arg)
{
partinfo *p = arg;
int i;
int t;
msg_clear();
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++) {
/* Default to disabled... */
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;
}
if (p->pi_fstype == FS_SWAP && i > PTN_MENU_END)
continue;
if (p->pi_fstype == FS_UNUSED)
continue;
if (!PI_ISBSDFS(p)
&& i >= PTN_MENU_BSIZE && i <= PTN_MENU_ISIZE)
if (i == PTN_MENU_NEWFS && t != FS_BSDFFS && t != FS_BSDLFS
&& t != FS_APPLEUFS) {
/* Can only newfs UFS and LFS filesystems */
p->pi_flags &= ~PIF_NEWFS;
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;
}
}
@ -431,6 +453,7 @@ static void
set_ptn_label(menudesc *m, int opt, void *arg)
{
partinfo *p = arg;
const char *c;
if (m->opts[opt].opt_flags & OPT_IGNORE
&& (opt != PTN_MENU_END || p->pi_fstype == FS_UNUSED)) {
@ -440,8 +463,14 @@ set_ptn_label(menudesc *m, int opt, void *arg)
switch (opt) {
case PTN_MENU_FSKIND:
wprintw(m->mw, msg_string(MSG_fstype_fmt),
fstypenames[p->pi_fstype]);
if (p->pi_fstype == FS_BSDFFS)
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;
case PTN_MENU_START:
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:
disp_sector_count(m, MSG_end_fmt, p->pi_offset + p->pi_size);
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:
wprintw(m->mw, msg_string(MSG_bsize_fmt),
p->pi_fsize * p->pi_frag);
@ -459,14 +496,6 @@ set_ptn_label(menudesc *m, int opt, void *arg)
case PTN_MENU_FSIZE:
wprintw(m->mw, msg_string(MSG_fsize_fmt), p->pi_fsize);
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:
wprintw(m->mw, msg_string(MSG_mount_fmt),
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 maxpart = getmaxpartitions();
msg_display(MSG_fspart, multname);
msg_table_add(MSG_fspart_header);
msg_display(MSG_fspart);
msg_table_add(MSG_fspart_header, multname, multname, multname);
for (show_unused_ptn = 0, ptn = 0; ptn < maxpart; ptn++) {
m = &menu->opts[ptn];
@ -524,7 +553,7 @@ set_label_texts(menudesc *menu, void *arg)
#ifdef PART_BOOT
|| ptn == PART_BOOT
#endif
|| ptn == C) {
|| ptn == PART_C) {
m->opt_flags = OPT_IGNORE;
} else {
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.
@ -63,27 +63,32 @@ allow dynamic menus;
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 {
switch (((partinfo *)arg)->pi_fstype) {
partinfo *p = arg;
switch (p->pi_fstype) {
case FS_UNUSED: menu->cursel = 0; break;
case FS_BSDFFS: menu->cursel = 1; break;
case FS_SWAP: menu->cursel = 2; break;
case FS_MSDOS: menu->cursel = 3; break;
case FS_BSDLFS: menu->cursel = 4; break;
default : menu->cursel = 5; break;
case FS_BSDFFS:
menu->cursel = p->pi_flags & PIF_FFSv2 ? 2 : 1;
break;
case FS_SWAP: menu->cursel = 3; break;
case FS_MSDOS: menu->cursel = 4; break;
case FS_BSDLFS: menu->cursel = 5; break;
default : menu->cursel = 6; break;
};
};
option "unused", exit, action
{ memset(arg, 0, sizeof (partinfo)); };
option "4.2BSD", exit, action
{ ((partinfo *)arg)->pi_fstype = FS_BSDFFS; set_bsize(arg, 8192); };
option "FFSv1", exit, action
{ set_ptype(arg, FS_BSDFFS, 0, 8192); };
option "FFSv2", exit, action
{ set_ptype(arg, FS_BSDFFS, PIF_FFSv2, 8192); };
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
{ ((partinfo *)arg)->pi_fstype = FS_MSDOS; set_bsize(arg, 0); };
option "4.4LFS", exit, action
{ ((partinfo *)arg)->pi_fstype = FS_BSDLFS; set_bsize(arg, 8192); };
{ set_ptype(arg, FS_MSDOS, 0, 0); };
option "LFS", exit, action
{ set_ptype(arg, FS_BSDLFS, 0, 8192); };
option MSG_other_types, action
{ extern int 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,
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_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_Yes, exit, action {yesno = 1;};
menu ok, title MSG_Hit_enter_to_continue;
option MSG_ok, exit;
menu ok, no shortcut;
display action { menu->title = arg; };
option MSG_Hit_enter_to_continue, exit;
menu layout, y=-1, title MSG_Choose_your_installation;
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.
@ -215,13 +215,13 @@ message askunits
{Change input units (sectors/cylinders/MB)}
message NetBSD_partition_cant_change
{NetBSD partition - can't change}
{NetBSD partition}
message Whole_disk_cant_change
{Whole disk - can't change}
{Whole disk}
message Boot_partition_cant_change
{Boot partition - can't change}
{Boot partition}
message add_another_ptn
{Add a user defined partition}
@ -244,18 +244,18 @@ Type enter to continue
}
message fspart
{We now have your BSD-disklabel partitions as (Start, End and Size in %s).
This is your last chance to change it.
{We now have your BSD-disklabel partitions as:
This is your last chance to change them.
}
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
{%9d %9d %9d %-6s %-5s %-5s %s}
{%9d %9d %9d %-10s %-5s %-5s %s}
message show_all_unused_partitions
{Show all unused partitions}
@ -412,7 +412,7 @@ message nomount
a mount point.}
message mountfail
{mount of device %s on %s failed.
{mount of device /dev/%s%c on %s failed.
}
message extractcomplete
@ -760,12 +760,12 @@ message makedev
}
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.)
}
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
{ 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.
@ -221,13 +221,13 @@ message askunits
{Changer d'unité (secteurs/cylindres/Mo)}
message NetBSD_partition_cant_change
{Partition de NetBSD - pas de changement}
{Partition de NetBSD}
message Whole_disk_cant_change
{Totalité du disque - pas de changement}
{Totalité du disque}
message Boot_partition_cant_change
{Partition de démarrer - pas de changement}
{Partition de démarrer}
message add_another_ptn
{Ajouter une nouvelle partition manuellement}
@ -248,17 +248,17 @@ La taille de la partition a
}
message fspart
{Vos partitions NetBSD sont les suivantes (taille et décalages en %s) :
{Vos partitions NetBSD sont les suivantes:
}
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
{%9d %9d %9d %-6s %-5s %-5s %s}
{%9d %9d %10d %-10s %-5s %-5s %s}
message show_all_unused_partitions /* XXX translate */
{Show all unused partitions}
@ -421,7 +421,7 @@ ni msdos et ne dispose donc d'aucun point de montage.
}
message mountfail
{Le montage de %s sur %s a échoué.
{Le montage de /dev/%s%c sur %s a échoué.
}
message extractcomplete
@ -784,13 +784,13 @@ message makedev
}
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.
La mise à jour a été interrompue avec un code erreur %d.
}
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
}

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: */
/* 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)}
message NetBSD_partition_cant_change
{partycja NetBSD - nie mozna zmienic}
{partycja NetBSD}
message Whole_disk_cant_change
{Caly dysk - nie mozna zmienic}
{Caly dysk}
message Boot_partition_cant_change
{partycja uruchomic - nie mozna zmienic}
{partycja uruchomic}
message add_another_ptn /* XXX translate */
{Add a user defined partition}
@ -239,18 +239,17 @@ twojej partycji zostal zmniejszony do %d %s.
}
message fspart
{Mamy teraz twoje partycje BSD-disklabel jako (Rozmiar i Przesuniecie w %s):
{Mamy teraz twoje partycje BSD-disklabel jako:
}
message fspart_header
{ Rozmiar Przesun. Koniec Typ SP Ochrona Mount Mountpoint
--------- --------- --------- ------ ------- ----- ----------
message fspart_header /* XXX abbreviations (or change fspart_row below) */
{ Rozm %3s Prze %3s Koniec %3s Typ SP Ochrona Mount Mountpoint
--------- --------- ---------- ---------- ------- ----- ----------
}
message fspart_row
{%9d %9d %9d %-6s %-7s %-5s %s}
{%9d %9d %10d %-10s %-7s %-5s %s}
message show_all_unused_partitions /* XXX translate */
{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.}
message mountfail
{zamountowanie urzadzenia %s na %s nie powiodlo sie.
{zamountowanie urzadzenia /dev/%s%c na %s nie powiodlo sie.
}
message extractcomplete
@ -751,12 +750,12 @@ message makedev
}
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.)
}
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
{ 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.
@ -664,7 +664,7 @@ again:
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.
@ -683,27 +683,26 @@ again:
}
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);
#ifdef INET6
if (v6config) {
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);
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);
}
#endif
if (net_ip[0] != '\0') {
if (net_mask[0] != '\0') {
run_prog(0, NULL,
"/sbin/ifconfig %s inet %s netmask %s",
run_program(0, "/sbin/ifconfig %s inet %s netmask %s",
net_dev, net_ip, net_mask);
} else {
run_prog(0, NULL,
"/sbin/ifconfig %s inet %s", net_dev, net_ip);
run_program(0, "/sbin/ifconfig %s inet %s",
net_dev, net_ip);
}
}
@ -713,9 +712,8 @@ again:
/* Set a default route if one was given */
if (net_defroute[0] != '\0') {
run_prog(0, NULL, "/sbin/route -n flush -inet");
run_prog(0, NULL,
"/sbin/route -n add default %s", net_defroute);
run_program(0, "/sbin/route -n flush -inet");
run_program(0, "/sbin/route -n add default %s", net_defroute);
}
/*
@ -731,21 +729,21 @@ again:
#ifdef INET6
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);
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);
}
#endif
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);
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);
fflush(NULL);
@ -799,7 +797,7 @@ get_via_ftp(void)
* unsafe by a strict reading of RFC 1738).
*/
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",
ftp_host,
url_encode(ftp_dir_encoded, ftp_dir,
@ -807,7 +805,7 @@ get_via_ftp(void)
RFC1738_SAFE_LESS_SHELL_PLUS_SLASH, 1),
filename);
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",
url_encode(ftp_user_encoded, ftp_user,
sizeof ftp_user_encoded,
@ -877,8 +875,7 @@ again:
umount_mnt2();
/* Mount it */
if (run_prog(0, NULL,
"/sbin/mount -r -o -2,-i,-r=1024 -t nfs %s:%s /mnt2",
if (run_program(0, "/sbin/mount -r -o -2,-i,-r=1024 -t nfs %s:%s /mnt2",
nfs_host, nfs_dir)) {
msg_display(MSG_nfsbadmount, nfs_host, nfs_dir);
process_menu(MENU_nfsbadmount, NULL);
@ -1058,7 +1055,7 @@ config_dhcp(char *inter)
process_menu(MENU_dhcpautoconf, NULL);
if (yesno) {
/* 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",
DHCLIENT_EX, inter);
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.
@ -562,7 +562,7 @@ loop:
*/
int
run_prog(int flags, msg errmsg, const char *cmd, ...)
run_program(int flags, const char *cmd, ...)
{
va_list ap;
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);
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);
if (actionwin != NULL) {
@ -622,7 +623,8 @@ run_prog(int flags, msg errmsg, const char *cmd, ...)
mvaddstr(0, 13, msg_string(MSG_Finished));
standend();
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)
move(2, 5);
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 */
if (actionwin != NULL) {
if (actionwin != stdscr)
delwin(actionwin);
wclear(stdscr);
touchwin(stdscr);
clearok(stdscr, 1);
refresh();
if (err == 0 || !(flags & RUN_NO_CLEAR)) {
wclear(stdscr);
touchwin(stdscr);
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_argv(args);
if (ret != 0 && flags & RUN_FATAL)
exit(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
@ -71,7 +71,7 @@
#include <sys/cdefs.h>
#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
/*
@ -113,13 +113,12 @@ int target_test_symlink (const char *path); /* deprecated */
void backtowin(void);
void unwind_mounts (void);
int mount_with_unwind (const char *fstype, const char *from, const char *on);
void unwind_mounts(void);
/* Record a mount for later unwinding of target mounts. */
struct unwind_mount {
struct unwind_mount *um_prev;
char um_mountpoint[STRSIZE];
char um_mountpoint[4]; /* Allocated longer... */
};
/* Unwind-mount stack */
@ -262,7 +261,7 @@ static void
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. */
@ -273,64 +272,6 @@ make_target_dir(const char *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
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);
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
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(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
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(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. */
@ -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
* unwind after completing or aborting a mount.
* Do a mount onto a mountpoint in the install target.
* Record mountpoint so we can unmount when finished.
* NB: does not prefix mount-from, which probably breaks nullfs mounts.
*/
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;
struct unwind_mount * m;
int len;
m = malloc(sizeof(*m));
len = strlen(on);
m = malloc(sizeof *m + len);
if (m == 0)
return (ENOMEM); /* XXX */
strncpy(m->um_mountpoint, on, STRSIZE);
m->um_prev = unwind_mountlist;
unwind_mountlist = m;
memcpy(m->um_mountpoint, on, len + 1);
#ifdef DEBUG_UNWIND
endwin();
@ -472,9 +414,15 @@ mount_with_unwind(const char *opts, const char *from, const char *on)
backtowin();
#endif
error = run_prog(RUN_PROGRESS, NULL,
"/sbin/mount %s %s %s", opts, from, on);
return (error);
error = run_program(0, "/sbin/mount %s /dev/%s%c %s%s",
opts, from, 'a' + ptn, target_prefix(), on);
if (error) {
free(m);
return error;
}
m->um_prev = unwind_mountlist;
unwind_mountlist = m;
return 0;
}
/*
@ -494,38 +442,20 @@ unwind_mounts(void)
return;
unwind_in_progress = 1;
for (m = unwind_mountlist; m; ) {
struct unwind_mount *prev;
while ((m = unwind_mountlist) != NULL) {
unwind_mountlist = m->um_prev;
#ifdef DEBUG_UNWIND
endwin();
fprintf(stderr, "unmounting %s\n", m->um_mountpoint);
backtowin();
#endif
run_prog(0, NULL, "/sbin/umount %s", m->um_mountpoint);
prev = m->um_prev;
run_program(0, "/sbin/umount %s%s",
target_prefix(), m->um_mountpoint);
free(m);
m = prev;
}
unwind_mountlist = NULL;
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
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.
@ -56,20 +56,20 @@
/* prototypes */
static void process(struct lookfor *, char *);
static void match(char *, struct lookfor *, size_t);
static int process(struct lookfor *, char *);
static int match(char *, struct lookfor *, 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.
*/
void
int
walk(char *buffer, size_t size, struct lookfor *these, size_t numthese)
{
size_t i = 0;
size_t len;
int line = 1;
int error;
while (i < size) {
/* Ignore zero characters. */
@ -85,24 +85,28 @@ walk(char *buffer, size_t size, struct lookfor *these, size_t numthese)
#ifdef DEBUG
printf ("%5d: %s\n", line, buffer);
#endif
match(buffer, these, numthese);
error = match(buffer, these, numthese);
if (error != 0)
return error;
buffer += len+1;
i += len+1;
line++;
}
}
return 0;
}
/*
* Match the current line with a string of interest.
* For each match in these, process the match.
*/
static void
static int
match(char *line, struct lookfor *these, size_t numthese)
{
size_t linelen; /* Line length */
size_t patlen; /* Pattern length */
size_t which; /* Which pattern we are using */
int error;
linelen = strlen(line);
@ -110,20 +114,25 @@ match(char *line, struct lookfor *these, size_t numthese)
patlen = strlen(these[which].head);
if (linelen < patlen)
continue;
if (strncmp(these[which].head, line, patlen) == 0)
process(&these[which], line);
if (strncmp(these[which].head, line, patlen) == 0) {
error = process(&these[which], line);
if (error != 0)
return error;
}
}
return 0;
}
/* process the matched line. */
static void
static int
process(struct lookfor *item, char *line)
{
struct data found[MAXDATA];
size_t numfound = 0;
const char *p;
size_t i, j;
int error;
if (finddata(item, line, found, &numfound)) {
#ifdef DEBUG
@ -157,10 +166,9 @@ process(struct lookfor *item, char *line)
= found[i].u.i_val;
break;
case STR:
strncpy(*((char **)item->var+j),
strlcpy(*((char **)item->var+j),
found[i].u.s_val,
item->size-1);
found[i].u.s_val[item->size-1] = 0;
item->size);
break;
}
while (isdigit(*p))
@ -175,10 +183,13 @@ process(struct lookfor *item, char *line)
}
break;
case 'c': /* Call a function with data. */
(*item->func)(found, numfound);
error = (*item->func)(found, numfound);
if (error != 0)
return error;
break;
}
}
return 0;
}
/*
@ -191,11 +202,11 @@ process(struct lookfor *item, char *line)
static int
finddata(struct lookfor *item, char *line, struct data *found, size_t *numfound)
{
const char *fmt = item->fmt;
const char *fmt;
size_t len;
*numfound = 0;
while (*fmt) {
for (fmt = item->fmt; *fmt; fmt++) {
if (!*line && *fmt)
return 0;
if (*fmt == '%') {
@ -232,49 +243,29 @@ finddata(struct lookfor *item, char *line, struct data *found, size_t *numfound)
&& line[len] != fmt[1])
len++;
found[*numfound].what = STR;
found[*numfound].u.s_val = strndup(line, len);
if (found[(*numfound)++].u.s_val == NULL) {
(void)fprintf(stderr,
"msgwalk: strndup: out of vm.\n");
exit(1);
}
line += len;
found[(*numfound)++].u.s_val = line;
line[len] = 0;
line += len + 1;
break;
default:
return 0;
}
} else if (*fmt == ' ') {
continue;
}
if (*fmt == ' ') {
while (*line && isspace(*line))
line++;
} else if (*line == *fmt) {
line++;
} else {
/* Mis match! */
return 0;
continue;
}
fmt++;
if (*line == *fmt) {
line++;
continue;
}
/* Mis match! */
return 0;
}
/* Ran out of fmt. */
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.
@ -57,7 +57,7 @@ struct lookfor {
void *var; /* Possible var */
size_t nument; /* Number of entries in the "array" */
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:
@ -79,7 +79,7 @@ struct lookfor {
/* 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! */

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.
@ -77,7 +77,7 @@ do_upgrade(void)
process_menu(MENU_distset, NULL);
if (!fsck_disks())
if (mount_disks() != 0)
return;
@ -196,8 +196,8 @@ restore_etc(void)
return;
tp = target_prefix();
run_prog(0, NULL, "mv -f %s/etc.old/* %s/etc", tp, tp);
run_prog(0, NULL, "rmdir %s/etc.old", tp);
run_program(0, "mv -f %s/etc.old/* %s/etc", tp, tp);
run_program(0, "rmdir %s/etc.old", tp);
etc_saved = 0;
}
@ -281,16 +281,9 @@ do_reinstall_sets(void)
process_menu(MENU_distset, NULL);
if (!fsck_disks())
if (mount_disks() != 0)
return;
fflush(stdout);
wrefresh(curscr);
wmove(stdscr, 0, 0);
touchwin(stdscr);
wclear(stdscr);
wrefresh(stdscr);
/* Unpack the distribution. */
if (get_and_unpack_sets(MSG_unpackcomplete, MSG_abortunpack) != 0)
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.
@ -226,7 +226,7 @@ run_makedev(void)
/* make /dev, in case the user didn't extract it. */
make_target_dir("/dev");
target_chdir_or_die("/dev");
run_prog(0, NULL, "/bin/sh MAKEDEV all");
run_program(0, "/bin/sh MAKEDEV all");
chdir(owd);
free(owd);
@ -275,7 +275,7 @@ get_via_floppy(void)
return 0;
else if (yesno == 2)
return 1;
while (run_prog(0, NULL,
while (run_program(0,
"/sbin/mount -r -t %s %s /mnt2",
fdtype, fddev)) {
msg_display(MSG_fdremount, fname);
@ -326,7 +326,7 @@ again:
/* Mount it */
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)
break;
if (retries > 0) {
@ -377,7 +377,7 @@ again:
umount_mnt2();
/* 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)) {
msg_display(MSG_localfsbadmount, localfs_dir, localfs_dev);
@ -707,13 +707,13 @@ extract_file(char *path)
/* now extract set files files into "./". */
if (verbose == 1)
tarexit = run_prog(RUN_DISPLAY | RUN_PROGRESS, NULL,
tarexit = run_program(RUN_DISPLAY | RUN_PROGRESS,
"progress -zf %s tar -xepf -", path);
else if (verbose == 2)
tarexit = run_prog(RUN_DISPLAY | RUN_PROGRESS, NULL,
tarexit = run_program(RUN_DISPLAY | RUN_PROGRESS,
"tar -zxvepf %s", path);
else
tarexit = run_prog(RUN_DISPLAY, NULL,
tarexit = run_program(RUN_DISPLAY,
"tar -zxepf %s", path);
chdir(owd);
@ -1028,7 +1028,7 @@ get_and_unpack_sets(msg success_msg, msg failure_msg)
ext_dir + strlen(target_prefix()));
process_menu(MENU_yesno, NULL);
if (yesno)
run_prog(0, NULL, "/bin/rm -rf %s", ext_dir);
run_program(0, "/bin/rm -rf %s", ext_dir);
}
/* Mounted dist dir? */
@ -1045,7 +1045,7 @@ umount_mnt2(void)
{
if (!mnt2_mounted)
return;
run_prog(RUN_SILENT, NULL, "/sbin/umount /mnt2");
run_program(RUN_SILENT, "/sbin/umount /mnt2");
mnt2_mounted = 0;
}
@ -1118,51 +1118,6 @@ sanity_check(void)
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
*/
@ -1433,7 +1388,7 @@ set_root_password(void)
msg_display(MSG_rootpw);
process_menu(MENU_yesno, NULL);
if (yesno)
run_prog(RUN_DISPLAY|RUN_CHROOT, NULL, "passwd -l root");
run_program(RUN_DISPLAY|RUN_CHROOT, "passwd -l root");
return 0;
}
@ -1443,7 +1398,7 @@ set_root_shell(void)
msg_display(MSG_rootsh);
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;
}
@ -1490,7 +1445,7 @@ enable_rc_conf(void)
{
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",
tp, tp);
}