(Finally) merge a slightly modified version of the 2012 GSoC results

from Eugene Lozovoy: add extended partitioning options to sysinst.
Still needs some testing and polishing, but it now is possible to use GPT
or to create a RAID set from scratch and install onto it.
This commit is contained in:
martin 2014-08-03 16:09:38 +00:00
parent 5d43dac3af
commit 4b2364d962
77 changed files with 5825 additions and 1555 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.2 2014/07/26 19:32:22 dholland Exp $ # $NetBSD: Makefile.inc,v 1.3 2014/08/03 16:09:38 martin Exp $
# #
# Makefile for sysinst # Makefile for sysinst
@ -17,7 +17,7 @@ WARNS= 4
SRCS+= menu_defs.c msg_defs.c main.c install.c upgrade.c \ SRCS+= menu_defs.c msg_defs.c main.c install.c upgrade.c \
txtwalk.c run.c factor.c net.c disks.c disks_lfs.c util.c geom.c \ txtwalk.c run.c factor.c net.c disks.c disks_lfs.c util.c geom.c \
label.c target.c md.c sizemultname.c configmenu.c checkrc.c label.c target.c md.c sizemultname.c configmenu.c checkrc.c partman.c
SRCS+= ${MD_OPTIONS:MAOUT2ELF:S/AOUT2ELF/aout2elf.c/} SRCS+= ${MD_OPTIONS:MAOUT2ELF:S/AOUT2ELF/aout2elf.c/}
SRCS+= ${MENUS_MD:Mmenus.mbr:S/menus.mbr/mbr.c/} SRCS+= ${MENUS_MD:Mmenus.mbr:S/menus.mbr/mbr.c/}
@ -49,7 +49,12 @@ MSG_XLAT_SH= ${.CURDIR}/../../msg_xlat.sh
CPPFLAGS+= -I. -I${.CURDIR}/../.. -I${.CURDIR} \ CPPFLAGS+= -I. -I${.CURDIR}/../.. -I${.CURDIR} \
-DREL=\"${DISTRIBVER}\" -DMACH=\"${MACHINE}\" \ -DREL=\"${DISTRIBVER}\" -DMACH=\"${MACHINE}\" \
-DMACH_${MACHINE} -DARCH_${MACHINE_ARCH} -DMACH_${MACHINE} -DARCH_${MACHINE_ARCH} \
${NODISKLABEL:D-DNO_DISKLABEL}
.if (defined(DEBUG))
CPPFLAGS+=-DDEBUG -g -O0
.endif
.if (!defined(SMALLPROG) || defined(SMALLPROG_INET6)) && (${USE_INET6} != "no") .if (!defined(SMALLPROG) || defined(SMALLPROG_INET6)) && (${USE_INET6} != "no")
CPPFLAGS+=-DINET6 CPPFLAGS+=-DINET6
@ -67,6 +72,7 @@ COPTS.mbr.c += -Wno-format-nonliteral
COPTS.msg_defs.c += -Wno-format-nonliteral COPTS.msg_defs.c += -Wno-format-nonliteral
COPTS.bsddisklabel.c += -Wno-format-nonliteral COPTS.bsddisklabel.c += -Wno-format-nonliteral
COPTS.md.c += -Wno-format-nonliteral COPTS.md.c += -Wno-format-nonliteral
COPTS.partman.c += -Wno-format-nonliteral
# Host to ftp from. Default: # Host to ftp from. Default:
# "ftp.NetBSD.org" # "ftp.NetBSD.org"

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -73,12 +73,12 @@ md_get_info(void)
struct filecore_bootblock *fcbb = (struct filecore_bootblock *)bb; struct filecore_bootblock *fcbb = (struct filecore_bootblock *)bb;
int offset = 0; int offset = 0;
if (strncmp(diskdev, "wd", 2) == 0) if (strncmp(pm->diskdev, "wd", 2) == 0)
disktype = "ST506"; pm->disktype = "ST506";
else else
disktype = "SCSI"; pm->disktype = "SCSI";
snprintf(dev_name, 100, "/dev/r%s%c", diskdev, 'a' + getrawpartition()); snprintf(dev_name, 100, "/dev/r%s%c", pm->diskdev, 'a' + getrawpartition());
fd = open(dev_name, O_RDONLY, 0); fd = open(dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -173,31 +173,31 @@ md_get_info(void)
} }
close(fd); close(fd);
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlcylsize = disklabel.d_secpercyl; pm->dlcylsize = disklabel.d_secpercyl;
/* /*
* Compute whole disk size. Take max of (dlcyl*dlhead*dlsec) * Compute whole disk size. Take max of (pm->dlcyl*pm->dlhead*pm->dlsec)
* and secperunit, just in case the disk is already labelled. * and secperunit, just in case the disk is already labelled.
* (If our new label's RAW_PART size ends up smaller than the * (If our new label's RAW_PART size ends up smaller than the
* in-core RAW_PART size value, updating the label will fail.) * in-core RAW_PART size value, updating the label will fail.)
*/ */
dlsize = dlcyl*dlhead*dlsec; pm->dlsize = pm->dlcyl*pm->dlhead*pm->dlsec;
if (disklabel.d_secperunit > dlsize) if (disklabel.d_secperunit > pm->dlsize)
dlsize = disklabel.d_secperunit; pm->dlsize = disklabel.d_secperunit;
ptstart = offset; pm->ptstart = offset;
/* endwin(); /* endwin();
printf("dlcyl=%d\n", dlcyl); printf("pm->dlcyl=%d\n", pm->dlcyl);
printf("dlhead=%d\n", dlhead); printf("pm->dlhead=%d\n", pm->dlhead);
printf("dlsec=%d\n", dlsec); printf("pm->dlsec=%d\n", pm->dlsec);
printf("secsz=%d\n", sectorsize); printf("secsz=%d\n", pm->sectorsize);
printf("cylsz=%d\n", dlcylsize); printf("cylsz=%d\n", pm->dlcylsize);
printf("dlsz=%d\n", dlsize); printf("dlsz=%d\n", pm->dlsize);
printf("pstart=%d\n", ptstart); printf("pstart=%d\n", pm->ptstart);
printf("pstart=%d\n", partsize); printf("pstart=%d\n", partsize);
printf("secpun=%d\n", disklabel.d_secperunit); printf("secpun=%d\n", disklabel.d_secperunit);
backtowin();*/ backtowin();*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -67,7 +67,7 @@ md_get_info(void)
int fd; int fd;
char dev_name[100]; char dev_name[100];
snprintf (dev_name, 100, "/dev/r%s%c", diskdev, 'a' + getrawpartition()); snprintf (dev_name, 100, "/dev/r%s%c", pm->diskdev, 'a' + getrawpartition());
fd = open (dev_name, O_RDONLY, 0); fd = open (dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -83,10 +83,10 @@ md_get_info(void)
} }
close(fd); close(fd);
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlsize = disklabel.d_secperunit; pm->dlsize = disklabel.d_secperunit;
/* /*
* Tru64 UNIX's disklabel is the same format as BSD disklabel, * Tru64 UNIX's disklabel is the same format as BSD disklabel,
@ -96,8 +96,8 @@ md_get_info(void)
* dlsec (sectors/track) and dlcylsize (sectors/cylinder) values. * dlsec (sectors/track) and dlcylsize (sectors/cylinder) values.
* See PR/48697 for details. * See PR/48697 for details.
*/ */
dlsec = dlsize / (dlhead * dlcyl); pm->dlsec = pm->dlsize / (pm->dlhead * pm->dlcyl);
dlcylsize = dlsec * dlhead; pm->dlcylsize = pm->dlsec * pm->dlhead;
return 1; return 1;
} }
@ -151,12 +151,12 @@ md_post_newfs(void)
char *bootxx; char *bootxx;
int error; int error;
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, pm->diskdev);
cp_to_target("/usr/mdec/boot", "/boot"); cp_to_target("/usr/mdec/boot", "/boot");
bootxx = bootxx_name(); bootxx = bootxx_name();
if (bootxx != NULL) { if (bootxx != NULL) {
error = run_program(RUN_DISPLAY | RUN_NO_CLEAR, error = run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/sbin/installboot /dev/r%sc %s", diskdev, bootxx); "/usr/sbin/installboot /dev/r%sc %s", pm->diskdev, bootxx);
free(bootxx); free(bootxx);
} else } else
error = -1; error = -1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -107,9 +107,9 @@ int
md_post_newfs(void) md_post_newfs(void)
{ {
/* boot blocks ... */ /* boot blocks ... */
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, pm->diskdev);
return run_program(RUN_DISPLAY, return run_program(RUN_DISPLAY,
"/usr/mdec/installboot -v /usr/mdec/xxboot /dev/r%sa", diskdev); "/usr/mdec/installboot -v /usr/mdec/xxboot /dev/r%sa", pm->diskdev);
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -88,62 +88,62 @@ md_make_bsd_partitions(void)
* Initialize global variables that track space used on this disk. * Initialize global variables that track space used on this disk.
* Standard 4.4BSD 8-partition labels always cover whole disk. * Standard 4.4BSD 8-partition labels always cover whole disk.
*/ */
if (ptsize == 0) if (pm->ptsize == 0)
ptsize = dlsize - ptstart; pm->ptsize = pm->dlsize - pm->ptstart;
if (dlsize == 0) if (pm->dlsize == 0)
dlsize = ptstart + ptsize; pm->dlsize = pm->ptstart + pm->ptsize;
partstart = ptstart; partstart = pm->ptstart;
ptend = ptstart + ptsize; ptend = pm->ptstart + pm->ptsize;
/* Ask for layout type -- standard or special */ /* Ask for layout type -- standard or special */
msg_display(MSG_layout, msg_display(MSG_layout,
ptsize / (MEG / sectorsize), pm->ptsize / (MEG / pm->sectorsize),
DEFROOTSIZE + DEFSWAPSIZE + DEFUSRSIZE, DEFROOTSIZE + DEFSWAPSIZE + DEFUSRSIZE,
DEFROOTSIZE + DEFSWAPSIZE + DEFUSRSIZE + XNEEDMB); DEFROOTSIZE + DEFSWAPSIZE + DEFUSRSIZE + XNEEDMB);
process_menu(MENU_layout, NULL); process_menu(MENU_layout, NULL);
/* Set so we use the 'real' geometry for rounding, input in MB */ /* Set so we use the 'real' geometry for rounding, input in MB */
current_cylsize = dlcylsize; pm->current_cylsize = pm->dlcylsize;
set_sizemultname_meg(); set_sizemultname_meg();
/* Build standard partitions */ /* Build standard partitions */
memset(&bsdlabel, 0, sizeof bsdlabel); memset(&pm->bsdlabel, 0, sizeof pm->bsdlabel);
/* Set initial partition types to unused */ /* Set initial partition types to unused */
for (part = 0 ; part < maxpart ; ++part) for (part = 0 ; part < maxpart ; ++part)
bsdlabel[part].pi_fstype = FS_UNUSED; pm->bsdlabel[part].pi_fstype = FS_UNUSED;
/* Whole disk partition */ /* Whole disk partition */
part_raw = getrawpartition(); part_raw = getrawpartition();
if (part_raw == -1) if (part_raw == -1)
part_raw = PART_C; /* for sanity... */ part_raw = PART_C; /* for sanity... */
bsdlabel[part_raw].pi_offset = 0; pm->bsdlabel[part_raw].pi_offset = 0;
bsdlabel[part_raw].pi_size = dlsize; pm->bsdlabel[part_raw].pi_size = pm->dlsize;
if (part_raw == PART_D) { if (part_raw == PART_D) {
/* Probably a system that expects an i386 style mbr */ /* Probably a system that expects an i386 style mbr */
part_bsd = PART_C; part_bsd = PART_C;
bsdlabel[PART_C].pi_offset = ptstart; pm->bsdlabel[PART_C].pi_offset = pm->ptstart;
bsdlabel[PART_C].pi_size = ptsize; pm->bsdlabel[PART_C].pi_size = pm->ptsize;
} else { } else {
part_bsd = part_raw; part_bsd = part_raw;
} }
if (bootsize != 0) { if (pm->bootsize != 0) {
bsdlabel[PART_BOOT_FAT12].pi_fstype = FS_MSDOS; pm->bsdlabel[PART_BOOT_FAT12].pi_fstype = FS_MSDOS;
bsdlabel[PART_BOOT_FAT12].pi_size = bootsize; pm->bsdlabel[PART_BOOT_FAT12].pi_size = pm->bootsize;
bsdlabel[PART_BOOT_FAT12].pi_offset = bootstart; pm->bsdlabel[PART_BOOT_FAT12].pi_offset = pm->bootstart;
bsdlabel[PART_BOOT_FAT12].pi_flags |= PART_BOOT_FAT12_PI_FLAGS; pm->bsdlabel[PART_BOOT_FAT12].pi_flags |= PART_BOOT_FAT12_PI_FLAGS;
strlcpy(bsdlabel[PART_BOOT_FAT12].pi_mount, strlcpy(pm->bsdlabel[PART_BOOT_FAT12].pi_mount,
PART_BOOT_FAT12_PI_MOUNT, PART_BOOT_FAT12_PI_MOUNT,
sizeof bsdlabel[PART_BOOT_FAT12].pi_mount); sizeof pm->bsdlabel[PART_BOOT_FAT12].pi_mount);
} }
#ifdef PART_REST #ifdef PART_REST
bsdlabel[PART_REST].pi_offset = 0; pm->bsdlabel[PART_REST].pi_offset = 0;
bsdlabel[PART_REST].pi_size = ptstart; pm->bsdlabel[PART_REST].pi_size = pm->ptstart;
#endif #endif
/* /*
@ -153,27 +153,27 @@ md_make_bsd_partitions(void)
* partitions on a multiboot i386 system. * partitions on a multiboot i386 system.
*/ */
for (i = maxpart; i--;) { for (i = maxpart; i--;) {
if (bsdlabel[i].pi_size != 0) if (pm->bsdlabel[i].pi_size != 0)
/* Don't overwrite special partitions */ /* Don't overwrite special partitions */
continue; continue;
p = &oldlabel[i]; p = &pm->oldlabel[i];
if (p->pi_fstype == FS_UNUSED || p->pi_size == 0) if (p->pi_fstype == FS_UNUSED || p->pi_size == 0)
continue; continue;
if (layoutkind == 4) { if (layoutkind == LY_USEEXIST) {
if (PI_ISBSDFS(p)) if (PI_ISBSDFS(p))
p->pi_flags |= PIF_MOUNT; p->pi_flags |= PIF_MOUNT;
} else { } else {
if (p->pi_offset < ptstart + ptsize && if (p->pi_offset < pm->ptstart + pm->ptsize &&
p->pi_offset + p->pi_size > ptstart) p->pi_offset + p->pi_size > pm->ptstart)
/* Not outside area we are allocating */ /* Not outside area we are allocating */
continue; continue;
if (p->pi_fstype == FS_SWAP) if (p->pi_fstype == FS_SWAP)
no_swap = 1; no_swap = 1;
} }
bsdlabel[i] = oldlabel[i]; pm->bsdlabel[i] = pm->oldlabel[i];
} }
if (layoutkind == 4) { if (layoutkind == LY_USEEXIST) {
/* XXX Check we have a sensible layout */ /* XXX Check we have a sensible layout */
; ;
} else } else
@ -184,7 +184,7 @@ md_make_bsd_partitions(void)
* edit it and verify it's OK, or abort altogether. * edit it and verify it's OK, or abort altogether.
*/ */
edit_check: edit_check:
if (edit_and_check_label(bsdlabel, maxpart, part_raw, part_bsd) == 0) { if (edit_and_check_label(pm->bsdlabel, maxpart, part_raw, part_bsd) == 0) {
msg_display(MSG_abort); msg_display(MSG_abort);
return 0; return 0;
} }
@ -192,10 +192,10 @@ md_make_bsd_partitions(void)
goto edit_check; goto edit_check;
/* Disk name */ /* Disk name */
msg_prompt(MSG_packname, bsddiskname, bsddiskname, sizeof bsddiskname); msg_prompt(MSG_packname, pm->bsddiskname, pm->bsddiskname, sizeof pm->bsddiskname);
/* save label to disk for MI code to update. */ /* save label to disk for MI code to update. */
(void)savenewlabel(bsdlabel, maxpart); (void)savenewlabel(pm->bsdlabel, maxpart);
/* Everything looks OK. */ /* Everything looks OK. */
return 1; return 1;
@ -214,7 +214,7 @@ md_check_partitions(void)
* something stupid, like move it away from the MBR partition. * something stupid, like move it away from the MBR partition.
*/ */
for (part = PART_A; part < MAXPARTITIONS; part++) for (part = PART_A; part < MAXPARTITIONS; part++)
if (bsdlabel[part].pi_fstype == FS_MSDOS) { if (pm->bsdlabel[part].pi_fstype == FS_MSDOS) {
bootpart_fat12 = part; bootpart_fat12 = part;
return 1; return 1;
} }
@ -233,7 +233,7 @@ md_pre_disklabel(void)
msg_display(MSG_dofdisk); msg_display(MSG_dofdisk);
/* write edited MBR onto disk. */ /* write edited MBR onto disk. */
if (write_mbr(diskdev, &mbr, 1) != 0) { if (write_mbr(pm->diskdev, &mbr, 1) != 0) {
msg_display(MSG_wmbrfail); msg_display(MSG_wmbrfail);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return 1; return 1;
@ -248,7 +248,7 @@ int
md_post_disklabel(void) md_post_disklabel(void)
{ {
if (get_ramsize() <= 32) if (get_ramsize() <= 32)
set_swap(diskdev, bsdlabel); set_swap(pm->diskdev, pm->bsdlabel);
return 0; return 0;
} }
@ -261,7 +261,7 @@ int
md_post_newfs(void) md_post_newfs(void)
{ {
if (!nobootfs) { if (!nobootfs) {
msg_display(msg_string(MSG_copybootloader), diskdev); msg_display(msg_string(MSG_copybootloader), pm->diskdev);
cp_to_target("/usr/mdec/boot", PART_BOOT_FAT12_PI_MOUNT); cp_to_target("/usr/mdec/boot", PART_BOOT_FAT12_PI_MOUNT);
} }
@ -292,9 +292,9 @@ md_pre_update(void)
int i; int i;
if (get_ramsize() <= 32) if (get_ramsize() <= 32)
set_swap(diskdev, NULL); set_swap(pm->diskdev, NULL);
read_mbr(diskdev, &mbr); read_mbr(pm->diskdev, &mbr);
/* do a sanity check of the partition table */ /* do a sanity check of the partition table */
for (ext = &mbr; ext; ext = ext->extended) { for (ext = &mbr; ext; ext = ext->extended) {
part = ext->mbr.mbr_parts; part = ext->mbr.mbr_parts;
@ -335,13 +335,13 @@ md_check_mbr(mbr_info_t *mbri)
part = ext->mbr.mbr_parts; part = ext->mbr.mbr_parts;
for (i = 0; i < MBR_PART_COUNT; part++, i++) { for (i = 0; i < MBR_PART_COUNT; part++, i++) {
if (part->mbrp_type == MBR_PTYPE_FAT12) { if (part->mbrp_type == MBR_PTYPE_FAT12) {
bootstart = part->mbrp_start; pm->bootstart = part->mbrp_start;
bootsize = part->mbrp_size; pm->bootsize = part->mbrp_size;
break; break;
} }
} }
} }
if (bootsize < (MIN_FAT12_BOOT / 512)) { if (pm->bootsize < (MIN_FAT12_BOOT / 512)) {
msg_display(MSG_boottoosmall); msg_display(MSG_boottoosmall);
msg_display_add(MSG_reeditpart, 0); msg_display_add(MSG_reeditpart, 0);
process_menu(MENU_yesno, NULL); process_menu(MENU_yesno, NULL);
@ -349,7 +349,7 @@ md_check_mbr(mbr_info_t *mbri)
return 0; return 0;
return 1; return 1;
} }
if (bootstart == 0 || bootsize == 0) { if (pm->bootstart == 0 || pm->bootsize == 0) {
msg_display(MSG_nobootpart); msg_display(MSG_nobootpart);
msg_display_add(MSG_reeditpart, 0); msg_display_add(MSG_reeditpart, 0);
process_menu(MENU_yesno, NULL); process_menu(MENU_yesno, NULL);
@ -383,14 +383,14 @@ md_mbr_use_wholedisk(mbr_info_t *mbri)
part[0].mbrp_flag = MBR_PFLAG_ACTIVE; part[0].mbrp_flag = MBR_PFLAG_ACTIVE;
part[1].mbrp_type = MBR_PTYPE_NETBSD; part[1].mbrp_type = MBR_PTYPE_NETBSD;
part[1].mbrp_size = dlsize - (bsec + FAT12_BOOT_SIZE / 512); part[1].mbrp_size = pm->dlsize - (bsec + FAT12_BOOT_SIZE / 512);
part[1].mbrp_start = bsec + FAT12_BOOT_SIZE / 512; part[1].mbrp_start = bsec + FAT12_BOOT_SIZE / 512;
part[1].mbrp_flag = 0; part[1].mbrp_flag = 0;
ptstart = part[1].mbrp_start; pm->ptstart = part[1].mbrp_start;
ptsize = part[1].mbrp_size; pm->ptsize = part[1].mbrp_size;
bootstart = part[0].mbrp_start; pm->bootstart = part[0].mbrp_start;
bootsize = part[0].mbrp_size; pm->bootsize = part[0].mbrp_size;
return 1; return 1;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -68,10 +68,10 @@ md_get_info(void)
int int
md_make_bsd_partitions(void) md_make_bsd_partitions(void)
{ {
msg_display(MSG_infoahdilabel, diskdev); msg_display(MSG_infoahdilabel, pm->diskdev);
process_menu(MENU_noyes, NULL); process_menu(MENU_noyes, NULL);
if (yesno) { if (yesno) {
run_program(RUN_DISPLAY, "ahdilabel /dev/r%sc", diskdev); run_program(RUN_DISPLAY, "ahdilabel /dev/r%sc", pm->diskdev);
} }
if (!make_bsd_partitions()) if (!make_bsd_partitions())
return 0; return 0;
@ -79,10 +79,10 @@ md_make_bsd_partitions(void)
/* /*
* Setup the disktype so /etc/disktab gets proper info * Setup the disktype so /etc/disktab gets proper info
*/ */
if (strncmp (diskdev, "sd", 2) == 0) if (strncmp (pm->diskdev, "sd", 2) == 0)
disktype = "SCSI"; pm->disktype = "SCSI";
else else
disktype = "ST506"; pm->disktype = "ST506";
return 1; return 1;
} }
@ -140,7 +140,7 @@ md_post_newfs(void)
free(cpu_model); free(cpu_model);
/* copy tertiary boot and install boot blocks */ /* copy tertiary boot and install boot blocks */
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, pm->diskdev);
snprintf(bootpath, sizeof(bootpath), "/usr/mdec/%s/boot.atari", snprintf(bootpath, sizeof(bootpath), "/usr/mdec/%s/boot.atari",
milan ? "milan" : "std"); milan ? "milan" : "std");
rv = cp_to_target(bootpath, "/"); rv = cp_to_target(bootpath, "/");
@ -148,7 +148,7 @@ md_post_newfs(void)
return rv; return rv;
rv = run_program(RUN_DISPLAY, "/usr/mdec/installboot -v%s /dev/r%sc", rv = run_program(RUN_DISPLAY, "/usr/mdec/installboot -v%s /dev/r%sc",
milan ? "m" : "", diskdev); milan ? "m" : "", pm->diskdev);
return rv; return rv;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -88,7 +88,7 @@ md_pre_disklabel(void)
printf ("%s", msg_string (MSG_dofdisk)); printf ("%s", msg_string (MSG_dofdisk));
/* write edited MBR onto disk. */ /* write edited MBR onto disk. */
if (write_mbr(diskdev, &mbr, 1) != 0) { if (write_mbr(pm->diskdev, &mbr, 1) != 0) {
msg_display(MSG_wmbrfail); msg_display(MSG_wmbrfail);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return 1; return 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -72,12 +72,12 @@ md_get_info(void)
#endif #endif
int offset = 0; int offset = 0;
if (strncmp(diskdev, "wd", 2) == 0) if (strncmp(pm->diskdev, "wd", 2) == 0)
disktype = "ST506"; pm->disktype = "ST506";
else else
disktype = "SCSI"; pm->disktype = "SCSI";
snprintf(dev_name, 100, "/dev/r%sc", diskdev); snprintf(dev_name, 100, "/dev/r%sc", pm->diskdev);
fd = open(dev_name, O_RDONLY, 0); fd = open(dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -94,31 +94,31 @@ md_get_info(void)
close(fd); close(fd);
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlcylsize = disklabel.d_secpercyl; pm->dlcylsize = disklabel.d_secpercyl;
/* /*
* Compute whole disk size. Take max of (dlcyl*dlhead*dlsec) * Compute whole disk size. Take max of (pm->dlcyl*pm->dlhead*pm->dlsec)
* and secperunit, just in case the disk is already labelled. * and secperunit, just in case the disk is already labelled.
* (If our new label's RAW_PART size ends up smaller than the * (If our new label's RAW_PART size ends up smaller than the
* in-core RAW_PART size value, updating the label will fail.) * in-core RAW_PART size value, updating the label will fail.)
*/ */
dlsize = dlcyl*dlhead*dlsec; pm->dlsize = pm->dlcyl*pm->dlhead*pm->dlsec;
if (disklabel.d_secperunit > dlsize) if (disklabel.d_secperunit > pm->dlsize)
dlsize = disklabel.d_secperunit; pm->dlsize = disklabel.d_secperunit;
ptstart = offset; pm->ptstart = offset;
/* endwin(); /* endwin();
printf("dlcyl=%d\n", dlcyl); printf("pm->dlcyl=%d\n", pm->dlcyl);
printf("dlhead=%d\n", dlhead); printf("pm->dlhead=%d\n", pm->dlhead);
printf("dlsec=%d\n", dlsec); printf("pm->dlsec=%d\n", pm->dlsec);
printf("secsz=%d\n", sectorsize); printf("secsz=%d\n", pm->sectorsize);
printf("cylsz=%d\n", dlcylsize); printf("cylsz=%d\n", pm->dlcylsize);
printf("dlsz=%d\n", dlsize); printf("dlsz=%d\n", pm->dlsize);
printf("pstart=%d\n", ptstart); printf("pstart=%d\n", pm->ptstart);
printf("pstart=%d\n", partsize); printf("pstart=%d\n", partsize);
printf("secpun=%d\n", disklabel.d_secperunit); printf("secpun=%d\n", disklabel.d_secperunit);
backtowin();*/ backtowin();*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -88,63 +88,63 @@ md_make_bsd_partitions(void)
* Initialize global variables that track space used on this disk. * Initialize global variables that track space used on this disk.
* Standard 4.4BSD 8-partition labels always cover whole disk. * Standard 4.4BSD 8-partition labels always cover whole disk.
*/ */
if (ptsize == 0) if (pm->ptsize == 0)
ptsize = dlsize - ptstart; pm->ptsize = pm->dlsize - pm->ptstart;
if (dlsize == 0) if (pm->dlsize == 0)
dlsize = ptstart + ptsize; pm->dlsize = pm->ptstart + pm->ptsize;
partstart = ptstart; partstart = pm->ptstart;
ptend = ptstart + ptsize; ptend = pm->ptstart + pm->ptsize;
/* Ask for layout type -- standard or special */ /* Ask for layout type -- standard or special */
msg_display(MSG_layout, msg_display(MSG_layout,
ptsize / (MEG / sectorsize), pm->ptsize / (MEG / pm->sectorsize),
DEFROOTSIZE + DEFSWAPSIZE + DEFUSRSIZE, DEFROOTSIZE + DEFSWAPSIZE + DEFUSRSIZE,
DEFROOTSIZE + DEFSWAPSIZE + DEFUSRSIZE + XNEEDMB); DEFROOTSIZE + DEFSWAPSIZE + DEFUSRSIZE + XNEEDMB);
process_menu(MENU_layout, NULL); process_menu(MENU_layout, NULL);
/* Set so we use the 'real' geometry for rounding, input in MB */ /* Set so we use the 'real' geometry for rounding, input in MB */
current_cylsize = dlcylsize; pm->current_cylsize = pm->dlcylsize;
set_sizemultname_meg(); set_sizemultname_meg();
/* Build standard partitions */ /* Build standard partitions */
memset(&bsdlabel, 0, sizeof bsdlabel); memset(&pm->bsdlabel, 0, sizeof pm->bsdlabel);
/* Set initial partition types to unused */ /* Set initial partition types to unused */
for (part = 0 ; part < maxpart ; ++part) for (part = 0 ; part < maxpart ; ++part)
bsdlabel[part].pi_fstype = FS_UNUSED; pm->bsdlabel[part].pi_fstype = FS_UNUSED;
/* Whole disk partition */ /* Whole disk partition */
part_raw = getrawpartition(); part_raw = getrawpartition();
if (part_raw == -1) if (part_raw == -1)
part_raw = PART_C; /* for sanity... */ part_raw = PART_C; /* for sanity... */
bsdlabel[part_raw].pi_offset = 0; pm->bsdlabel[part_raw].pi_offset = 0;
bsdlabel[part_raw].pi_size = dlsize; pm->bsdlabel[part_raw].pi_size = pm->dlsize;
if (part_raw == PART_D) { if (part_raw == PART_D) {
/* Probably a system that expects an i386 style mbr */ /* Probably a system that expects an i386 style mbr */
part_bsd = PART_C; part_bsd = PART_C;
bsdlabel[PART_C].pi_offset = ptstart; pm->bsdlabel[PART_C].pi_offset = pm->ptstart;
bsdlabel[PART_C].pi_size = ptsize; pm->bsdlabel[PART_C].pi_size = pm->ptsize;
} else { } else {
part_bsd = part_raw; part_bsd = part_raw;
} }
if (bootsize != 0) { if (pm->bootsize != 0) {
bsdlabel[PART_BOOT_EXT2FS].pi_fstype = FS_EX2FS; pm->bsdlabel[PART_BOOT_EXT2FS].pi_fstype = FS_EX2FS;
bsdlabel[PART_BOOT_EXT2FS].pi_size = bootsize; pm->bsdlabel[PART_BOOT_EXT2FS].pi_size = pm->bootsize;
bsdlabel[PART_BOOT_EXT2FS].pi_offset = bootstart; pm->bsdlabel[PART_BOOT_EXT2FS].pi_offset = pm->bootstart;
bsdlabel[PART_BOOT_EXT2FS].pi_flags |= pm->bsdlabel[PART_BOOT_EXT2FS].pi_flags |=
PART_BOOT_EXT2FS_PI_FLAGS; PART_BOOT_EXT2FS_PI_FLAGS;
strlcpy(bsdlabel[PART_BOOT_EXT2FS].pi_mount, strlcpy(pm->bsdlabel[PART_BOOT_EXT2FS].pi_mount,
PART_BOOT_EXT2FS_PI_MOUNT, PART_BOOT_EXT2FS_PI_MOUNT,
sizeof bsdlabel[PART_BOOT_EXT2FS].pi_mount); sizeof pm->bsdlabel[PART_BOOT_EXT2FS].pi_mount);
} }
#ifdef PART_REST #ifdef PART_REST
bsdlabel[PART_REST].pi_offset = 0; pm->bsdlabel[PART_REST].pi_offset = 0;
bsdlabel[PART_REST].pi_size = ptstart; pm->bsdlabel[PART_REST].pi_size = pm->ptstart;
#endif #endif
/* /*
@ -154,27 +154,27 @@ md_make_bsd_partitions(void)
* partitions on a multiboot i386 system. * partitions on a multiboot i386 system.
*/ */
for (i = maxpart; i--;) { for (i = maxpart; i--;) {
if (bsdlabel[i].pi_size != 0) if (pm->bsdlabel[i].pi_size != 0)
/* Don't overwrite special partitions */ /* Don't overwrite special partitions */
continue; continue;
p = &oldlabel[i]; p = &pm->oldlabel[i];
if (p->pi_fstype == FS_UNUSED || p->pi_size == 0) if (p->pi_fstype == FS_UNUSED || p->pi_size == 0)
continue; continue;
if (layoutkind == 4) { if (layoutkind == LY_USEEXIST) {
if (PI_ISBSDFS(p)) if (PI_ISBSDFS(p))
p->pi_flags |= PIF_MOUNT; p->pi_flags |= PIF_MOUNT;
} else { } else {
if (p->pi_offset < ptstart + ptsize && if (p->pi_offset < pm->ptstart + pm->ptsize &&
p->pi_offset + p->pi_size > ptstart) p->pi_offset + p->pi_size > pm->ptstart)
/* Not outside area we are allocating */ /* Not outside area we are allocating */
continue; continue;
if (p->pi_fstype == FS_SWAP) if (p->pi_fstype == FS_SWAP)
no_swap = 1; no_swap = 1;
} }
bsdlabel[i] = oldlabel[i]; pm->bsdlabel[i] = pm->oldlabel[i];
} }
if (layoutkind == 4) { if (layoutkind == LY_USEEXIST) {
/* XXX Check we have a sensible layout */ /* XXX Check we have a sensible layout */
; ;
} else } else
@ -185,7 +185,7 @@ md_make_bsd_partitions(void)
* edit it and verify it's OK, or abort altogether. * edit it and verify it's OK, or abort altogether.
*/ */
edit_check: edit_check:
if (edit_and_check_label(bsdlabel, maxpart, part_raw, part_bsd) == 0) { if (edit_and_check_label(pm->bsdlabel, maxpart, part_raw, part_bsd) == 0) {
msg_display(MSG_abort); msg_display(MSG_abort);
return 0; return 0;
} }
@ -193,10 +193,10 @@ md_make_bsd_partitions(void)
goto edit_check; goto edit_check;
/* Disk name */ /* Disk name */
msg_prompt(MSG_packname, bsddiskname, bsddiskname, sizeof bsddiskname); msg_prompt(MSG_packname, pm->bsddiskname, pm->bsddiskname, sizeof pm->bsddiskname);
/* save label to disk for MI code to update. */ /* save label to disk for MI code to update. */
(void)savenewlabel(bsdlabel, maxpart); (void)savenewlabel(pm->bsdlabel, maxpart);
/* Everything looks OK. */ /* Everything looks OK. */
return 1; return 1;
@ -215,7 +215,7 @@ md_check_partitions(void)
* something stupid, like move it away from the MBR partition. * something stupid, like move it away from the MBR partition.
*/ */
for (part = PART_A; part < MAXPARTITIONS; part++) for (part = PART_A; part < MAXPARTITIONS; part++)
if (bsdlabel[part].pi_fstype == FS_EX2FS) { if (pm->bsdlabel[part].pi_fstype == FS_EX2FS) {
bootpart_ext2fs = part; bootpart_ext2fs = part;
return 1; return 1;
} }
@ -234,7 +234,7 @@ md_pre_disklabel(void)
msg_display(MSG_dofdisk); msg_display(MSG_dofdisk);
/* write edited MBR onto disk. */ /* write edited MBR onto disk. */
if (write_mbr(diskdev, &mbr, 1) != 0) { if (write_mbr(pm->diskdev, &mbr, 1) != 0) {
msg_display(MSG_wmbrfail); msg_display(MSG_wmbrfail);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return 1; return 1;
@ -249,7 +249,7 @@ int
md_post_disklabel(void) md_post_disklabel(void)
{ {
if (get_ramsize() <= 32) if (get_ramsize() <= 32)
set_swap(diskdev, bsdlabel); set_swap(pm->diskdev, pm->bsdlabel);
return 0; return 0;
} }
@ -273,7 +273,7 @@ md_post_newfs(void)
unsigned int i; unsigned int i;
if (!nobootfs) { if (!nobootfs) {
msg_display(msg_string(MSG_copybootloader), diskdev); msg_display(msg_string(MSG_copybootloader), pm->diskdev);
snprintf(bootdir, sizeof(bootdir), "%s/boot", snprintf(bootdir, sizeof(bootdir), "%s/boot",
target_expand(PART_BOOT_EXT2FS_PI_MOUNT)); target_expand(PART_BOOT_EXT2FS_PI_MOUNT));
@ -311,9 +311,9 @@ md_pre_update(void)
int i; int i;
if (get_ramsize() <= 32) if (get_ramsize() <= 32)
set_swap(diskdev, NULL); set_swap(pm->diskdev, NULL);
read_mbr(diskdev, &mbr); read_mbr(pm->diskdev, &mbr);
/* do a sanity check of the partition table */ /* do a sanity check of the partition table */
for (ext = &mbr; ext; ext = ext->extended) { for (ext = &mbr; ext; ext = ext->extended) {
part = ext->mbr.mbr_parts; part = ext->mbr.mbr_parts;
@ -354,13 +354,13 @@ md_check_mbr(mbr_info_t *mbri)
part = ext->mbr.mbr_parts; part = ext->mbr.mbr_parts;
for (i = 0; i < MBR_PART_COUNT; part++, i++) { for (i = 0; i < MBR_PART_COUNT; part++, i++) {
if (part->mbrp_type == MBR_PTYPE_LNXEXT2) { if (part->mbrp_type == MBR_PTYPE_LNXEXT2) {
bootstart = part->mbrp_start; pm->bootstart = part->mbrp_start;
bootsize = part->mbrp_size; pm->bootsize = part->mbrp_size;
break; break;
} }
} }
} }
if (bootsize < (MIN_EXT2FS_BOOT / 512)) { if (pm->bootsize < (MIN_EXT2FS_BOOT / 512)) {
msg_display(MSG_boottoosmall); msg_display(MSG_boottoosmall);
msg_display_add(MSG_reeditpart, 0); msg_display_add(MSG_reeditpart, 0);
process_menu(MENU_yesno, NULL); process_menu(MENU_yesno, NULL);
@ -368,7 +368,7 @@ md_check_mbr(mbr_info_t *mbri)
return 0; return 0;
return 1; return 1;
} }
if (bootstart == 0 || bootsize == 0) { if (pm->bootstart == 0 || pm->bootsize == 0) {
msg_display(MSG_nobootpart); msg_display(MSG_nobootpart);
msg_display_add(MSG_reeditpart, 0); msg_display_add(MSG_reeditpart, 0);
process_menu(MENU_yesno, NULL); process_menu(MENU_yesno, NULL);
@ -402,14 +402,14 @@ md_mbr_use_wholedisk(mbr_info_t *mbri)
part[0].mbrp_flag = MBR_PFLAG_ACTIVE; part[0].mbrp_flag = MBR_PFLAG_ACTIVE;
part[1].mbrp_type = MBR_PTYPE_NETBSD; part[1].mbrp_type = MBR_PTYPE_NETBSD;
part[1].mbrp_size = dlsize - (bsec + EXT2FS_BOOT_SIZE / 512); part[1].mbrp_size = pm->dlsize - (bsec + EXT2FS_BOOT_SIZE / 512);
part[1].mbrp_start = bsec + EXT2FS_BOOT_SIZE / 512; part[1].mbrp_start = bsec + EXT2FS_BOOT_SIZE / 512;
part[1].mbrp_flag = 0; part[1].mbrp_flag = 0;
ptstart = part[1].mbrp_start; pm->ptstart = part[1].mbrp_start;
ptsize = part[1].mbrp_size; pm->ptsize = part[1].mbrp_size;
bootstart = part[0].mbrp_start; pm->bootstart = part[0].mbrp_start;
bootsize = part[0].mbrp_size; pm->bootsize = part[0].mbrp_size;
return 1; return 1;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:45 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -66,7 +66,7 @@ md_get_info(void)
int fd; int fd;
char dev_name[100]; char dev_name[100];
snprintf(dev_name, 100, "/dev/r%sc", diskdev); snprintf(dev_name, 100, "/dev/r%sc", pm->diskdev);
fd = open(dev_name, O_RDONLY, 0); fd = open(dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -87,21 +87,21 @@ md_get_info(void)
} }
close(fd); close(fd);
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlcylsize = disklabel.d_secpercyl; pm->dlcylsize = disklabel.d_secpercyl;
/* /*
* Compute whole disk size. Take max of (dlcyl*dlhead*dlsec) * Compute whole disk size. Take max of (pm->dlcyl*pm->dlhead*pm->dlsec)
* and secperunit, just in case the disk is already labelled. * and secperunit, just in case the disk is already labelled.
* (If our new label's RAW_PART size ends up smaller than the * (If our new label's RAW_PART size ends up smaller than the
* in-core RAW_PART size value, updating the label will fail.) * in-core RAW_PART size value, updating the label will fail.)
*/ */
dlsize = dlcyl*dlhead*dlsec; pm->dlsize = pm->dlcyl*pm->dlhead*pm->dlsec;
if (disklabel.d_secperunit > dlsize) if (disklabel.d_secperunit > pm->dlsize)
dlsize = disklabel.d_secperunit; pm->dlsize = disklabel.d_secperunit;
return 1; return 1;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:45 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -80,21 +80,21 @@ md_get_info(void)
if (boardtype == BOARD_TYPE_RPI) if (boardtype == BOARD_TYPE_RPI)
return set_bios_geom_with_mbr_guess(); return set_bios_geom_with_mbr_guess();
if (no_mbr) if (pm->no_mbr)
return 1; return 1;
if (read_mbr(diskdev, &mbr) < 0) if (read_mbr(pm->diskdev, &mbr) < 0)
memset(&mbr.mbr, 0, sizeof(mbr.mbr)-2); memset(&mbr.mbr, 0, sizeof(mbr.mbr)-2);
if (edit_mbr(&mbr) == 0) if (edit_mbr(&mbr) == 0)
return 0; return 0;
if (strncmp(diskdev, "wd", 2) == 0) if (strncmp(pm->diskdev, "wd", 2) == 0)
disktype = "ST506"; pm->disktype = "ST506";
else else
disktype = "SCSI"; pm->disktype = "SCSI";
snprintf(dev_name, 100, "/dev/r%sc", diskdev); snprintf(dev_name, 100, "/dev/r%sc", pm->diskdev);
fd = open(dev_name, O_RDONLY, 0); fd = open(dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -110,21 +110,21 @@ md_get_info(void)
} }
close(fd); close(fd);
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlcylsize = disklabel.d_secpercyl; pm->dlcylsize = disklabel.d_secpercyl;
/* /*
* Compute whole disk size. Take max of (dlcyl*dlhead*dlsec) * Compute whole disk size. Take max of (pm->dlcyl*pm->dlhead*pm->dlsec)
* and secperunit, just in case the disk is already labelled. * and secperunit, just in case the disk is already labelled.
* (If our new label's RAW_PART size ends up smaller than the * (If our new label's RAW_PART size ends up smaller than the
* in-core RAW_PART size value, updating the label will fail.) * in-core RAW_PART size value, updating the label will fail.)
*/ */
dlsize = dlcyl*dlhead*dlsec; pm->dlsize = pm->dlcyl*pm->dlhead*pm->dlsec;
if (disklabel.d_secperunit > dlsize) if (disklabel.d_secperunit > pm->dlsize)
dlsize = disklabel.d_secperunit; pm->dlsize = disklabel.d_secperunit;
return 1; return 1;
} }
@ -150,7 +150,7 @@ md_check_partitions(void)
return 1; return 1;
if (boardtype == BOARD_TYPE_RPI) { if (boardtype == BOARD_TYPE_RPI) {
for (part = PART_A; part < MAXPARTITIONS; part++) for (part = PART_A; part < MAXPARTITIONS; part++)
if (bsdlabel[part].pi_fstype == FS_MSDOS) { if (pm->bsdlabel[part].pi_fstype == FS_MSDOS) {
rpi_bootpart = part; rpi_bootpart = part;
return 1; return 1;
} }
@ -167,13 +167,13 @@ md_check_partitions(void)
int int
md_pre_disklabel(void) md_pre_disklabel(void)
{ {
if (no_mbr) if (pm->no_mbr)
return 0; return 0;
msg_display(MSG_dofdisk); msg_display(MSG_dofdisk);
/* write edited MBR onto disk. */ /* write edited MBR onto disk. */
if (write_mbr(diskdev, &mbr, 1) != 0) { if (write_mbr(pm->diskdev, &mbr, 1) != 0) {
msg_display(MSG_wmbrfail); msg_display(MSG_wmbrfail);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return 1; return 1;
@ -293,7 +293,7 @@ md_mbr_use_wholedisk(mbr_info_t *mbri)
if (boardtype == BOARD_TYPE_NORMAL) { if (boardtype == BOARD_TYPE_NORMAL) {
/* this keeps it from creating /boot as msdos */ /* this keeps it from creating /boot as msdos */
bootsize = 0; pm->bootsize = 0;
return mbr_use_wholedisk(mbri); return mbr_use_wholedisk(mbri);
} }
@ -308,14 +308,14 @@ md_mbr_use_wholedisk(mbr_info_t *mbri)
} }
offset = part[0].mbrp_start + part[0].mbrp_size; offset = part[0].mbrp_start + part[0].mbrp_size;
part[1].mbrp_type = MBR_PTYPE_NETBSD; part[1].mbrp_type = MBR_PTYPE_NETBSD;
part[1].mbrp_size = dlsize - offset; part[1].mbrp_size = pm->dlsize - offset;
part[1].mbrp_start = offset; part[1].mbrp_start = offset;
part[1].mbrp_flag = 0; part[1].mbrp_flag = 0;
ptstart = part[1].mbrp_start; pm->ptstart = part[1].mbrp_start;
ptsize = part[1].mbrp_size; pm->ptsize = part[1].mbrp_size;
bootstart = part[0].mbrp_start; pm->bootstart = part[0].mbrp_start;
bootsize = part[0].mbrp_size; pm->bootsize = part[0].mbrp_size;
return 1; return 1;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:45 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */
/* /*
* Copyright 1997,2002 Piermont Information Systems Inc. * Copyright 1997,2002 Piermont Information Systems Inc.
@ -85,13 +85,13 @@ md_check_partitions(void)
int int
md_pre_disklabel(void) md_pre_disklabel(void)
{ {
if (no_mbr) if (pm->no_mbr)
return 0; return 0;
msg_display(MSG_dofdisk); msg_display(MSG_dofdisk);
/* write edited MBR onto disk. */ /* write edited MBR onto disk. */
if (write_mbr(diskdev, &mbr, 1) != 0) { if (write_mbr(pm->diskdev, &mbr, 1) != 0) {
msg_display(MSG_wmbrfail); msg_display(MSG_wmbrfail);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return 1; return 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:45 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */
/* /*
* Copyright 1997,2002 Piermont Information Systems Inc. * Copyright 1997,2002 Piermont Information Systems Inc.
@ -88,7 +88,7 @@ md_pre_disklabel(void)
printf ("%s", msg_string (MSG_dofdisk)); printf ("%s", msg_string (MSG_dofdisk));
/* write edited MBR onto disk. */ /* write edited MBR onto disk. */
if (write_mbr(diskdev, &mbr, 1) != 0) { if (write_mbr(pm->diskdev, &mbr, 1) != 0) {
msg_display(MSG_wmbrfail); msg_display(MSG_wmbrfail);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return 1; return 1;
@ -103,10 +103,10 @@ int
md_post_disklabel(void) md_post_disklabel(void)
{ {
/* Sector forwarding / badblocks ... */ /* Sector forwarding / badblocks ... */
if (*doessf) { if (*pm->doessf) {
printf ("%s", msg_string (MSG_dobad144)); printf ("%s", msg_string (MSG_dobad144));
return run_program(RUN_DISPLAY, "/usr/sbin/bad144 %s 0", return run_program(RUN_DISPLAY, "/usr/sbin/bad144 %s 0",
diskdev); pm->diskdev);
} }
return 0; return 0;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:45 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -55,7 +55,7 @@ md_get_info(void)
int fd; int fd;
char dev_name[100]; char dev_name[100];
snprintf(dev_name, 100, "/dev/r%s%c", diskdev, 'a' + getrawpartition()); snprintf(dev_name, 100, "/dev/r%s%c", pm->diskdev, 'a' + getrawpartition());
fd = open(dev_name, O_RDONLY, 0); fd = open(dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -71,21 +71,21 @@ md_get_info(void)
} }
close(fd); close(fd);
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlcylsize = disklabel.d_secpercyl; pm->dlcylsize = disklabel.d_secpercyl;
/* /*
* Compute whole disk size. Take max of (dlcyl*dlhead*dlsec) * Compute whole disk size. Take max of (pm->dlcyl*pm->dlhead*pm->dlsec)
* and secperunit, just in case the disk is already labelled. * and secperunit, just in case the disk is already labelled.
* (If our new label's RAW_PART size ends up smaller than the * (If our new label's RAW_PART size ends up smaller than the
* in-core RAW_PART size value, updating the label will fail.) * in-core RAW_PART size value, updating the label will fail.)
*/ */
dlsize = dlcyl * dlhead * dlsec; pm->dlsize = pm->dlcyl * pm->dlhead * pm->dlsec;
if (disklabel.d_secperunit > dlsize) if (disklabel.d_secperunit > pm->dlsize)
dlsize = disklabel.d_secperunit; pm->dlsize = disklabel.d_secperunit;
return 1; return 1;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:45 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -69,7 +69,7 @@ md_get_info(void)
int fd; int fd;
char dev_name[100]; char dev_name[100];
snprintf(dev_name, 100, "/dev/r%s%c", diskdev, 'a' + getrawpartition()); snprintf(dev_name, 100, "/dev/r%s%c", pm->diskdev, 'a' + getrawpartition());
fd = open(dev_name, O_RDONLY, 0); fd = open(dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -85,21 +85,21 @@ md_get_info(void)
} }
close(fd); close(fd);
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlcylsize = disklabel.d_secpercyl; pm->dlcylsize = disklabel.d_secpercyl;
/* /*
* Compute whole disk size. Take max of (dlcyl*dlhead*dlsec) * Compute whole disk size. Take max of (pm->dlcyl*pm->dlhead*pm->dlsec)
* and secperunit, just in case the disk is already labelled. * and secperunit, just in case the disk is already labelled.
* (If our new label's RAW_PART size ends up smaller than the * (If our new label's RAW_PART size ends up smaller than the
* in-core RAW_PART size value, updating the label will fail.) * in-core RAW_PART size value, updating the label will fail.)
*/ */
dlsize = dlcyl * dlhead * dlsec; pm->dlsize = pm->dlcyl * pm->dlhead * pm->dlsec;
if (disklabel.d_secperunit > dlsize) if (disklabel.d_secperunit > pm->dlsize)
dlsize = disklabel.d_secperunit; pm->dlsize = disklabel.d_secperunit;
return 1; return 1;
} }
@ -129,7 +129,7 @@ md_check_partitions(void)
int int
md_pre_disklabel(void) md_pre_disklabel(void)
{ {
bsdlabel[PART_BOOT].pi_offset = ews4800mips_boot_offset(); pm->bsdlabel[PART_BOOT].pi_offset = ews4800mips_boot_offset();
return 0; return 0;
} }
@ -158,7 +158,7 @@ md_post_newfs(void)
flags = RUN_DISPLAY | RUN_FATAL; flags = RUN_DISPLAY | RUN_FATAL;
cp_to_target("/usr/mdec/boot", "/stand/boot"); cp_to_target("/usr/mdec/boot", "/stand/boot");
run_program(flags, "/usr/sbin/installboot /dev/r%s%c %s", run_program(flags, "/usr/sbin/installboot /dev/r%s%c %s",
diskdev, 'a' + getrawpartition(), pm->diskdev, 'a' + getrawpartition(),
"/usr/mdec/bootxx_bfs"); "/usr/mdec/bootxx_bfs");
return 0; return 0;
@ -195,7 +195,7 @@ md_update(void)
static int static int
ews4800mips_boot_offset(void) ews4800mips_boot_offset(void)
{ {
return dlcylsize; return pm->dlcylsize;
} }
/* /*
@ -207,12 +207,12 @@ ews4800mips_boot_size(void)
int i; int i;
/* /*
* dlcylsize : PDINFO block * pm->dlcylsize : PDINFO block
* dlcylsize : 100 block * pm->dlcylsize : 100 block
*/ */
i = dlcylsize + 100; i = pm->dlcylsize + 100;
if (i >= 1024) /* XXX bsddisklabel.c hack. convert to byte count. */ if (i >= 1024) /* XXX bsddisklabel.c hack. convert to byte count. */
i = dlcylsize * sectorsize * 2; i = pm->dlcylsize * pm->sectorsize * 2;
return i; return i;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:45 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -66,7 +66,7 @@ md_get_info(void)
char dev_name[100]; char dev_name[100];
struct disklabel disklabel; struct disklabel disklabel;
snprintf(dev_name, sizeof(dev_name), "/dev/r%sc", diskdev); snprintf(dev_name, sizeof(dev_name), "/dev/r%sc", pm->diskdev);
fd = open(dev_name, O_RDONLY, 0); fd = open(dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -92,12 +92,12 @@ md_get_info(void)
exit(1); exit(1);
} }
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlcylsize = disklabel.d_secpercyl; pm->dlcylsize = disklabel.d_secpercyl;
dlsize = dlcyl*dlhead*dlsec; pm->dlsize = pm->dlcyl*pm->dlhead*pm->dlsec;
if (read(fd, buf, 1024) < 0) { if (read(fd, buf, 1024) < 0) {
endwin(); endwin();
@ -107,7 +107,7 @@ md_get_info(void)
} }
/* We will preserve the first cylinder as PART_BOOT for bootloader. */ /* We will preserve the first cylinder as PART_BOOT for bootloader. */
ptstart = 0; pm->ptstart = 0;
close(fd); close(fd);
@ -139,22 +139,22 @@ md_check_partitions(void)
for (part = PART_A; part < MAXPARTITIONS; part++) { for (part = PART_A; part < MAXPARTITIONS; part++) {
if (part == PART_RAW || part == PART_BOOT) if (part == PART_RAW || part == PART_BOOT)
continue; continue;
if (last >= PART_A && bsdlabel[part].pi_size > 0) { if (last >= PART_A && pm->bsdlabel[part].pi_size > 0) {
msg_display(MSG_emptypart, part+'a'); msg_display(MSG_emptypart, part+'a');
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return 0; return 0;
} }
if (bsdlabel[part].pi_size == 0) { if (pm->bsdlabel[part].pi_size == 0) {
if (last < PART_A) if (last < PART_A)
last = part; last = part;
} else { } else {
if (start >= bsdlabel[part].pi_offset) { if (start >= pm->bsdlabel[part].pi_offset) {
msg_display(MSG_ordering, part+'a'); msg_display(MSG_ordering, part+'a');
process_menu(MENU_yesno, NULL); process_menu(MENU_yesno, NULL);
if (yesno) if (yesno)
return 0; return 0;
} }
start = bsdlabel[part].pi_offset; start = pm->bsdlabel[part].pi_offset;
} }
} }
@ -177,7 +177,7 @@ int
md_post_disklabel(void) md_post_disklabel(void)
{ {
if (get_ramsize() < 6) if (get_ramsize() < 6)
set_swap(diskdev, bsdlabel); set_swap(pm->diskdev, pm->bsdlabel);
return 0; return 0;
} }
@ -193,9 +193,9 @@ int
md_post_newfs(void) md_post_newfs(void)
{ {
/* boot blocks ... */ /* boot blocks ... */
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, pm->diskdev);
if (run_program(RUN_DISPLAY | RUN_NO_CLEAR, if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/sbin/installboot /dev/r%sc /usr/mdec/uboot.lif", diskdev)) "/usr/sbin/installboot /dev/r%sc /usr/mdec/uboot.lif", pm->diskdev))
process_menu(MENU_ok, process_menu(MENU_ok,
deconst("Warning: disk is probably not bootable")); deconst("Warning: disk is probably not bootable"));
return 0; return 0;
@ -219,7 +219,7 @@ int
md_pre_update(void) md_pre_update(void)
{ {
if (get_ramsize() < 6) if (get_ramsize() < 6)
set_swap(diskdev, NULL); set_swap(pm->diskdev, NULL);
return 1; return 1;
} }
@ -239,9 +239,9 @@ hp300_boot_size(void)
{ {
int i; int i;
i = dlcylsize; i = pm->dlcylsize;
if (i >= 1024) /* XXX: bsddisklabel.c has a hack. */ if (i >= 1024) /* XXX: bsddisklabel.c has a hack. */
i = dlcylsize * sectorsize * 2; i = pm->dlcylsize * pm->sectorsize * 2;
return i; return i;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:45 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -117,7 +117,7 @@ md_pre_disklabel(void)
msg_display(MSG_dofdisk); msg_display(MSG_dofdisk);
/* write edited MBR onto disk. */ /* write edited MBR onto disk. */
if (write_mbr(diskdev, &mbr, 1) != 0) { if (write_mbr(pm->diskdev, &mbr, 1) != 0) {
msg_display(MSG_wmbrfail); msg_display(MSG_wmbrfail);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return 1; return 1;
@ -132,10 +132,10 @@ int
md_post_disklabel(void) md_post_disklabel(void)
{ {
/* Sector forwarding / badblocks ... */ /* Sector forwarding / badblocks ... */
if (*doessf) { if (*pm->doessf) {
msg_display(MSG_dobad144); msg_display(MSG_dobad144);
return run_program(RUN_DISPLAY, "/usr/sbin/bad144 %s 0", return run_program(RUN_DISPLAY, "/usr/sbin/bad144 %s 0",
diskdev); pm->diskdev);
} }
return 0; return 0;
} }
@ -153,7 +153,7 @@ md_post_newfs(void)
ssize_t sz; ssize_t sz;
int fd = -1; int fd = -1;
snprintf(adevname, sizeof(adevname), "/dev/r%sa", diskdev); snprintf(adevname, sizeof(adevname), "/dev/r%sa", pm->diskdev);
fd = open(adevname, O_RDWR); fd = open(adevname, O_RDWR);
if (fd < 0) if (fd < 0)
goto out; goto out;

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:45 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -91,7 +91,7 @@ md_pre_disklabel(void)
msg_display(MSG_dofdisk); msg_display(MSG_dofdisk);
/* write edited MBR onto disk. */ /* write edited MBR onto disk. */
if (write_mbr(diskdev, &mbr, 1) != 0) { if (write_mbr(pm->diskdev, &mbr, 1) != 0) {
msg_display(MSG_wmbrfail); msg_display(MSG_wmbrfail);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return 1; return 1;
@ -106,10 +106,10 @@ int
md_post_disklabel(void) md_post_disklabel(void)
{ {
/* Sector forwarding / badblocks ... */ /* Sector forwarding / badblocks ... */
if (*doessf) { if (*pm->doessf) {
msg_display(MSG_dobad144); msg_display(MSG_dobad144);
return run_program(RUN_DISPLAY, "/usr/sbin/bad144 %s 0", return run_program(RUN_DISPLAY, "/usr/sbin/bad144 %s 0",
diskdev); pm->diskdev);
} }
return 0; return 0;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:45 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -96,7 +96,7 @@ md_pre_disklabel(void)
msg_display(MSG_dofdisk); msg_display(MSG_dofdisk);
/* write edited MBR onto disk. */ /* write edited MBR onto disk. */
if (write_mbr(diskdev, &mbr, 1) != 0) { if (write_mbr(pm->diskdev, &mbr, 1) != 0) {
msg_display(MSG_wmbrfail); msg_display(MSG_wmbrfail);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return 1; return 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:45 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:39 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -70,7 +70,7 @@ md_get_info(void)
int fd; int fd;
char dev_name[100]; char dev_name[100];
snprintf(dev_name, 100, "/dev/r%sc", diskdev); snprintf(dev_name, 100, "/dev/r%sc", pm->diskdev);
fd = open(dev_name, O_RDONLY, 0); fd = open(dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -91,26 +91,26 @@ md_get_info(void)
} }
close(fd); close(fd);
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlcylsize = disklabel.d_secpercyl; pm->dlcylsize = disklabel.d_secpercyl;
/* /*
* Compute whole disk size. Take max of (dlcyl*dlhead*dlsec) * Compute whole disk size. Take max of (pm->dlcyl*pm->dlhead*pm->dlsec)
* and secperunit, just in case the disk is already labelled. * and secperunit, just in case the disk is already labelled.
* (If our new label's RAW_PART size ends up smaller than the * (If our new label's RAW_PART size ends up smaller than the
* in-core RAW_PART size value, updating the label will fail.) * in-core RAW_PART size value, updating the label will fail.)
*/ */
dlsize = dlcyl*dlhead*dlsec; pm->dlsize = pm->dlcyl*pm->dlhead*pm->dlsec;
if (disklabel.d_secperunit > dlsize) if (disklabel.d_secperunit > pm->dlsize)
dlsize = disklabel.d_secperunit; pm->dlsize = disklabel.d_secperunit;
/* /*
* hppa PDC can only address up to 2GB. * hp700 PDC can only address up to 2GB.
*/ */
root_limit = HP700_PDC_LIMIT / (unsigned)sectorsize; root_limit = HP700_PDC_LIMIT / (unsigned)pm->sectorsize;
return 1; return 1;
} }
@ -131,13 +131,13 @@ int
md_check_partitions(void) md_check_partitions(void)
{ {
/* Check the root partition is sane. */ /* Check the root partition is sane. */
uint32_t limit = HP700_PDC_LIMIT / (unsigned)sectorsize; uint32_t limit = HP700_PDC_LIMIT / (unsigned)pm->sectorsize;
int part; int part;
for (part = PART_A; part < MAXPARTITIONS; part++) { for (part = PART_A; part < MAXPARTITIONS; part++) {
if (strcmp(bsdlabel[part].pi_mount, "/") == 0) { if (strcmp(pm->bsdlabel[part].pi_mount, "/") == 0) {
uint32_t offset = bsdlabel[part].pi_offset; uint32_t offset = pm->bsdlabel[part].pi_offset;
uint32_t size = bsdlabel[part].pi_size; uint32_t size = pm->bsdlabel[part].pi_size;
if (offset > limit || offset + size > limit) { if (offset > limit || offset + size > limit) {
msg_display(MSG_md_pdclimit); msg_display(MSG_md_pdclimit);
@ -183,10 +183,10 @@ md_post_newfs(void)
return error; return error;
/* boot blocks ... */ /* boot blocks ... */
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, pm->diskdev);
if (run_program(RUN_DISPLAY | RUN_NO_CLEAR, if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/sbin/installboot -v /dev/r%sc /usr/mdec/xxboot", "/usr/sbin/installboot -v /dev/r%sc /usr/mdec/xxboot",
diskdev)) pm->diskdev))
process_menu(MENU_ok, process_menu(MENU_ok,
deconst("Warning: disk is probably not bootable")); deconst("Warning: disk is probably not bootable"));
return 0; return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:45 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -95,12 +95,12 @@ md_get_info(void)
#define NETBSD_NAMED 0x0400 #define NETBSD_NAMED 0x0400
#define ACTIVE_NAMED 0x0800 #define ACTIVE_NAMED 0x0800
if (no_mbr) if (pm->no_mbr)
return 1; return 1;
if (read_mbr(diskdev, &mbr) < 0) if (read_mbr(pm->diskdev, &mbr) < 0)
memset(&mbr.mbr, 0, sizeof mbr.mbr - 2); memset(&mbr.mbr, 0, sizeof mbr.mbr - 2);
get_bios_info(diskdev); get_bios_info(pm->diskdev);
edit: edit:
if (edit_mbr(&mbr) == 0) if (edit_mbr(&mbr) == 0)
@ -119,7 +119,7 @@ edit:
} }
/* /*
* Ensure the install partition (at sector ptstart) and the active * Ensure the install partition (at sector pm->ptstart) and the active
* partition are bootable. * partition are bootable.
* Determine whether the bootselect code is needed. * Determine whether the bootselect code is needed.
* Note that MBR_BS_NEWMBR is always set, so we ignore it! * Note that MBR_BS_NEWMBR is always set, so we ignore it!
@ -131,14 +131,14 @@ edit:
for (i = 0; i < MBR_PART_COUNT; p++, i++) { for (i = 0; i < MBR_PART_COUNT; p++, i++) {
if (p->mbrp_flag == MBR_PFLAG_ACTIVE) { if (p->mbrp_flag == MBR_PFLAG_ACTIVE) {
fl |= ACTIVE_FOUND; fl |= ACTIVE_FOUND;
if (ext->sector + p->mbrp_start == ptstart) if (ext->sector + p->mbrp_start == pm->ptstart)
fl |= NETBSD_ACTIVE; fl |= NETBSD_ACTIVE;
} }
if (ext->mbrb.mbrbs_nametab[i][0] == 0) { if (ext->mbrb.mbrbs_nametab[i][0] == 0) {
/* No bootmenu label... */ /* No bootmenu label... */
if (ext->sector == 0) if (ext->sector == 0)
continue; continue;
if (ext->sector + p->mbrp_start == ptstart) if (ext->sector + p->mbrp_start == pm->ptstart)
/* /*
* Have installed into an extended ptn * Have installed into an extended ptn
* force name & bootsel... * force name & bootsel...
@ -149,7 +149,7 @@ edit:
/* Partition has a bootmenu label... */ /* Partition has a bootmenu label... */
if (ext->sector != 0) if (ext->sector != 0)
fl |= MBR_BS_EXTLBA; fl |= MBR_BS_EXTLBA;
if (ext->sector + p->mbrp_start == ptstart) if (ext->sector + p->mbrp_start == pm->ptstart)
fl |= NETBSD_NAMED; fl |= NETBSD_NAMED;
else if (p->mbrp_flag == MBR_PFLAG_ACTIVE) else if (p->mbrp_flag == MBR_PFLAG_ACTIVE)
fl |= ACTIVE_NAMED; fl |= ACTIVE_NAMED;
@ -265,13 +265,13 @@ md_check_partitions(void)
int int
md_pre_disklabel(void) md_pre_disklabel(void)
{ {
if (no_mbr) if (pm->no_mbr)
return 0; return 0;
msg_display(MSG_dofdisk); msg_display(MSG_dofdisk);
/* write edited MBR onto disk. */ /* write edited MBR onto disk. */
if (write_mbr(diskdev, &mbr, 1) != 0) { if (write_mbr(pm->diskdev, &mbr, 1) != 0) {
msg_display(MSG_wmbrfail); msg_display(MSG_wmbrfail);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return 1; return 1;
@ -286,7 +286,7 @@ int
md_post_disklabel(void) md_post_disklabel(void)
{ {
if (get_ramsize() <= 32) if (get_ramsize() <= 32)
set_swap(diskdev, bsdlabel); set_swap(pm->diskdev, pm->bsdlabel);
return 0; return 0;
} }
@ -331,7 +331,7 @@ md_post_newfs(void)
} }
process_menu(MENU_getboottype, &boottype); process_menu(MENU_getboottype, &boottype);
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, pm->diskdev);
if (bp.bp_consdev == ~0u) if (bp.bp_consdev == ~0u)
return 0; return 0;
@ -342,7 +342,7 @@ md_post_newfs(void)
/* Copy bootstrap in by hand - /sbin/installboot explodes ramdisks */ /* Copy bootstrap in by hand - /sbin/installboot explodes ramdisks */
ret = 1; ret = 1;
snprintf(bootxx, sizeof bootxx, "/dev/r%s%c", diskdev, 'a' + rootpart); snprintf(bootxx, sizeof bootxx, "/dev/r%s%c", pm->diskdev, 'a' + pm->rootpart);
td = open(bootxx, O_RDWR, 0); td = open(bootxx, O_RDWR, 0);
bootxx_filename = bootxx_name(); bootxx_filename = bootxx_name();
if (bootxx_filename != NULL) { if (bootxx_filename != NULL) {
@ -411,7 +411,7 @@ int
md_pre_update(void) md_pre_update(void)
{ {
if (get_ramsize() <= 8) if (get_ramsize() <= 8)
set_swap(diskdev, NULL); set_swap(pm->diskdev, NULL);
return 1; return 1;
} }
@ -469,7 +469,7 @@ get_bios_info(char *dev)
if (nip == NULL || nip->ni_nmatches == 0) { if (nip == NULL || nip->ni_nmatches == 0) {
nogeom: nogeom:
if (nip != NULL) if (nip != NULL)
msg_display(MSG_nobiosgeom, dlcyl, dlhead, dlsec); msg_display(MSG_nobiosgeom, pm->dlcyl, pm->dlhead, pm->dlsec);
if (guess_biosgeom_from_mbr(&mbr, &cyl, &head, &sec) >= 0 if (guess_biosgeom_from_mbr(&mbr, &cyl, &head, &sec) >= 0
&& nip != NULL) && nip != NULL)
msg_display_add(MSG_biosguess, cyl, head, sec); msg_display_add(MSG_biosguess, cyl, head, sec);
@ -525,7 +525,7 @@ nogeom:
static int static int
mbr_root_above_chs(void) mbr_root_above_chs(void)
{ {
return ptstart + DEFROOTSIZE * (MEG / 512) >= bcyl * bhead * bsec; return pm->ptstart + DEFROOTSIZE * (MEG / 512) >= bcyl * bhead * bsec;
} }
static void static void
@ -534,10 +534,10 @@ md_upgrade_mbrtype(void)
struct mbr_partition *mbrp; struct mbr_partition *mbrp;
int i, netbsdpart = -1, oldbsdpart = -1, oldbsdcount = 0; int i, netbsdpart = -1, oldbsdpart = -1, oldbsdcount = 0;
if (no_mbr) if (pm->no_mbr)
return; return;
if (read_mbr(diskdev, &mbr) < 0) if (read_mbr(pm->diskdev, &mbr) < 0)
return; return;
mbrp = &mbr.mbr.mbr_parts[0]; mbrp = &mbr.mbr.mbr_parts[0];
@ -552,7 +552,7 @@ md_upgrade_mbrtype(void)
if (netbsdpart == -1 && oldbsdcount == 1) { if (netbsdpart == -1 && oldbsdcount == 1) {
mbrp[oldbsdpart].mbrp_type = MBR_PTYPE_NETBSD; mbrp[oldbsdpart].mbrp_type = MBR_PTYPE_NETBSD;
write_mbr(diskdev, &mbr, 0); write_mbr(pm->diskdev, &mbr, 0);
} }
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:46 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997,2002 Piermont Information Systems Inc. * Copyright 1997,2002 Piermont Information Systems Inc.
@ -85,15 +85,15 @@ md_check_partitions(void)
int int
md_pre_disklabel(void) md_pre_disklabel(void)
{ {
if (no_mbr) if (pm->no_mbr)
return 0; return 0;
msg_display(MSG_dofdisk); msg_display(MSG_dofdisk);
/* write edited MBR onto disk. */ /* write edited MBR onto disk. */
if (write_mbr(diskdev, &mbr, 1) != 0 || if (write_mbr(pm->diskdev, &mbr, 1) != 0 ||
run_program(RUN_SILENT | RUN_ERROR_OK, run_program(RUN_SILENT | RUN_ERROR_OK,
"/sbin/fdisk -f -i -c /usr/mdec/mbr %s", diskdev)) { "/sbin/fdisk -f -i -c /usr/mdec/mbr %s", pm->diskdev)) {
msg_display(MSG_wmbrfail); msg_display(MSG_wmbrfail);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return 1; return 1;
@ -124,12 +124,12 @@ md_post_newfs(void)
char *bootxx; char *bootxx;
int error; int error;
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, pm->diskdev);
cp_to_target("/usr/mdec/boot", "/boot"); cp_to_target("/usr/mdec/boot", "/boot");
bootxx = bootxx_name(); bootxx = bootxx_name();
if (bootxx != NULL) { if (bootxx != NULL) {
error = run_program(RUN_DISPLAY | RUN_NO_CLEAR, error = run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/sbin/installboot -v /dev/r%sa %s", diskdev, bootxx); "/usr/sbin/installboot -v /dev/r%sa %s", pm->diskdev, bootxx);
free(bootxx); free(bootxx);
} else } else
error = -1; error = -1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:46 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -73,7 +73,7 @@ md_get_info(void)
int fd; int fd;
char dev_name[100]; char dev_name[100];
snprintf(dev_name, sizeof(dev_name), "/dev/r%sc", diskdev); snprintf(dev_name, sizeof(dev_name), "/dev/r%sc", pm->diskdev);
fd = open(dev_name, O_RDONLY, 0); fd = open(dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -89,21 +89,21 @@ md_get_info(void)
} }
close(fd); close(fd);
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlcylsize = disklabel.d_secpercyl; pm->dlcylsize = disklabel.d_secpercyl;
/* /*
* Compute whole disk size. Take max of (dlcyl*dlhead*dlsec) * Compute whole disk size. Take max of (pm->dlcyl*pm->dlhead*pm->dlsec)
* and secperunit, just in case the disk is already labelled. * and secperunit, just in case the disk is already labelled.
* (If our new label's RAW_PART size ends up smaller than the * (If our new label's RAW_PART size ends up smaller than the
* in-core RAW_PART size value, updating the label will fail.) * in-core RAW_PART size value, updating the label will fail.)
*/ */
dlsize = dlcyl * dlhead * dlsec; pm->dlsize = pm->dlcyl * pm->dlhead * pm->dlsec;
if (disklabel.d_secperunit > dlsize) if (disklabel.d_secperunit > pm->dlsize)
dlsize = disklabel.d_secperunit; pm->dlsize = disklabel.d_secperunit;
return 1; return 1;
} }
@ -191,7 +191,7 @@ md_post_newfs(void)
if (run_program(RUN_DISPLAY | RUN_PROGRESS, if (run_program(RUN_DISPLAY | RUN_PROGRESS,
"/sbin/newfs -V2 -O 0 -b %d -f %d /dev/r%s%c", "/sbin/newfs -V2 -O 0 -b %d -f %d /dev/r%s%c",
PART_BOOT_BSIZE, PART_BOOT_FSIZE, diskdev, 'a' + PART_BOOT)) PART_BOOT_BSIZE, PART_BOOT_FSIZE, pm->diskdev, 'a' + PART_BOOT))
return 1; return 1;
return copy_bootloader(); return copy_bootloader();
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:46 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -140,7 +140,7 @@ md_get_info(void)
struct apple_part_map_entry block; struct apple_part_map_entry block;
snprintf(dev_name, sizeof(dev_name), "/dev/r%s%c", snprintf(dev_name, sizeof(dev_name), "/dev/r%s%c",
diskdev, 'a' + getrawpartition()); pm->diskdev, 'a' + getrawpartition());
/* /*
* Open the disk as a raw device * Open the disk as a raw device
@ -165,29 +165,29 @@ md_get_info(void)
* obained them by querying the disk itself. * obained them by querying the disk itself.
*/ */
blk_size = disklabel.d_secsize; blk_size = disklabel.d_secsize;
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
/* /*
* Just in case, initialize the structures we'll need if we * Just in case, initialize the structures we'll need if we
* need to completely initialize the disk. * need to completely initialize the disk.
*/ */
dlsize = disklabel.d_secperunit; pm->dlsize = disklabel.d_secperunit;
for (i=0;i<NEW_MAP_SIZE;i++) { for (i=0;i<NEW_MAP_SIZE;i++) {
if (i > 0) if (i > 0)
new_map[i].pmPyPartStart = new_map[i-1].pmPyPartStart + new_map[i].pmPyPartStart = new_map[i-1].pmPyPartStart +
new_map[i-1].pmPartBlkCnt; new_map[i-1].pmPartBlkCnt;
new_map[i].pmDataCnt = new_map[i].pmPartBlkCnt; new_map[i].pmDataCnt = new_map[i].pmPartBlkCnt;
if (new_map[i].pmPartBlkCnt == 0) { if (new_map[i].pmPartBlkCnt == 0) {
new_map[i].pmPartBlkCnt = dlsize; new_map[i].pmPartBlkCnt = pm->dlsize;
new_map[i].pmDataCnt = dlsize; new_map[i].pmDataCnt = pm->dlsize;
break; break;
} }
dlsize -= new_map[i].pmPartBlkCnt; pm->dlsize -= new_map[i].pmPartBlkCnt;
} }
dlsize = disklabel.d_secperunit; pm->dlsize = disklabel.d_secperunit;
#if 0 #if 0
msg_display(MSG_dldebug, blk_size, dlcyl, dlhead, dlsec, dlsize); msg_display(MSG_dldebug, blk_size, pm->dlcyl, pm->dlhead, pm->dlsec, pm->dlsize);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
#endif #endif
map.size = 0; map.size = 0;
@ -223,11 +223,11 @@ md_get_info(void)
/* /*
* Setup the disktype so /etc/disktab gets proper info * Setup the disktype so /etc/disktab gets proper info
*/ */
if (strncmp(diskdev, "sd", 2) == 0) { if (strncmp(pm->diskdev, "sd", 2) == 0) {
disktype = "SCSI"; pm->disktype = "SCSI";
doessf = "sf:"; pm->doessf = "sf:";
} else } else
disktype = "IDE"; pm->disktype = "IDE";
return edit_diskmap(); return edit_diskmap();
} }
@ -261,13 +261,13 @@ md_make_bsd_partitions(void)
} }
/* Build standard partitions */ /* Build standard partitions */
memset(&bsdlabel, 0, sizeof bsdlabel); memset(&pm->bsdlabel, 0, sizeof pm->bsdlabel);
/* /*
* The mac68k port has a predefined partition for "c" which * The mac68k port has a predefined partition for "c" which
* is the size of the disk, everything else is unused. * is the size of the disk, everything else is unused.
*/ */
bsdlabel[RAW_PART].pi_size = dlsize; pm->bsdlabel[RAW_PART].pi_size = pm->dlsize;
/* /*
* Now, scan through the Disk Partition Map and transfer the * Now, scan through the Disk Partition Map and transfer the
* information into the incore disklabel. * information into the incore disklabel.
@ -279,37 +279,37 @@ md_make_bsd_partitions(void)
pl = bzb->flags.part - 'a'; pl = bzb->flags.part - 'a';
switch (whichType(&map.blk[j])) { switch (whichType(&map.blk[j])) {
case HFS_PART: case HFS_PART:
bsdlabel[pl].pi_fstype = FS_HFS; pm->bsdlabel[pl].pi_fstype = FS_HFS;
strcpy (bsdlabel[pl].pi_mount, (char *)bzb->mount_point); strcpy (pm->bsdlabel[pl].pi_mount, (char *)bzb->mount_point);
break; break;
case ROOT_PART: case ROOT_PART:
case UFS_PART: case UFS_PART:
bsdlabel[pl].pi_fstype = FS_BSDFFS; pm->bsdlabel[pl].pi_fstype = FS_BSDFFS;
strcpy (bsdlabel[pl].pi_mount, (char *)bzb->mount_point); strcpy (pm->bsdlabel[pl].pi_mount, (char *)bzb->mount_point);
bsdlabel[pl].pi_flags |= PIF_NEWFS | PIF_MOUNT; pm->bsdlabel[pl].pi_flags |= PIF_NEWFS | PIF_MOUNT;
break; break;
case SWAP_PART: case SWAP_PART:
bsdlabel[pl].pi_fstype = FS_SWAP; pm->bsdlabel[pl].pi_fstype = FS_SWAP;
break; break;
case SCRATCH_PART: case SCRATCH_PART:
bsdlabel[pl].pi_fstype = FS_OTHER; pm->bsdlabel[pl].pi_fstype = FS_OTHER;
strcpy (bsdlabel[pl].pi_mount, (char *)bzb->mount_point); strcpy (pm->bsdlabel[pl].pi_mount, (char *)bzb->mount_point);
default: default:
break; break;
} }
if (bsdlabel[pl].pi_fstype != FS_UNUSED) { if (pm->bsdlabel[pl].pi_fstype != FS_UNUSED) {
bsdlabel[pl].pi_size = map.blk[j].pmPartBlkCnt; pm->bsdlabel[pl].pi_size = map.blk[j].pmPartBlkCnt;
bsdlabel[pl].pi_offset = map.blk[j].pmPyPartStart; pm->bsdlabel[pl].pi_offset = map.blk[j].pmPyPartStart;
if (bsdlabel[pl].pi_fstype != FS_SWAP) { if (pm->bsdlabel[pl].pi_fstype != FS_SWAP) {
bsdlabel[pl].pi_frag = 8; pm->bsdlabel[pl].pi_frag = 8;
bsdlabel[pl].pi_fsize = 1024; pm->bsdlabel[pl].pi_fsize = 1024;
} }
} }
} }
} }
/* Disk name - don't bother asking, just use the physical name*/ /* Disk name - don't bother asking, just use the physical name*/
strcpy (bsddiskname, diskdev); strcpy (pm->bsddiskname, pm->diskdev);
#ifdef DEBUG #ifdef DEBUG
f = fopen ("/tmp/disktab", "w"); f = fopen ("/tmp/disktab", "w");
@ -321,26 +321,26 @@ md_make_bsd_partitions(void)
(void) fprintf (stderr, "Could not open /etc/disktab"); (void) fprintf (stderr, "Could not open /etc/disktab");
exit (1); exit (1);
} }
(void)fprintf (f, "%s|NetBSD installation generated:\\\n", bsddiskname); (void)fprintf (f, "%s|NetBSD installation generated:\\\n", pm->bsddiskname);
(void)fprintf (f, "\t:dt=%s:ty=winchester:\\\n", disktype); (void)fprintf (f, "\t:dt=%s:ty=winchester:\\\n", pm->disktype);
(void)fprintf (f, "\t:nc#%d:nt#%d:ns#%d:\\\n", dlcyl, dlhead, dlsec); (void)fprintf (f, "\t:nc#%d:nt#%d:ns#%d:\\\n", pm->dlcyl, pm->dlhead, pm->dlsec);
(void)fprintf (f, "\t:sc#%d:su#%" PRIu32 ":\\\n", dlhead*dlsec, (uint32_t)dlsize); (void)fprintf (f, "\t:sc#%d:su#%" PRIu32 ":\\\n", pm->dlhead*pm->dlsec, (uint32_t)pm->dlsize);
(void)fprintf (f, "\t:se#%d:%s\\\n", blk_size, doessf); (void)fprintf (f, "\t:se#%d:%s\\\n", blk_size, pm->doessf);
for (i=0; i<8; i++) { for (i=0; i<8; i++) {
if (bsdlabel[i].pi_fstype == FS_HFS) if (pm->bsdlabel[i].pi_fstype == FS_HFS)
(void)fprintf (f, "\t:p%c#%d:o%c#%d:t%c=macos:", (void)fprintf (f, "\t:p%c#%d:o%c#%d:t%c=macos:",
'a'+i, bsdlabel[i].pi_size, 'a'+i, pm->bsdlabel[i].pi_size,
'a'+i, bsdlabel[i].pi_offset, 'a'+i, pm->bsdlabel[i].pi_offset,
'a'+i); 'a'+i);
else else
(void)fprintf (f, "\t:p%c#%d:o%c#%d:t%c=%s:", (void)fprintf (f, "\t:p%c#%d:o%c#%d:t%c=%s:",
'a'+i, bsdlabel[i].pi_size, 'a'+i, pm->bsdlabel[i].pi_size,
'a'+i, bsdlabel[i].pi_offset, 'a'+i, pm->bsdlabel[i].pi_offset,
'a'+i, getfslabelname(bsdlabel[i].pi_fstype)); 'a'+i, getfslabelname(pm->bsdlabel[i].pi_fstype));
if (bsdlabel[i].pi_fstype == FS_BSDFFS) if (pm->bsdlabel[i].pi_fstype == FS_BSDFFS)
(void)fprintf (f, "b%c#%d:f%c#%d", (void)fprintf (f, "b%c#%d:f%c#%d",
'a'+i, bsdlabel[i].pi_fsize * bsdlabel[i].pi_frag, 'a'+i, pm->bsdlabel[i].pi_fsize * pm->bsdlabel[i].pi_frag,
'a'+i, bsdlabel[i].pi_fsize); 'a'+i, pm->bsdlabel[i].pi_fsize);
if (i < 7) if (i < 7)
(void)fprintf (f, "\\\n"); (void)fprintf (f, "\\\n");
else else
@ -379,7 +379,7 @@ md_pre_disklabel(void)
*/ */
printf ("%s", msg_string (MSG_dodiskmap)); printf ("%s", msg_string (MSG_dodiskmap));
snprintf (dev_name, sizeof(dev_name), "/dev/r%sc", diskdev); snprintf (dev_name, sizeof(dev_name), "/dev/r%sc", pm->diskdev);
/* /*
* Open the disk as a raw device * Open the disk as a raw device
*/ */
@ -400,7 +400,7 @@ md_pre_disklabel(void)
close (fd); close (fd);
exit (1); exit (1);
} }
new_block0.sbBlkCount = dlsize; /* Set disk size */ new_block0.sbBlkCount = pm->dlsize; /* Set disk size */
if (write (fd, &new_block0, blk_size) != blk_size) { if (write (fd, &new_block0, blk_size) != blk_size) {
endwin(); endwin();
fprintf (stderr, "I/O error writing Block0\n"); fprintf (stderr, "I/O error writing Block0\n");
@ -429,7 +429,7 @@ md_pre_disklabel(void)
* should be done by disklabel -- which is normally called right after * should be done by disklabel -- which is normally called right after
* we return -- but may be commented out for the mac68k port. We'll * we return -- but may be commented out for the mac68k port. We'll
* instead update the incore table by forcing a dummy write here. This * instead update the incore table by forcing a dummy write here. This
* relies on a change in the mac68k-specific writedisklabel() routine. * relies on a change in the mac68k-specific write_disklabel() routine.
* If that change doesn't exist nothing bad happens here. If disklabel * If that change doesn't exist nothing bad happens here. If disklabel
* properly updates the ondisk and incore labels everything still * properly updates the ondisk and incore labels everything still
* works. Only if we fail here and if disklabel fails are we in * works. Only if we fail here and if disklabel fails are we in
@ -465,7 +465,7 @@ md_post_disklabel(void)
"9660", "boot", "ados", "hfs ", "fcor", "ex2f", "9660", "boot", "ados", "hfs ", "fcor", "ex2f",
"ntfs", "raid", "ccd "}; "ntfs", "raid", "ccd "};
snprintf(dev_name, sizeof(dev_name), "/dev/r%sc", diskdev); snprintf(dev_name, sizeof(dev_name), "/dev/r%sc", pm->diskdev);
/* /*
* Open the disk as a raw device * Open the disk as a raw device
*/ */
@ -484,12 +484,12 @@ md_post_disklabel(void)
for (i=0;i<MAXPARTITIONS;i++) { for (i=0;i<MAXPARTITIONS;i++) {
if (i > updated_label.d_npartitions) if (i > updated_label.d_npartitions)
break; break;
if (bsdlabel[i].pi_size != updated_label.d_partitions[i].p_size) if (pm->bsdlabel[i].pi_size != updated_label.d_partitions[i].p_size)
no_match = 1; no_match = 1;
if (bsdlabel[i].pi_size) { if (pm->bsdlabel[i].pi_size) {
if (bsdlabel[i].pi_offset != updated_label.d_partitions[i].p_offset) if (pm->bsdlabel[i].pi_offset != updated_label.d_partitions[i].p_offset)
no_match = 1; no_match = 1;
if (bsdlabel[i].pi_fstype != updated_label.d_partitions[i].p_fstype) if (pm->bsdlabel[i].pi_fstype != updated_label.d_partitions[i].p_fstype)
no_match = 1; no_match = 1;
} }
if (no_match) if (no_match)
@ -505,8 +505,8 @@ md_post_disklabel(void)
" in-core: offset size type on-disk: offset size type"); " in-core: offset size type on-disk: offset size type");
for (i=0;i<MAXPARTITIONS;i++) { for (i=0;i<MAXPARTITIONS;i++) {
sprintf(buf, " %c:%13.8x%10.8x%5s%16.8x%10.8x%5s", i+'a', sprintf(buf, " %c:%13.8x%10.8x%5s%16.8x%10.8x%5s", i+'a',
bsdlabel[i].pi_offset, bsdlabel[i].pi_size, pm->bsdlabel[i].pi_offset, pm->bsdlabel[i].pi_size,
fst[bsdlabel[i].pi_fstype], fst[pm->bsdlabel[i].pi_fstype],
updated_label.d_partitions[i].p_offset, updated_label.d_partitions[i].p_offset,
updated_label.d_partitions[i].p_size, updated_label.d_partitions[i].p_size,
fst[updated_label.d_partitions[i].p_fstype]); fst[updated_label.d_partitions[i].p_fstype]);
@ -759,7 +759,7 @@ getName(part, len_name, name)
/* /*
* OK, this is stupid but it's damn nice to know! * OK, this is stupid but it's damn nice to know!
*/ */
snprintf (dev_name, sizeof(dev_name), "/dev/r%sc", diskdev); snprintf (dev_name, sizeof(dev_name), "/dev/r%sc", pm->diskdev);
/* /*
* Open the disk as a raw device * Open the disk as a raw device
*/ */
@ -1048,7 +1048,7 @@ disp_selected_part(sel)
getUse(&map.blk[j], sizeof(use), use); getUse(&map.blk[j], sizeof(use), use);
getName(&map.blk[j], sizeof(name), name); getName(&map.blk[j], sizeof(name), name);
bzb = (EBZB *)&map.blk[j].pmBootArgs[0]; bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
msg_table_add(MSG_part_row, diskdev, msg_table_add(MSG_part_row, pm->diskdev,
bzb->flags.part, map.blk[j].pmPyPartStart, bzb->flags.part, map.blk[j].pmPyPartStart,
map.blk[j].pmPartBlkCnt, fstyp, use, name); map.blk[j].pmPartBlkCnt, fstyp, use, name);
if (i == sel) msg_standend(); if (i == sel) msg_standend();
@ -1070,9 +1070,9 @@ check_for_errors()
for (i=0;i<map.usable_cnt;i++) { for (i=0;i<map.usable_cnt;i++) {
j = map.mblk[i]; j = map.mblk[i];
if (map.blk[j].pmPyPartStart > dlsize) if (map.blk[j].pmPyPartStart > pm->dlsize)
errs++; errs++;
if ((map.blk[j].pmPyPartStart + map.blk[j].pmPartBlkCnt) > dlsize + 1) if ((map.blk[j].pmPyPartStart + map.blk[j].pmPartBlkCnt) > pm->dlsize + 1)
errs++; errs++;
} }
return(errs); return(errs);
@ -1106,16 +1106,16 @@ report_errors()
} }
for (i=0;i<map.usable_cnt;i++) { for (i=0;i<map.usable_cnt;i++) {
j = map.mblk[i]; j = map.mblk[i];
if (map.blk[j].pmPyPartStart > dlsize) { if (map.blk[j].pmPyPartStart > pm->dlsize) {
bzb = (EBZB *)&map.blk[j].pmBootArgs[0]; bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
msg_display_add(MSG_disksetup_part_beginning, msg_display_add(MSG_disksetup_part_beginning,
diskdev, bzb->flags.part); pm->diskdev, bzb->flags.part);
errs++; errs++;
} }
if ((map.blk[j].pmPyPartStart + map.blk[j].pmPartBlkCnt) > dlsize) { if ((map.blk[j].pmPyPartStart + map.blk[j].pmPartBlkCnt) > pm->dlsize) {
bzb = (EBZB *)&map.blk[j].pmBootArgs[0]; bzb = (EBZB *)&map.blk[j].pmBootArgs[0];
msg_display_add(MSG_disksetup_part_size, msg_display_add(MSG_disksetup_part_size,
diskdev, bzb->flags.part); pm->diskdev, bzb->flags.part);
errs++; errs++;
} }
} }
@ -1130,7 +1130,7 @@ edit_diskmap(void)
int i; int i;
/* Ask full/part */ /* Ask full/part */
msg_display (MSG_fullpart, diskdev); msg_display (MSG_fullpart, pm->diskdev);
process_menu (MENU_fullpart, NULL); process_menu (MENU_fullpart, NULL);
map.selected = 0; map.selected = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: menus.md.de,v 1.1 2014/07/26 19:30:46 dholland Exp $ */ /* $NetBSD: menus.md.de,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -39,7 +39,7 @@ menu fullpart, title "Bitte w
option "Die ganze Festplatte für NetBSD verwenden", exit, action {usefull = 1;}; option "Die ganze Festplatte für NetBSD verwenden", exit, action {usefull = 1;};
menu nodiskmap, title "Bitte wählen Sie", y=16; menu nodiskmap, title "Bitte wählen Sie", y=16;
display action { msg_display (MSG_nodiskmap, diskdev); }; display action { msg_display (MSG_nodiskmap, pm->diskdev); };
option "Installation abbrechen", exit, action { option "Installation abbrechen", exit, action {
endwin(); exit(1); endwin(); exit(1);
}; };
@ -99,9 +99,9 @@ menu editparttable, title "W
bzb->mount_point[0] = '\0'; bzb->mount_point[0] = '\0';
strcpy (map.blk[k].pmPartType, "Apple_Free"); strcpy (map.blk[k].pmPartType, "Apple_Free");
map.blk[k].pmPyPartStart += size; map.blk[k].pmPyPartStart += size;
if ((map.blk[k].pmPyPartStart + free_size) > dlsize) if ((map.blk[k].pmPyPartStart + free_size) > pm->dlsize)
map.blk[k].pmPartBlkCnt = map.blk[k].pmPartBlkCnt =
dlsize - map.blk[k].pmPyPartStart; pm->dlsize - map.blk[k].pmPyPartStart;
else else
map.blk[k].pmPartBlkCnt = free_size; map.blk[k].pmPartBlkCnt = free_size;
map.blk[k].pmDataCnt = map.blk[k].pmPartBlkCnt; map.blk[k].pmDataCnt = map.blk[k].pmPartBlkCnt;
@ -129,20 +129,20 @@ menu editparttable, title "W
option "Partition korrigieren", action { option "Partition korrigieren", action {
int i = map.mblk[map.selected]; int i = map.mblk[map.selected];
EBZB *bzb = (EBZB *)&map.blk[i].pmBootArgs[0]; EBZB *bzb = (EBZB *)&map.blk[i].pmBootArgs[0];
msg_display(MSG_partdebug, diskdev, bzb->flags.part, msg_display(MSG_partdebug, pm->diskdev, bzb->flags.part,
map.blk[i].pmPyPartStart, map.blk[i].pmPyPartStart,
map.blk[i].pmPartBlkCnt); map.blk[i].pmPartBlkCnt);
if ((map.blk[i].pmPyPartStart + if ((map.blk[i].pmPyPartStart +
map.blk[i].pmPartBlkCnt) > dlsize) { map.blk[i].pmPartBlkCnt) > pm->dlsize) {
msg_display_add(MSG_parttable_fix_fixing, msg_display_add(MSG_parttable_fix_fixing,
diskdev, bzb->flags.part); pm->diskdev, bzb->flags.part);
map.blk[i].pmPartBlkCnt = map.blk[i].pmPartBlkCnt =
dlsize - map.blk[i].pmPyPartStart; pm->dlsize - map.blk[i].pmPyPartStart;
map.blk[i].pmDataCnt = map.blk[i].pmDataCnt =
map.blk[i].pmPartBlkCnt; map.blk[i].pmPartBlkCnt;
} else { } else {
msg_display_add(MSG_parttable_fix_fine, msg_display_add(MSG_parttable_fix_fine,
diskdev, bzb->flags.part); pm->diskdev, bzb->flags.part);
} }
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
}; };

View File

@ -1,4 +1,4 @@
/* $NetBSD: menus.md.en,v 1.1 2014/07/26 19:30:46 dholland Exp $ */ /* $NetBSD: menus.md.en,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -39,7 +39,7 @@ menu fullpart, title "Select your choice";
option "Use the entire disk", exit, action {usefull = 1;}; option "Use the entire disk", exit, action {usefull = 1;};
menu nodiskmap, title "Choose an option", y=16; menu nodiskmap, title "Choose an option", y=16;
display action { msg_display (MSG_nodiskmap, diskdev); }; display action { msg_display (MSG_nodiskmap, pm->diskdev); };
option "Abort install", exit, action { option "Abort install", exit, action {
endwin(); exit(1); endwin(); exit(1);
}; };
@ -99,9 +99,9 @@ menu editparttable, title "Choose your partition", exit, y=14;
bzb->mount_point[0] = '\0'; bzb->mount_point[0] = '\0';
strcpy ((char *)map.blk[k].pmPartType, "Apple_Free"); strcpy ((char *)map.blk[k].pmPartType, "Apple_Free");
map.blk[k].pmPyPartStart += size; map.blk[k].pmPyPartStart += size;
if ((map.blk[k].pmPyPartStart + free_size) > dlsize) if ((map.blk[k].pmPyPartStart + free_size) > pm->dlsize)
map.blk[k].pmPartBlkCnt = map.blk[k].pmPartBlkCnt =
dlsize - map.blk[k].pmPyPartStart; pm->dlsize - map.blk[k].pmPyPartStart;
else else
map.blk[k].pmPartBlkCnt = free_size; map.blk[k].pmPartBlkCnt = free_size;
map.blk[k].pmDataCnt = map.blk[k].pmPartBlkCnt; map.blk[k].pmDataCnt = map.blk[k].pmPartBlkCnt;
@ -129,20 +129,20 @@ menu editparttable, title "Choose your partition", exit, y=14;
option "Fix selected partition", action { option "Fix selected partition", action {
int i = map.mblk[map.selected]; int i = map.mblk[map.selected];
EBZB *bzb = (EBZB *)&map.blk[i].pmBootArgs[0]; EBZB *bzb = (EBZB *)&map.blk[i].pmBootArgs[0];
msg_display(MSG_partdebug, diskdev, bzb->flags.part, msg_display(MSG_partdebug, pm->diskdev, bzb->flags.part,
map.blk[i].pmPyPartStart, map.blk[i].pmPyPartStart,
map.blk[i].pmPartBlkCnt); map.blk[i].pmPartBlkCnt);
if ((map.blk[i].pmPyPartStart + if ((map.blk[i].pmPyPartStart +
map.blk[i].pmPartBlkCnt) > dlsize) { map.blk[i].pmPartBlkCnt) > pm->dlsize) {
msg_display_add(MSG_parttable_fix_fixing, msg_display_add(MSG_parttable_fix_fixing,
diskdev, bzb->flags.part); pm->diskdev, bzb->flags.part);
map.blk[i].pmPartBlkCnt = map.blk[i].pmPartBlkCnt =
dlsize - map.blk[i].pmPyPartStart; pm->dlsize - map.blk[i].pmPyPartStart;
map.blk[i].pmDataCnt = map.blk[i].pmDataCnt =
map.blk[i].pmPartBlkCnt; map.blk[i].pmPartBlkCnt;
} else { } else {
msg_display_add(MSG_parttable_fix_fine, msg_display_add(MSG_parttable_fix_fine,
diskdev, bzb->flags.part); pm->diskdev, bzb->flags.part);
} }
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
}; };

View File

@ -1,4 +1,4 @@
/* $NetBSD: menus.md.es,v 1.1 2014/07/26 19:30:46 dholland Exp $ */ /* $NetBSD: menus.md.es,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -39,7 +39,7 @@ menu fullpart, title "Seleccione su opcion";
option "Usar el disco entero", exit, action {usefull = 1;}; option "Usar el disco entero", exit, action {usefull = 1;};
menu nodiskmap, title "Escoja una opcion", y=16; menu nodiskmap, title "Escoja una opcion", y=16;
display action { msg_display (MSG_nodiskmap, diskdev); }; display action { msg_display (MSG_nodiskmap, pm->diskdev); };
option "Abortar instalacion", exit, action { option "Abortar instalacion", exit, action {
endwin(); exit(1); endwin(); exit(1);
}; };
@ -99,9 +99,9 @@ menu editparttable, title "Escoja su particion", exit, y=14;
bzb->mount_point[0] = '\0'; bzb->mount_point[0] = '\0';
strcpy (map.blk[k].pmPartType, "Apple_Free"); strcpy (map.blk[k].pmPartType, "Apple_Free");
map.blk[k].pmPyPartStart += size; map.blk[k].pmPyPartStart += size;
if ((map.blk[k].pmPyPartStart + free_size) > dlsize) if ((map.blk[k].pmPyPartStart + free_size) > pm->dlsize)
map.blk[k].pmPartBlkCnt = map.blk[k].pmPartBlkCnt =
dlsize - map.blk[k].pmPyPartStart; pm->dlsize - map.blk[k].pmPyPartStart;
else else
map.blk[k].pmPartBlkCnt = free_size; map.blk[k].pmPartBlkCnt = free_size;
map.blk[k].pmDataCnt = map.blk[k].pmPartBlkCnt; map.blk[k].pmDataCnt = map.blk[k].pmPartBlkCnt;
@ -129,20 +129,20 @@ menu editparttable, title "Escoja su particion", exit, y=14;
option "Arreglar particion seleccionada", action { option "Arreglar particion seleccionada", action {
int i = map.mblk[map.selected]; int i = map.mblk[map.selected];
EBZB *bzb = (EBZB *)&map.blk[i].pmBootArgs[0]; EBZB *bzb = (EBZB *)&map.blk[i].pmBootArgs[0];
msg_display(MSG_partdebug, diskdev, bzb->flags.part, msg_display(MSG_partdebug, pm->diskdev, bzb->flags.part,
map.blk[i].pmPyPartStart, map.blk[i].pmPyPartStart,
map.blk[i].pmPartBlkCnt); map.blk[i].pmPartBlkCnt);
if ((map.blk[i].pmPyPartStart + if ((map.blk[i].pmPyPartStart +
map.blk[i].pmPartBlkCnt) > dlsize) { map.blk[i].pmPartBlkCnt) > pm->dlsize) {
msg_display_add(MSG_parttable_fix_fixing, msg_display_add(MSG_parttable_fix_fixing,
diskdev, bzb->flags.part); pm->diskdev, bzb->flags.part);
map.blk[i].pmPartBlkCnt = map.blk[i].pmPartBlkCnt =
dlsize - map.blk[i].pmPyPartStart; pm->dlsize - map.blk[i].pmPyPartStart;
map.blk[i].pmDataCnt = map.blk[i].pmDataCnt =
map.blk[i].pmPartBlkCnt; map.blk[i].pmPartBlkCnt;
} else { } else {
msg_display_add(MSG_parttable_fix_fine, msg_display_add(MSG_parttable_fix_fine,
diskdev, bzb->flags.part); pm->diskdev, bzb->flags.part);
} }
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
}; };

View File

@ -1,4 +1,4 @@
/* $NetBSD: menus.md.pl,v 1.1 2014/07/26 19:30:46 dholland Exp $ */ /* $NetBSD: menus.md.pl,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* Based on english version: */ /* Based on english version: */
/* NetBSD: menus.md.en,v 1.13 2001/11/29 23:20:58 thorpej Exp */ /* NetBSD: menus.md.en,v 1.13 2001/11/29 23:20:58 thorpej Exp */
@ -41,7 +41,7 @@ menu fullpart, title "Wybierz";
option "Uzyj calego dysku", exit, action {usefull = 1;}; option "Uzyj calego dysku", exit, action {usefull = 1;};
menu nodiskmap, title "Wybierz opcje", y=16; menu nodiskmap, title "Wybierz opcje", y=16;
display action { msg_display (MSG_nodiskmap, diskdev); }; display action { msg_display (MSG_nodiskmap, pm->diskdev); };
option "Przerwij instalacje", exit, action { option "Przerwij instalacje", exit, action {
endwin(); exit(1); endwin(); exit(1);
}; };
@ -101,9 +101,9 @@ menu editparttable, title "Wybierz swoje partycje", exit, y=14;
bzb->mount_point[0] = '\0'; bzb->mount_point[0] = '\0';
strcpy (map.blk[k].pmPartType, "Apple_Free"); strcpy (map.blk[k].pmPartType, "Apple_Free");
map.blk[k].pmPyPartStart += size; map.blk[k].pmPyPartStart += size;
if ((map.blk[k].pmPyPartStart + free_size) > dlsize) if ((map.blk[k].pmPyPartStart + free_size) > pm->dlsize)
map.blk[k].pmPartBlkCnt = map.blk[k].pmPartBlkCnt =
dlsize - map.blk[k].pmPyPartStart; pm->dlsize - map.blk[k].pmPyPartStart;
else else
map.blk[k].pmPartBlkCnt = free_size; map.blk[k].pmPartBlkCnt = free_size;
map.blk[k].pmDataCnt = map.blk[k].pmPartBlkCnt; map.blk[k].pmDataCnt = map.blk[k].pmPartBlkCnt;
@ -131,20 +131,20 @@ menu editparttable, title "Wybierz swoje partycje", exit, y=14;
option "Napraw wybrana partycje", action { option "Napraw wybrana partycje", action {
int i = map.mblk[map.selected]; int i = map.mblk[map.selected];
EBZB *bzb = (EBZB *)&map.blk[i].pmBootArgs[0]; EBZB *bzb = (EBZB *)&map.blk[i].pmBootArgs[0];
msg_display(MSG_partdebug, diskdev, bzb->flags.part, msg_display(MSG_partdebug, pm->diskdev, bzb->flags.part,
map.blk[i].pmPyPartStart, map.blk[i].pmPyPartStart,
map.blk[i].pmPartBlkCnt); map.blk[i].pmPartBlkCnt);
if ((map.blk[i].pmPyPartStart + if ((map.blk[i].pmPyPartStart +
map.blk[i].pmPartBlkCnt) > dlsize) { map.blk[i].pmPartBlkCnt) > pm->dlsize) {
msg_display_add(MSG_parttable_fix_fixing, msg_display_add(MSG_parttable_fix_fixing,
diskdev, bzb->flags.part); pm->diskdev, bzb->flags.part);
map.blk[i].pmPartBlkCnt = map.blk[i].pmPartBlkCnt =
dlsize - map.blk[i].pmPyPartStart; pm->dlsize - map.blk[i].pmPyPartStart;
map.blk[i].pmDataCnt = map.blk[i].pmDataCnt =
map.blk[i].pmPartBlkCnt; map.blk[i].pmPartBlkCnt;
} else { } else {
msg_display_add(MSG_parttable_fix_fine, msg_display_add(MSG_parttable_fix_fine,
diskdev, bzb->flags.part); pm->diskdev, bzb->flags.part);
} }
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
}; };

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:46 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -67,7 +67,7 @@ md_get_info(void)
int fd; int fd;
char dev_name[100]; char dev_name[100];
snprintf (dev_name, 100, "/dev/r%sc", diskdev); snprintf (dev_name, 100, "/dev/r%sc", pm->diskdev);
fd = open (dev_name, O_RDONLY, 0); fd = open (dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -83,21 +83,21 @@ md_get_info(void)
} }
close(fd); close(fd);
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlcylsize = disklabel.d_secpercyl; pm->dlcylsize = disklabel.d_secpercyl;
/* /*
* Compute whole disk size. Take max of (dlcyl*dlhead*dlsec) * Compute whole disk size. Take max of (pm->dlcyl*pm->dlhead*pm->dlsec)
* and secperunit, just in case the disk is already labelled. * and secperunit, just in case the disk is already labelled.
* (If our new label's RAW_PART size ends up smaller than the * (If our new label's RAW_PART size ends up smaller than the
* in-core RAW_PART size value, updating the label will fail.) * in-core RAW_PART size value, updating the label will fail.)
*/ */
dlsize = dlcyl*dlhead*dlsec; pm->dlsize = pm->dlcyl*pm->dlhead*pm->dlsec;
if (disklabel.d_secperunit > dlsize) if (disklabel.d_secperunit > pm->dlsize)
dlsize = disklabel.d_secperunit; pm->dlsize = disklabel.d_secperunit;
return 1; return 1;
} }
@ -172,14 +172,14 @@ md_post_newfs(void)
* yet, so assume partition a has some offset on OF3 machines * yet, so assume partition a has some offset on OF3 machines
* and don't try installboot(8) in that case. * and don't try installboot(8) in that case.
*/ */
if (bsdlabel[PART_A].pi_offset != 0) if (pm->bsdlabel[PART_A].pi_offset != 0)
return 0; return 0;
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, pm->diskdev);
cp_to_target("/usr/mdec/ofwboot", bootfile); cp_to_target("/usr/mdec/ofwboot", bootfile);
sync(); sync();
run_program(RUN_DISPLAY, "/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); pm->diskdev, "/usr/mdec/bootxx", bootfile);
return 0; return 0;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:46 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -67,7 +67,7 @@ md_get_info(void)
int fd; int fd;
char dev_name[100]; char dev_name[100];
snprintf(dev_name, 100, "/dev/r%sc", diskdev); snprintf(dev_name, 100, "/dev/r%sc", pm->diskdev);
fd = open(dev_name, O_RDONLY, 0); fd = open(dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -88,21 +88,21 @@ md_get_info(void)
} }
close(fd); close(fd);
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlcylsize = disklabel.d_secpercyl; pm->dlcylsize = disklabel.d_secpercyl;
/* /*
* Compute whole disk size. Take max of (dlcyl*dlhead*dlsec) * Compute whole disk size. Take max of (pm->dlcyl*pm->dlhead*pm->dlsec)
* and secperunit, just in case the disk is already labelled. * and secperunit, just in case the disk is already labelled.
* (If our new label's RAW_PART size ends up smaller than the * (If our new label's RAW_PART size ends up smaller than the
* in-core RAW_PART size value, updating the label will fail.) * in-core RAW_PART size value, updating the label will fail.)
*/ */
dlsize = dlcyl*dlhead*dlsec; pm->dlsize = pm->dlcyl*pm->dlhead*pm->dlsec;
if (disklabel.d_secperunit > dlsize) if (disklabel.d_secperunit > pm->dlsize)
dlsize = disklabel.d_secperunit; pm->dlsize = disklabel.d_secperunit;
return 1; return 1;
} }
@ -160,10 +160,10 @@ md_post_newfs(void)
return 0; return 0;
} }
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, pm->diskdev);
cp_to_target("/usr/mdec/boot", "/boot"); cp_to_target("/usr/mdec/boot", "/boot");
if (run_program(RUN_DISPLAY | RUN_NO_CLEAR, if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/mdec/installboot /dev/r%sc /usr/mdec/bootxx_ffs", diskdev)) "/usr/mdec/installboot /dev/r%sc /usr/mdec/bootxx_ffs", pm->diskdev))
process_menu(MENU_ok, process_menu(MENU_ok,
deconst("Warning: disk is probably not bootable")); deconst("Warning: disk is probably not bootable"));
return 0; return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:46 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -66,7 +66,7 @@ md_get_info(void)
char dev_name[100]; char dev_name[100];
struct disklabel disklabel; struct disklabel disklabel;
snprintf(dev_name, 100, "/dev/r%sc", diskdev); snprintf(dev_name, 100, "/dev/r%sc", pm->diskdev);
fd = open(dev_name, O_RDONLY, 0); fd = open(dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -92,12 +92,12 @@ md_get_info(void)
exit(1); exit(1);
} }
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlcylsize = disklabel.d_secpercyl; pm->dlcylsize = disklabel.d_secpercyl;
dlsize = dlcyl*dlhead*dlsec; pm->dlsize = pm->dlcyl*pm->dlhead*pm->dlsec;
if (read(fd, buf, 1024) < 0) { if (read(fd, buf, 1024) < 0) {
endwin(); endwin();
@ -107,7 +107,7 @@ md_get_info(void)
} }
/* preserve first cylinder for system. */ /* preserve first cylinder for system. */
ptstart = disklabel.d_secpercyl; pm->ptstart = disklabel.d_secpercyl;
close(fd); close(fd);
@ -137,22 +137,22 @@ md_check_partitions(void)
for (part = PART_A; part < 8; part++) { for (part = PART_A; part < 8; part++) {
if (part == PART_C) if (part == PART_C)
continue; continue;
if (last >= PART_A && bsdlabel[part].pi_size > 0) { if (last >= PART_A && pm->bsdlabel[part].pi_size > 0) {
msg_display(MSG_emptypart, part+'a'); msg_display(MSG_emptypart, part+'a');
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return 0; return 0;
} }
if (bsdlabel[part].pi_size == 0) { if (pm->bsdlabel[part].pi_size == 0) {
if (last < PART_A) if (last < PART_A)
last = part; last = part;
} else { } else {
if (start > bsdlabel[part].pi_offset) { if (start > pm->bsdlabel[part].pi_offset) {
msg_display(MSG_ordering, part+'a'); msg_display(MSG_ordering, part+'a');
process_menu(MENU_yesno, NULL); process_menu(MENU_yesno, NULL);
if (yesno) if (yesno)
return 0; return 0;
} }
start = bsdlabel[part].pi_offset; start = pm->bsdlabel[part].pi_offset;
} }
} }
@ -175,7 +175,7 @@ int
md_post_disklabel(void) md_post_disklabel(void)
{ {
if (get_ramsize() < 6) if (get_ramsize() < 6)
set_swap(diskdev, bsdlabel); set_swap(pm->diskdev, pm->bsdlabel);
return 0; return 0;
} }
@ -192,11 +192,11 @@ md_post_newfs(void)
{ {
/* boot blocks ... */ /* boot blocks ... */
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, pm->diskdev);
cp_to_target("/usr/mdec/bootsd", "/.bootsd"); cp_to_target("/usr/mdec/bootsd", "/.bootsd");
if (run_program(RUN_DISPLAY | RUN_NO_CLEAR, if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/mdec/installboot %s /usr/mdec/bootxx /dev/r%sa", "/usr/mdec/installboot %s /usr/mdec/bootxx /dev/r%sa",
target_expand("/.bootsd"), diskdev)) target_expand("/.bootsd"), pm->diskdev))
process_menu(MENU_ok, process_menu(MENU_ok,
deconst("Warning: disk is probably not bootable")); deconst("Warning: disk is probably not bootable"));
return 0; return 0;
@ -220,7 +220,7 @@ int
md_pre_update(void) md_pre_update(void)
{ {
if (get_ramsize() < 6) if (get_ramsize() < 6)
set_swap(diskdev, NULL); set_swap(pm->diskdev, NULL);
return 1; return 1;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:46 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -68,7 +68,7 @@ md_get_info(void)
int fd; int fd;
char dev_name[100]; char dev_name[100];
snprintf(dev_name, sizeof(dev_name), "/dev/r%sc", diskdev); snprintf(dev_name, sizeof(dev_name), "/dev/r%sc", pm->diskdev);
fd = open(dev_name, O_RDONLY, 0); fd = open(dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -84,21 +84,21 @@ md_get_info(void)
} }
close(fd); close(fd);
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlcylsize = disklabel.d_secpercyl; pm->dlcylsize = disklabel.d_secpercyl;
/* /*
* Compute whole disk size. Take max of (dlcyl*dlhead*dlsec) * Compute whole disk size. Take max of (pm->dlcyl*pm->dlhead*pm->dlsec)
* and secperunit, just in case the disk is already labelled. * and secperunit, just in case the disk is already labelled.
* (If our new label's RAW_PART size ends up smaller than the * (If our new label's RAW_PART size ends up smaller than the
* in-core RAW_PART size value, updating the label will fail.) * in-core RAW_PART size value, updating the label will fail.)
*/ */
dlsize = dlcyl * dlhead * dlsec; pm->dlsize = pm->dlcyl * pm->dlhead * pm->dlsec;
if (disklabel.d_secperunit > dlsize) if (disklabel.d_secperunit > pm->dlsize)
dlsize = disklabel.d_secperunit; pm->dlsize = disklabel.d_secperunit;
return 1; return 1;
} }
@ -155,11 +155,11 @@ md_post_newfs(void)
{ {
const char *bootfile = "/boot"; const char *bootfile = "/boot";
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, pm->diskdev);
cp_to_target("/usr/mdec/boot", bootfile); cp_to_target("/usr/mdec/boot", bootfile);
sync(); sync();
run_program(RUN_DISPLAY, "/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); pm->diskdev, "/usr/mdec/bootxx", bootfile);
return 0; return 0;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:46 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -67,7 +67,7 @@ md_get_info(void)
int fd; int fd;
char dev_name[100]; char dev_name[100];
snprintf (dev_name, 100, "/dev/r%sc", diskdev); snprintf (dev_name, 100, "/dev/r%sc", pm->diskdev);
fd = open (dev_name, O_RDONLY, 0); fd = open (dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -83,21 +83,21 @@ md_get_info(void)
} }
close(fd); close(fd);
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlcylsize = disklabel.d_secpercyl; pm->dlcylsize = disklabel.d_secpercyl;
/* /*
* Compute whole disk size. Take max of (dlcyl*dlhead*dlsec) * Compute whole disk size. Take max of (pm->dlcyl*pm->dlhead*pm->dlsec)
* and secperunit, just in case the disk is already labelled. * and secperunit, just in case the disk is already labelled.
* (If our new label's RAW_PART size ends up smaller than the * (If our new label's RAW_PART size ends up smaller than the
* in-core RAW_PART size value, updating the label will fail.) * in-core RAW_PART size value, updating the label will fail.)
*/ */
dlsize = dlcyl*dlhead*dlsec; pm->dlsize = pm->dlcyl*pm->dlhead*pm->dlsec;
if (disklabel.d_secperunit > dlsize) if (disklabel.d_secperunit > pm->dlsize)
dlsize = disklabel.d_secperunit; pm->dlsize = disklabel.d_secperunit;
return 1; return 1;
} }
@ -150,11 +150,11 @@ md_post_newfs()
{ {
const char *bootfile = "/boot"; const char *bootfile = "/boot";
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, pm->diskdev);
cp_to_target("/usr/mdec/boot", bootfile); cp_to_target("/usr/mdec/boot", bootfile);
sync(); sync();
run_program(RUN_DISPLAY, "/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); pm->diskdev, "/usr/mdec/bootxx", bootfile);
return 0; return 0;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:46 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -105,24 +105,24 @@ md_make_bsd_partitions(void)
* So just use what we have got. * So just use what we have got.
*/ */
for (part = 0; part < maxpart; part++) { for (part = 0; part < maxpart; part++) {
if (PI_ISBSDFS(&bsdlabel[part])) { if (PI_ISBSDFS(&pm->bsdlabel[part])) {
bsdlabel[part].pi_flags |= pm->bsdlabel[part].pi_flags |=
PIF_NEWFS | PIF_MOUNT; PIF_NEWFS | PIF_MOUNT;
if (part == PART_A) if (part == PART_A)
strcpy(bsdlabel[part].pi_mount, "/"); strcpy(pm->bsdlabel[part].pi_mount, "/");
} }
} }
part_bsd = part_raw = getrawpartition(); part_bsd = part_raw = getrawpartition();
if (part_raw == -1) if (part_raw == -1)
part_raw = PART_C; /* for sanity... */ part_raw = PART_C; /* for sanity... */
bsdlabel[part_raw].pi_offset = 0; pm->bsdlabel[part_raw].pi_offset = 0;
bsdlabel[part_raw].pi_size = dlsize; pm->bsdlabel[part_raw].pi_size = pm->dlsize;
set_sizemultname_meg(); set_sizemultname_meg();
rdb_edit_check: rdb_edit_check:
if (edit_and_check_label(bsdlabel, maxpart, part_raw, if (edit_and_check_label(pm->bsdlabel, maxpart, part_raw,
part_bsd) == 0) { part_bsd) == 0) {
msg_display(MSG_abort); msg_display(MSG_abort);
return 0; return 0;
@ -137,72 +137,72 @@ rdb_edit_check:
* Initialize global variables that track space used on this disk. * Initialize global variables that track space used on this disk.
* Standard 4.4BSD 8-partition labels always cover whole disk. * Standard 4.4BSD 8-partition labels always cover whole disk.
*/ */
if (ptsize == 0) if (pm->ptsize == 0)
ptsize = dlsize - ptstart; pm->ptsize = pm->dlsize - pm->ptstart;
if (dlsize == 0) if (pm->dlsize == 0)
dlsize = ptstart + ptsize; pm->dlsize = pm->ptstart + pm->ptsize;
partstart = ptstart; partstart = pm->ptstart;
ptend = ptstart + ptsize; ptend = pm->ptstart + pm->ptsize;
/* Ask for layout type -- standard or special */ /* Ask for layout type -- standard or special */
msg_display(MSG_layout, msg_display(MSG_layout,
ptsize / (MEG / sectorsize), pm->ptsize / (MEG / pm->sectorsize),
DEFROOTSIZE + DEFSWAPSIZE + DEFUSRSIZE, DEFROOTSIZE + DEFSWAPSIZE + DEFUSRSIZE,
DEFROOTSIZE + DEFSWAPSIZE + DEFUSRSIZE + XNEEDMB); DEFROOTSIZE + DEFSWAPSIZE + DEFUSRSIZE + XNEEDMB);
process_menu(MENU_layout, NULL); process_menu(MENU_layout, NULL);
/* Set so we use the 'real' geometry for rounding, input in MB */ /* Set so we use the 'real' geometry for rounding, input in MB */
current_cylsize = dlcylsize; pm->current_cylsize = pm->dlcylsize;
set_sizemultname_meg(); set_sizemultname_meg();
/* Build standard partitions */ /* Build standard partitions */
memset(&bsdlabel, 0, sizeof bsdlabel); memset(&pm->bsdlabel, 0, sizeof pm->bsdlabel);
/* Set initial partition types to unused */ /* Set initial partition types to unused */
for (part = 0 ; part < maxpart ; ++part) for (part = 0 ; part < maxpart ; ++part)
bsdlabel[part].pi_fstype = FS_UNUSED; pm->bsdlabel[part].pi_fstype = FS_UNUSED;
/* Whole disk partition */ /* Whole disk partition */
part_raw = getrawpartition(); part_raw = getrawpartition();
if (part_raw == -1) if (part_raw == -1)
part_raw = PART_C; /* for sanity... */ part_raw = PART_C; /* for sanity... */
bsdlabel[part_raw].pi_offset = 0; pm->bsdlabel[part_raw].pi_offset = 0;
bsdlabel[part_raw].pi_size = dlsize; pm->bsdlabel[part_raw].pi_size = pm->dlsize;
if (part_raw == PART_D) { if (part_raw == PART_D) {
/* Probably a system that expects an i386 style mbr */ /* Probably a system that expects an i386 style mbr */
part_bsd = PART_C; part_bsd = PART_C;
bsdlabel[PART_C].pi_offset = ptstart; pm->bsdlabel[PART_C].pi_offset = pm->ptstart;
bsdlabel[PART_C].pi_size = ptsize; pm->bsdlabel[PART_C].pi_size = pm->ptsize;
} else { } else {
part_bsd = part_raw; part_bsd = part_raw;
} }
if (bootsize != 0) { if (pm->bootsize != 0) {
bsdlabel[PART_BOOT_FAT12].pi_fstype = FS_MSDOS; pm->bsdlabel[PART_BOOT_FAT12].pi_fstype = FS_MSDOS;
bsdlabel[PART_BOOT_FAT12].pi_size = bootsize; pm->bsdlabel[PART_BOOT_FAT12].pi_size = pm->bootsize;
bsdlabel[PART_BOOT_FAT12].pi_offset = bootstart; pm->bsdlabel[PART_BOOT_FAT12].pi_offset = pm->bootstart;
bsdlabel[PART_BOOT_FAT12].pi_flags |= PART_BOOT_FAT12_PI_FLAGS; pm->bsdlabel[PART_BOOT_FAT12].pi_flags |= PART_BOOT_FAT12_PI_FLAGS;
strlcpy(bsdlabel[PART_BOOT_FAT12].pi_mount, strlcpy(pm->bsdlabel[PART_BOOT_FAT12].pi_mount,
PART_BOOT_FAT12_PI_MOUNT, PART_BOOT_FAT12_PI_MOUNT,
sizeof bsdlabel[PART_BOOT_FAT12].pi_mount); sizeof pm->bsdlabel[PART_BOOT_FAT12].pi_mount);
} }
if (binfosize != 0) { if (binfosize != 0) {
bsdlabel[PART_BOOT_BINFO].pi_fstype = FS_OTHER; pm->bsdlabel[PART_BOOT_BINFO].pi_fstype = FS_OTHER;
bsdlabel[PART_BOOT_BINFO].pi_size = binfosize; pm->bsdlabel[PART_BOOT_BINFO].pi_size = binfosize;
bsdlabel[PART_BOOT_BINFO].pi_offset = binfostart; pm->bsdlabel[PART_BOOT_BINFO].pi_offset = binfostart;
} }
if (bprepsize != 0) { if (bprepsize != 0) {
bsdlabel[PART_BOOT_PREP].pi_fstype = FS_BOOT; pm->bsdlabel[PART_BOOT_PREP].pi_fstype = FS_BOOT;
bsdlabel[PART_BOOT_PREP].pi_size = bprepsize; pm->bsdlabel[PART_BOOT_PREP].pi_size = bprepsize;
bsdlabel[PART_BOOT_PREP].pi_offset = bprepstart; pm->bsdlabel[PART_BOOT_PREP].pi_offset = bprepstart;
} }
#ifdef PART_REST #ifdef PART_REST
bsdlabel[PART_REST].pi_offset = 0; pm->bsdlabel[PART_REST].pi_offset = 0;
bsdlabel[PART_REST].pi_size = ptstart; pm->bsdlabel[PART_REST].pi_size = pm->ptstart;
#endif #endif
/* /*
@ -212,27 +212,27 @@ rdb_edit_check:
* partitions on a multiboot i386 system. * partitions on a multiboot i386 system.
*/ */
for (i = maxpart; i--;) { for (i = maxpart; i--;) {
if (bsdlabel[i].pi_size != 0) if (pm->bsdlabel[i].pi_size != 0)
/* Don't overwrite special partitions */ /* Don't overwrite special partitions */
continue; continue;
p = &oldlabel[i]; p = &pm->oldlabel[i];
if (p->pi_fstype == FS_UNUSED || p->pi_size == 0) if (p->pi_fstype == FS_UNUSED || p->pi_size == 0)
continue; continue;
if (layoutkind == 4) { if (layoutkind == LY_USEEXIST) {
if (PI_ISBSDFS(p)) if (PI_ISBSDFS(p))
p->pi_flags |= PIF_MOUNT; p->pi_flags |= PIF_MOUNT;
} else { } else {
if (p->pi_offset < ptstart + ptsize && if (p->pi_offset < pm->ptstart + pm->ptsize &&
p->pi_offset + p->pi_size > ptstart) p->pi_offset + p->pi_size > pm->ptstart)
/* Not outside area we are allocating */ /* Not outside area we are allocating */
continue; continue;
if (p->pi_fstype == FS_SWAP) if (p->pi_fstype == FS_SWAP)
no_swap = 1; no_swap = 1;
} }
bsdlabel[i] = oldlabel[i]; pm->bsdlabel[i] = pm->oldlabel[i];
} }
if (layoutkind == 4) { if (layoutkind == LY_USEEXIST) {
/* XXX Check we have a sensible layout */ /* XXX Check we have a sensible layout */
; ;
} else } else
@ -243,7 +243,7 @@ rdb_edit_check:
* edit it and verify it's OK, or abort altogether. * edit it and verify it's OK, or abort altogether.
*/ */
edit_check: edit_check:
if (edit_and_check_label(bsdlabel, maxpart, part_raw, part_bsd) == 0) { if (edit_and_check_label(pm->bsdlabel, maxpart, part_raw, part_bsd) == 0) {
msg_display(MSG_abort); msg_display(MSG_abort);
return 0; return 0;
} }
@ -251,10 +251,10 @@ rdb_edit_check:
goto edit_check; goto edit_check;
/* Disk name */ /* Disk name */
msg_prompt(MSG_packname, bsddiskname, bsddiskname, sizeof bsddiskname); msg_prompt(MSG_packname, pm->bsddiskname, pm->bsddiskname, sizeof pm->bsddiskname);
/* save label to disk for MI code to update. */ /* save label to disk for MI code to update. */
(void) savenewlabel(bsdlabel, maxpart); (void) savenewlabel(pm->bsdlabel, maxpart);
/* Everything looks OK. */ /* Everything looks OK. */
return 1; return 1;
@ -277,13 +277,13 @@ md_check_partitions(void)
* from the MBR partition. * from the MBR partition.
*/ */
for (part = PART_A; part < MAXPARTITIONS; part++) { for (part = PART_A; part < MAXPARTITIONS; part++) {
if (bsdlabel[part].pi_fstype == FS_MSDOS) { if (pm->bsdlabel[part].pi_fstype == FS_MSDOS) {
bootpart_fat12 = part; bootpart_fat12 = part;
ffat++; ffat++;
} else if (bsdlabel[part].pi_fstype == FS_BOOT) { } else if (pm->bsdlabel[part].pi_fstype == FS_BOOT) {
bootpart_prep = part; bootpart_prep = part;
fprep++; fprep++;
} else if (bsdlabel[part].pi_fstype == FS_OTHER) { } else if (pm->bsdlabel[part].pi_fstype == FS_OTHER) {
bootpart_binfo = part; bootpart_binfo = part;
fprep++; fprep++;
} }
@ -314,7 +314,7 @@ md_pre_disklabel(void)
msg_display(MSG_dofdisk); msg_display(MSG_dofdisk);
/* write edited MBR onto disk. */ /* write edited MBR onto disk. */
if (write_mbr(diskdev, &mbr, 1) != 0) { if (write_mbr(pm->diskdev, &mbr, 1) != 0) {
msg_display(MSG_wmbrfail); msg_display(MSG_wmbrfail);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return 1; return 1;
@ -330,10 +330,10 @@ md_post_disklabel(void)
{ {
char bootdev[100]; char bootdev[100];
if (bootstart == 0 || bootsize == 0 || rdb_found) if (pm->bootstart == 0 || pm->bootsize == 0 || rdb_found)
return 0; return 0;
snprintf(bootdev, sizeof bootdev, "/dev/r%s%c", diskdev, snprintf(bootdev, sizeof bootdev, "/dev/r%s%c", pm->diskdev,
'a'+bootpart_fat12); 'a'+bootpart_fat12);
run_program(RUN_DISPLAY, "/sbin/newfs_msdos %s", bootdev); run_program(RUN_DISPLAY, "/sbin/newfs_msdos %s", bootdev);
@ -380,18 +380,18 @@ md_post_extract(void)
} }
if (!noprepfix) { if (!noprepfix) {
snprintf(bootdev, sizeof bootdev, "/dev/r%s%c", diskdev, snprintf(bootdev, sizeof bootdev, "/dev/r%s%c", pm->diskdev,
'a'+bootpart_prep); 'a'+bootpart_prep);
snprintf(bootbdev, sizeof bootbdev, "/dev/%s%c", diskdev, snprintf(bootbdev, sizeof bootbdev, "/dev/%s%c", pm->diskdev,
'a'+bootpart_prep); 'a'+bootpart_prep);
run_program(RUN_DISPLAY, "/bin/dd if=/dev/zero of=%s bs=512", run_program(RUN_DISPLAY, "/bin/dd if=/dev/zero of=%s bs=512",
bootdev); bootdev);
run_program(RUN_DISPLAY, "/bin/dd if=/usr/mdec/ofwboot " run_program(RUN_DISPLAY, "/bin/dd if=/usr/mdec/ofwboot "
"of=%s bs=512", bootbdev); "of=%s bs=512", bootbdev);
snprintf(bootdev, sizeof bootdev, "/dev/r%s%c", diskdev, snprintf(bootdev, sizeof bootdev, "/dev/r%s%c", pm->diskdev,
'a'+bootpart_binfo); 'a'+bootpart_binfo);
snprintf(bootbdev, sizeof bootbdev, "/dev/%s%c", diskdev, snprintf(bootbdev, sizeof bootbdev, "/dev/%s%c", pm->diskdev,
'a'+bootpart_binfo); 'a'+bootpart_binfo);
run_program(RUN_DISPLAY, "/bin/dd if=/dev/zero of=%s bs=512", run_program(RUN_DISPLAY, "/bin/dd if=/dev/zero of=%s bs=512",
bootdev); bootdev);
@ -421,7 +421,7 @@ md_pre_update(void)
if (check_rdb()) if (check_rdb())
return 1; return 1;
read_mbr(diskdev, &mbr); read_mbr(pm->diskdev, &mbr);
/* do a sanity check of the partition table */ /* do a sanity check of the partition table */
for (ext = &mbr; ext; ext = ext->extended) { for (ext = &mbr; ext; ext = ext->extended) {
part = ext->mbr.mbr_parts; part = ext->mbr.mbr_parts;
@ -474,8 +474,8 @@ md_check_mbr(mbr_info_t *mbri)
part = ext->mbr.mbr_parts; part = ext->mbr.mbr_parts;
for (i = 0; i < MBR_PART_COUNT; part++, i++) { for (i = 0; i < MBR_PART_COUNT; part++, i++) {
if (part->mbrp_type == MBR_PTYPE_FAT12) { if (part->mbrp_type == MBR_PTYPE_FAT12) {
bootstart = part->mbrp_start; pm->bootstart = part->mbrp_start;
bootsize = part->mbrp_size; pm->bootsize = part->mbrp_size;
} else if (part->mbrp_type == MBR_PTYPE_PREP && } else if (part->mbrp_type == MBR_PTYPE_PREP &&
part->mbrp_size < 50) { part->mbrp_size < 50) {
/* this is the bootinfo partition */ /* this is the bootinfo partition */
@ -493,7 +493,7 @@ md_check_mbr(mbr_info_t *mbri)
/* we need to either have a pair of prep partitions, or a single /* we need to either have a pair of prep partitions, or a single
* fat. if neither, things are broken. */ * fat. if neither, things are broken. */
if (!(bootsize >= (MIN_FAT12_BOOT/512) || if (!(pm->bootsize >= (MIN_FAT12_BOOT/512) ||
(binfosize >= (MIN_BINFO_BOOT/512) && (binfosize >= (MIN_BINFO_BOOT/512) &&
bprepsize >= (MIN_PREP_BOOT/512)))) { bprepsize >= (MIN_PREP_BOOT/512)))) {
msg_display(MSG_bootnotright); msg_display(MSG_bootnotright);
@ -517,7 +517,7 @@ md_check_mbr(mbr_info_t *mbri)
} }
/* check the fat12 parititons */ /* check the fat12 parititons */
if (bootsize > 0 && bootsize < (MIN_FAT12_BOOT/512)) { if (pm->bootsize > 0 && pm->bootsize < (MIN_FAT12_BOOT/512)) {
msg_display(MSG_boottoosmall); msg_display(MSG_boottoosmall);
msg_display_add(MSG_reeditpart, 0); msg_display_add(MSG_reeditpart, 0);
process_menu(MENU_yesno, NULL); process_menu(MENU_yesno, NULL);
@ -527,7 +527,7 @@ md_check_mbr(mbr_info_t *mbri)
} }
/* if both sets contain zero, thats bad */ /* if both sets contain zero, thats bad */
if ((bootstart == 0 || bootsize == 0) && if ((pm->bootstart == 0 || pm->bootsize == 0) &&
(binfosize == 0 || binfostart == 0 || (binfosize == 0 || binfostart == 0 ||
bprepsize == 0 || bprepstart == 0)) { bprepsize == 0 || bprepstart == 0)) {
msg_display(MSG_nobootpart); msg_display(MSG_nobootpart);
@ -571,7 +571,7 @@ md_mbr_use_wholedisk(mbr_info_t *mbri)
part[0].mbrp_flag = 0; part[0].mbrp_flag = 0;
part[1].mbrp_type = MBR_PTYPE_NETBSD; part[1].mbrp_type = MBR_PTYPE_NETBSD;
part[1].mbrp_size = dlsize - (bsec + FAT12_BOOT_SIZE/512 + part[1].mbrp_size = pm->dlsize - (bsec + FAT12_BOOT_SIZE/512 +
BINFO_BOOT_SIZE/512 + PREP_BOOT_SIZE/512); BINFO_BOOT_SIZE/512 + PREP_BOOT_SIZE/512);
part[1].mbrp_start = bsec + FAT12_BOOT_SIZE/512 + BINFO_BOOT_SIZE/512 + part[1].mbrp_start = bsec + FAT12_BOOT_SIZE/512 + BINFO_BOOT_SIZE/512 +
PREP_BOOT_SIZE/512; PREP_BOOT_SIZE/512;
@ -587,10 +587,10 @@ md_mbr_use_wholedisk(mbr_info_t *mbri)
part[3].mbrp_start = bsec + FAT12_BOOT_SIZE/512 + BINFO_BOOT_SIZE/512; part[3].mbrp_start = bsec + FAT12_BOOT_SIZE/512 + BINFO_BOOT_SIZE/512;
part[3].mbrp_flag = 0; part[3].mbrp_flag = 0;
ptstart = part[1].mbrp_start; pm->ptstart = part[1].mbrp_start;
ptsize = part[1].mbrp_size; pm->ptsize = part[1].mbrp_size;
bootstart = part[0].mbrp_start; pm->bootstart = part[0].mbrp_start;
bootsize = part[0].mbrp_size; pm->bootsize = part[0].mbrp_size;
binfostart = part[2].mbrp_start; binfostart = part[2].mbrp_start;
binfosize= part[2].mbrp_size; binfosize= part[2].mbrp_size;
bprepstart = part[3].mbrp_start; bprepstart = part[3].mbrp_start;
@ -620,7 +620,7 @@ check_rdb(void)
/* Find out if this disk has a valid RDB, before continuing. */ /* Find out if this disk has a valid RDB, before continuing. */
rdb = (struct rdblock *)buf; rdb = (struct rdblock *)buf;
fd = opendisk(diskdev, O_RDONLY, diskpath, sizeof(diskpath), 0); fd = opendisk(pm->diskdev, O_RDONLY, diskpath, sizeof(diskpath), 0);
if (fd < 0) if (fd < 0)
return 0; return 0;
for (blk = 0; blk < RDB_MAXBLOCKS; blk++) { for (blk = 0; blk < RDB_MAXBLOCKS; blk++) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:46 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -65,9 +65,9 @@ md_get_info(void)
int cyl, head; int cyl, head;
daddr_t sec; daddr_t sec;
read_mbr(diskdev, &mbr); read_mbr(pm->diskdev, &mbr);
msg_display(MSG_nobiosgeom, dlcyl, dlhead, dlsec); msg_display(MSG_nobiosgeom, pm->dlcyl, pm->dlhead, pm->dlsec);
if (guess_biosgeom_from_mbr(&mbr, &cyl, &head, &sec) >= 0) if (guess_biosgeom_from_mbr(&mbr, &cyl, &head, &sec) >= 0)
msg_display_add(MSG_biosguess, cyl, head, sec); msg_display_add(MSG_biosguess, cyl, head, sec);
@ -105,7 +105,7 @@ md_pre_disklabel(void)
msg_display(MSG_dofdisk); msg_display(MSG_dofdisk);
/* write edited MBR onto disk. */ /* write edited MBR onto disk. */
if (write_mbr(diskdev, &mbr, 1) != 0) { if (write_mbr(pm->diskdev, &mbr, 1) != 0) {
msg_display(MSG_wmbrfail); msg_display(MSG_wmbrfail);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
@ -122,10 +122,10 @@ int
md_post_disklabel(void) md_post_disklabel(void)
{ {
/* Sector forwarding / badblocks ... */ /* Sector forwarding / badblocks ... */
if (*doessf) { if (*pm->doessf) {
msg_display(MSG_dobad144); msg_display(MSG_dobad144);
return (run_program(RUN_DISPLAY, "/usr/sbin/bad144 %s 0", return (run_program(RUN_DISPLAY, "/usr/sbin/bad144 %s 0",
diskdev)); pm->diskdev));
} }
return 0; return 0;
@ -181,3 +181,10 @@ md_mbr_use_wholedisk(mbr_info_t *mbri)
{ {
return mbr_use_wholedisk(mbri); return mbr_use_wholedisk(mbri);
} }
int
md_pre_mount()
{
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.de,v 1.1 2014/07/26 19:30:46 dholland Exp $ */ /* $NetBSD: msg.md.de,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -42,6 +42,11 @@ message md_hello
{ {
} }
message md_may_remove_boot_medium
{Wenn Sie von einer Diskette gebootet haben, können Sie diese jetzt
enfernen.
}
message dobad144 message dobad144
{Installiere die Tabelle der defekten Blöcke ... {Installiere die Tabelle der defekten Blöcke ...
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.en,v 1.1 2014/07/26 19:30:46 dholland Exp $ */ /* $NetBSD: msg.md.en,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -42,6 +42,10 @@ message md_hello
{ {
} }
message md_may_remove_boot_medium
{If you booted from a floppy, you may now remove the disk.
}
message dobad144 message dobad144
{Installing the bad block table ... {Installing the bad block table ...
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.es,v 1.1 2014/07/26 19:30:46 dholland Exp $ */ /* $NetBSD: msg.md.es,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -42,6 +42,10 @@ message md_hello
{ {
} }
message md_may_remove_boot_medium
{Si ha iniciado desde disquette, ahora debería retirar el disco.
}
message dobad144 message dobad144
{Instalando la tabla de bloques malos ... {Instalando la tabla de bloques malos ...
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.fr,v 1.1 2014/07/26 19:30:46 dholland Exp $ */ /* $NetBSD: msg.md.fr,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -42,6 +42,10 @@ message md_hello
{ {
} }
message md_may_remove_boot_medium
{Si vous avez démarré sur une disquette, vous pouvez maintenant la retirer.
}
message dobad144 message dobad144
{Installation de la table des blocs défectueux ... {Installation de la table des blocs défectueux ...
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.md.pl,v 1.1 2014/07/26 19:30:46 dholland Exp $ */ /* $NetBSD: msg.md.pl,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* Based on english version: */ /* Based on english version: */
/* NetBSD: msg.md.en,v 1.1 2001/10/15 16:22:52 uch Exp */ /* NetBSD: msg.md.en,v 1.1 2001/10/15 16:22:52 uch Exp */
@ -44,6 +44,10 @@ message md_hello
{ {
} }
message md_may_remove_boot_medium
{Jesli uruchomiles komputer z dyskietki, mozesz ja teraz wyciagnac.
}
message dobad144 message dobad144
{Instalowanie tablicy zlych blokow ... {Instalowanie tablicy zlych blokow ...
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:46 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -66,7 +66,7 @@ md_get_info(void)
int fd; int fd;
char dev_name[100]; char dev_name[100];
snprintf(dev_name, 100, "/dev/r%sc", diskdev); snprintf(dev_name, 100, "/dev/r%sc", pm->diskdev);
fd = open(dev_name, O_RDONLY, 0); fd = open(dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -87,21 +87,21 @@ md_get_info(void)
} }
close(fd); close(fd);
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlcylsize = disklabel.d_secpercyl; pm->dlcylsize = disklabel.d_secpercyl;
/* /*
* Compute whole disk size. Take max of (dlcyl*dlhead*dlsec) * Compute whole disk size. Take max of (pm->dlcyl*pm->dlhead*pm->dlsec)
* and secperunit, just in case the disk is already labelled. * and secperunit, just in case the disk is already labelled.
* (If our new label's RAW_PART size ends up smaller than the * (If our new label's RAW_PART size ends up smaller than the
* in-core RAW_PART size value, updating the label will fail.) * in-core RAW_PART size value, updating the label will fail.)
*/ */
dlsize = dlcyl*dlhead*dlsec; pm->dlsize = pm->dlcyl*pm->dlhead*pm->dlsec;
if (disklabel.d_secperunit > dlsize) if (disklabel.d_secperunit > pm->dlsize)
dlsize = disklabel.d_secperunit; pm->dlsize = disklabel.d_secperunit;
return 1; return 1;
} }
@ -161,12 +161,12 @@ md_post_newfs(void)
return 0; return 0;
} }
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, pm->diskdev);
cp_to_target("/usr/mdec/boot.pmax", "/boot.pmax"); cp_to_target("/usr/mdec/boot.pmax", "/boot.pmax");
bootxx = bootxx_name(); bootxx = bootxx_name();
if (bootxx != NULL) { if (bootxx != NULL) {
error = run_program(RUN_DISPLAY | RUN_NO_CLEAR, error = run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/sbin/installboot /dev/r%sc %s", diskdev, bootxx); "/usr/sbin/installboot /dev/r%sc %s", pm->diskdev, bootxx);
free(bootxx); free(bootxx);
} else } else
error = -1; error = -1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:46 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -87,7 +87,7 @@ md_check_partitions(void)
* something stupid, like move it away from the MBR partition. * something stupid, like move it away from the MBR partition.
*/ */
for (part = PART_A; part < MAXPARTITIONS; part++) for (part = PART_A; part < MAXPARTITIONS; part++)
if (bsdlabel[part].pi_fstype == FS_BOOT) { if (pm->bsdlabel[part].pi_fstype == FS_BOOT) {
prep_bootpart = part; prep_bootpart = part;
return 1; return 1;
} }
@ -106,7 +106,7 @@ md_pre_disklabel(void)
msg_display(MSG_dofdisk); msg_display(MSG_dofdisk);
/* write edited MBR onto disk. */ /* write edited MBR onto disk. */
if (write_mbr(diskdev, &mbr, 1) != 0) { if (write_mbr(pm->diskdev, &mbr, 1) != 0) {
msg_display(MSG_wmbrfail); msg_display(MSG_wmbrfail);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return 1; return 1;
@ -149,8 +149,8 @@ md_post_extract(void)
else else
snprintf(bootloader, 100, "/usr/mdec/boot"); snprintf(bootloader, 100, "/usr/mdec/boot");
snprintf(rawdev, 100, "/dev/r%s%c", diskdev, 'a' + getrawpartition()); snprintf(rawdev, 100, "/dev/r%s%c", pm->diskdev, 'a' + getrawpartition());
snprintf(bootpart, 100, "/dev/r%s%c", diskdev, 'a' + prep_bootpart); snprintf(bootpart, 100, "/dev/r%s%c", pm->diskdev, 'a' + prep_bootpart);
if (prep_rawdevfix) if (prep_rawdevfix)
run_program(RUN_DISPLAY|RUN_CHROOT, run_program(RUN_DISPLAY|RUN_CHROOT,
"/usr/mdec/mkbootimage -b %s -k /netbsd " "/usr/mdec/mkbootimage -b %s -k /netbsd "
@ -181,7 +181,7 @@ md_pre_update(void)
mbr_info_t *ext; mbr_info_t *ext;
int i; int i;
read_mbr(diskdev, &mbr); read_mbr(pm->diskdev, &mbr);
/* do a sanity check of the partition table */ /* do a sanity check of the partition table */
for (ext = &mbr; ext; ext = ext->extended) { for (ext = &mbr; ext; ext = ext->extended) {
part = ext->mbr.mbr_parts; part = ext->mbr.mbr_parts;
@ -225,12 +225,12 @@ md_check_mbr(mbr_info_t *mbri)
for (i = 0; i < MBR_PART_COUNT; part++, i++) { for (i = 0; i < MBR_PART_COUNT; part++, i++) {
if (part->mbrp_type != MBR_PTYPE_PREP) if (part->mbrp_type != MBR_PTYPE_PREP)
continue; continue;
bootstart = part->mbrp_start; pm->bootstart = part->mbrp_start;
bootsize = part->mbrp_size; pm->bootsize = part->mbrp_size;
break; break;
} }
} }
if (bootsize < (MIN_PREP_BOOT/512)) { if (pm->bootsize < (MIN_PREP_BOOT/512)) {
msg_display(MSG_preptoosmall); msg_display(MSG_preptoosmall);
msg_display_add(MSG_reeditpart, 0); msg_display_add(MSG_reeditpart, 0);
process_menu(MENU_yesno, NULL); process_menu(MENU_yesno, NULL);
@ -238,7 +238,7 @@ md_check_mbr(mbr_info_t *mbri)
return 0; return 0;
return 1; return 1;
} }
if (bootstart == 0 || bootsize == 0) { if (pm->bootstart == 0 || pm->bootsize == 0) {
msg_display(MSG_nopreppart); msg_display(MSG_nopreppart);
msg_display_add(MSG_reeditpart, 0); msg_display_add(MSG_reeditpart, 0);
process_menu(MENU_yesno, NULL); process_menu(MENU_yesno, NULL);
@ -272,14 +272,14 @@ md_mbr_use_wholedisk(mbr_info_t *mbri)
part[0].mbrp_flag = MBR_PFLAG_ACTIVE; part[0].mbrp_flag = MBR_PFLAG_ACTIVE;
part[1].mbrp_type = MBR_PTYPE_NETBSD; part[1].mbrp_type = MBR_PTYPE_NETBSD;
part[1].mbrp_size = dlsize - (bsec + PREP_BOOT_SIZE/512); part[1].mbrp_size = pm->dlsize - (bsec + PREP_BOOT_SIZE/512);
part[1].mbrp_start = bsec + PREP_BOOT_SIZE/512; part[1].mbrp_start = bsec + PREP_BOOT_SIZE/512;
part[1].mbrp_flag = 0; part[1].mbrp_flag = 0;
ptstart = part[1].mbrp_start; pm->ptstart = part[1].mbrp_start;
ptsize = part[1].mbrp_size; pm->ptsize = part[1].mbrp_size;
bootstart = part[0].mbrp_start; pm->bootstart = part[0].mbrp_start;
bootsize = part[0].mbrp_size; pm->bootsize = part[0].mbrp_size;
return 1; return 1;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:47 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -122,7 +122,7 @@ md_pre_disklabel(void)
printf ("%s", msg_string (MSG_dofdisk)); printf ("%s", msg_string (MSG_dofdisk));
/* write edited MBR onto disk. */ /* write edited MBR onto disk. */
if (write_mbr(diskdev, &mbr, 1) != 0) { if (write_mbr(pm->diskdev, &mbr, 1) != 0) {
msg_display(MSG_wmbrfail); msg_display(MSG_wmbrfail);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return 1; return 1;
@ -137,10 +137,10 @@ int
md_post_disklabel(void) md_post_disklabel(void)
{ {
/* Sector forwarding / badblocks ... */ /* Sector forwarding / badblocks ... */
if (*doessf) { if (*pm->doessf) {
printf ("%s", msg_string (MSG_dobad144)); printf ("%s", msg_string (MSG_dobad144));
return run_program(RUN_DISPLAY, "/usr/sbin/bad144 %s 0", return run_program(RUN_DISPLAY, "/usr/sbin/bad144 %s 0",
diskdev); pm->diskdev);
} }
return 0; return 0;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:47 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -83,7 +83,7 @@ md_get_info(void)
int fd; int fd;
char dev_name[100]; char dev_name[100];
snprintf(dev_name, 100, "/dev/r%s%c", diskdev, 'a' + getrawpartition()); snprintf(dev_name, 100, "/dev/r%s%c", pm->diskdev, 'a' + getrawpartition());
fd = open(dev_name, O_RDONLY, 0); fd = open(dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -104,21 +104,21 @@ md_get_info(void)
} }
close(fd); close(fd);
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlcylsize = disklabel.d_secpercyl; pm->dlcylsize = disklabel.d_secpercyl;
/* /*
* Compute whole disk size. Take max of (dlcyl*dlhead*dlsec) * Compute whole disk size. Take max of (pm->dlcyl*pm->dlhead*pm->dlsec)
* and secperunit, just in case the disk is already labelled. * and secperunit, just in case the disk is already labelled.
* (If our new label's RAW_PART size ends up smaller than the * (If our new label's RAW_PART size ends up smaller than the
* in-core RAW_PART size value, updating the label will fail.) * in-core RAW_PART size value, updating the label will fail.)
*/ */
dlsize = dlcyl*dlhead*dlsec; pm->dlsize = pm->dlcyl*pm->dlhead*pm->dlsec;
if (disklabel.d_secperunit > dlsize) if (disklabel.d_secperunit > pm->dlsize)
dlsize = disklabel.d_secperunit; pm->dlsize = disklabel.d_secperunit;
return 1; return 1;
} }
@ -156,19 +156,19 @@ md_pre_disklabel(void)
int int
md_post_disklabel(void) md_post_disklabel(void)
{ {
set_swap(diskdev, bsdlabel); set_swap(pm->diskdev, pm->bsdlabel);
if (strstr(instsys.version, "(INSTALL32_IP3x)")) if (strstr(instsys.version, "(INSTALL32_IP3x)"))
return run_program(RUN_DISPLAY, return run_program(RUN_DISPLAY,
"%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip3xboot", "%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip3xboot",
diskdev); pm->diskdev);
if (strstr(instsys.version, "(INSTALL32_IP2x)")) { if (strstr(instsys.version, "(INSTALL32_IP2x)")) {
run_program(RUN_DISPLAY, run_program(RUN_DISPLAY,
"%s %s", "/usr/mdec/sgivol -f -w aoutboot /usr/mdec/aoutboot", "%s %s", "/usr/mdec/sgivol -f -w aoutboot /usr/mdec/aoutboot",
diskdev); pm->diskdev);
return run_program(RUN_DISPLAY, return run_program(RUN_DISPLAY,
"%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip2xboot", "%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip2xboot",
diskdev); pm->diskdev);
} }
/* Presumably an IP12, we add the boot code later... */ /* Presumably an IP12, we add the boot code later... */
@ -201,7 +201,7 @@ md_cleanup_install(void)
if (strstr(instsys.version, "(GENERIC32_IP12)")) if (strstr(instsys.version, "(GENERIC32_IP12)"))
run_program(0, "/usr/mdec/sgivol -f -w netbsd %s %s", run_program(0, "/usr/mdec/sgivol -f -w netbsd %s %s",
target_expand("/netbsd.ecoff"), diskdev); target_expand("/netbsd.ecoff"), pm->diskdev);
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:47 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:40 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -69,12 +69,12 @@ md_get_info(void)
int fd; int fd;
char dev_name[100]; char dev_name[100];
if (strncmp(diskdev, "wd", 2) == 0) if (strncmp(pm->diskdev, "wd", 2) == 0)
disktype = "ST506"; pm->disktype = "ST506";
else else
disktype = "SCSI"; pm->disktype = "SCSI";
snprintf(dev_name, 100, "/dev/r%sc", diskdev); snprintf(dev_name, 100, "/dev/r%sc", pm->diskdev);
fd = open(dev_name, O_RDONLY, 0); fd = open(dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -90,21 +90,21 @@ md_get_info(void)
} }
close(fd); close(fd);
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlcylsize = disklabel.d_secpercyl; pm->dlcylsize = disklabel.d_secpercyl;
/* /*
* Compute whole disk size. Take max of (dlcyl*dlhead*dlsec) * Compute whole disk size. Take max of (pm->dlcyl*pm->dlhead*pm->dlsec)
* and secperunit, just in case the disk is already labelled. * and secperunit, just in case the disk is already labelled.
* (If our new label's RAW_PART size ends up smaller than the * (If our new label's RAW_PART size ends up smaller than the
* in-core RAW_PART size value, updating the label will fail.) * in-core RAW_PART size value, updating the label will fail.)
*/ */
dlsize = dlcyl*dlhead*dlsec; pm->dlsize = pm->dlcyl*pm->dlhead*pm->dlsec;
if (disklabel.d_secperunit > dlsize) if (disklabel.d_secperunit > pm->dlsize)
dlsize = disklabel.d_secperunit; pm->dlsize = disklabel.d_secperunit;
return 1; return 1;
} }
@ -135,7 +135,7 @@ md_pre_disklabel(void)
{ {
char diskpath[MAXPATHLEN]; char diskpath[MAXPATHLEN];
if (clear_mbr(diskdev, diskpath, sizeof(diskpath)) == -1) { if (clear_mbr(pm->diskdev, diskpath, sizeof(diskpath)) == -1) {
msg_display(MSG_badclearmbr, diskpath); msg_display(MSG_badclearmbr, diskpath);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:47 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:41 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -72,7 +72,7 @@ md_get_info(void)
int fd; int fd;
char dev_name[100]; char dev_name[100];
snprintf(dev_name, 100, "/dev/r%s%c", diskdev, 'a' + getrawpartition()); snprintf(dev_name, 100, "/dev/r%s%c", pm->diskdev, 'a' + getrawpartition());
fd = open(dev_name, O_RDONLY, 0); fd = open(dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -93,21 +93,21 @@ md_get_info(void)
} }
close(fd); close(fd);
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlcylsize = disklabel.d_secpercyl; pm->dlcylsize = disklabel.d_secpercyl;
/* /*
* Compute whole disk size. Take max of (dlcyl*dlhead*dlsec) * Compute whole disk size. Take max of (pm->dlcyl*pm->dlhead*pm->dlsec)
* and secperunit, just in case the disk is already labelled. * and secperunit, just in case the disk is already labelled.
* (If our new label's RAW_PART size ends up smaller than the * (If our new label's RAW_PART size ends up smaller than the
* in-core RAW_PART size value, updating the label will fail.) * in-core RAW_PART size value, updating the label will fail.)
*/ */
dlsize = dlcyl*dlhead*dlsec; pm->dlsize = pm->dlcyl*pm->dlhead*pm->dlsec;
if (disklabel.d_secperunit > dlsize) if (disklabel.d_secperunit > pm->dlsize)
dlsize = disklabel.d_secperunit; pm->dlsize = disklabel.d_secperunit;
return 1; return 1;
} }
@ -160,8 +160,8 @@ md_post_newfs(void)
{ {
/* boot blocks ... */ /* boot blocks ... */
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, pm->diskdev);
return (run_program(RUN_DISPLAY, "/sbin/disklabel -W %s", diskdev) || return (run_program(RUN_DISPLAY, "/sbin/disklabel -W %s", pm->diskdev) ||
run_program(RUN_DISPLAY, "/usr/mdec/binstall ffs %s", run_program(RUN_DISPLAY, "/usr/mdec/binstall ffs %s",
targetroot_mnt)); targetroot_mnt));
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:47 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:41 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -73,7 +73,7 @@ md_get_info(void)
int fd; int fd;
char dev_name[100]; char dev_name[100];
snprintf(dev_name, 100, "/dev/r%sc", diskdev); snprintf(dev_name, 100, "/dev/r%sc", pm->diskdev);
fd = open(dev_name, O_RDONLY, 0); fd = open(dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -94,21 +94,21 @@ md_get_info(void)
} }
close(fd); close(fd);
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlcylsize = disklabel.d_secpercyl; pm->dlcylsize = disklabel.d_secpercyl;
/* /*
* Compute whole disk size. Take max of (dlcyl*dlhead*dlsec) * Compute whole disk size. Take max of (pm->dlcyl*pm->dlhead*pm->dlsec)
* and secperunit, just in case the disk is already labelled. * and secperunit, just in case the disk is already labelled.
* (If our new label's RAW_PART size ends up smaller than the * (If our new label's RAW_PART size ends up smaller than the
* in-core RAW_PART size value, updating the label will fail.) * in-core RAW_PART size value, updating the label will fail.)
*/ */
dlsize = dlcyl*dlhead*dlsec; pm->dlsize = pm->dlcyl*pm->dlhead*pm->dlsec;
if (disklabel.d_secperunit > dlsize) if (disklabel.d_secperunit > pm->dlsize)
dlsize = disklabel.d_secperunit; pm->dlsize = disklabel.d_secperunit;
return 1; return 1;
} }
@ -195,10 +195,10 @@ static void
install_bootblocks(void) install_bootblocks(void)
{ {
/* Install boot blocks before mounting the target disk */ /* Install boot blocks before mounting the target disk */
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, pm->diskdev);
run_program(RUN_DISPLAY, "/sbin/disklabel -W %s", diskdev); run_program(RUN_DISPLAY, "/sbin/disklabel -W %s", pm->diskdev);
run_program(RUN_DISPLAY, "/usr/sbin/installboot /dev/r%sc" run_program(RUN_DISPLAY, "/usr/sbin/installboot /dev/r%sc"
" /usr/mdec/bootblk", diskdev); " /usr/mdec/bootblk", pm->diskdev);
} }
/* install/update secondary bootstrap */ /* install/update secondary bootstrap */

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:47 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:41 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -70,7 +70,7 @@ md_get_info(void)
int fd; int fd;
char dev_name[100]; char dev_name[100];
snprintf(dev_name, 100, "/dev/r%sc", diskdev); snprintf(dev_name, 100, "/dev/r%sc", pm->diskdev);
fd = open(dev_name, O_RDONLY, 0); fd = open(dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -91,21 +91,21 @@ md_get_info(void)
} }
close(fd); close(fd);
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlcylsize = disklabel.d_secpercyl; pm->dlcylsize = disklabel.d_secpercyl;
/* /*
* Compute whole disk size. Take max of (dlcyl*dlhead*dlsec) * Compute whole disk size. Take max of (pm->dlcyl*pm->dlhead*pm->dlsec)
* and secperunit, just in case the disk is already labelled. * and secperunit, just in case the disk is already labelled.
* (If our new label's RAW_PART size ends up smaller than the * (If our new label's RAW_PART size ends up smaller than the
* in-core RAW_PART size value, updating the label will fail.) * in-core RAW_PART size value, updating the label will fail.)
*/ */
dlsize = dlcyl*dlhead*dlsec; pm->dlsize = pm->dlcyl*pm->dlhead*pm->dlsec;
if (disklabel.d_secperunit > dlsize) if (disklabel.d_secperunit > pm->dlsize)
dlsize = disklabel.d_secperunit; pm->dlsize = disklabel.d_secperunit;
return 1; return 1;
} }
@ -144,7 +144,7 @@ int
md_post_disklabel(void) md_post_disklabel(void)
{ {
if (get_ramsize() <= 32) if (get_ramsize() <= 32)
set_swap(diskdev, bsdlabel); set_swap(pm->diskdev, pm->bsdlabel);
return 0; return 0;
} }
@ -159,9 +159,9 @@ md_post_disklabel(void)
int int
md_post_newfs(void) md_post_newfs(void)
{ {
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, pm->diskdev);
run_program(0, "/usr/sbin/installboot /dev/r%s%c /usr/mdec/%.2sboot", run_program(0, "/usr/sbin/installboot /dev/r%s%c /usr/mdec/%.2sboot",
diskdev, 'a' + getrawpartition(), diskdev); pm->diskdev, 'a' + getrawpartition(), pm->diskdev);
return 0; return 0;
} }
@ -183,7 +183,7 @@ int
md_pre_update(void) md_pre_update(void)
{ {
if (get_ramsize() <= 32) if (get_ramsize() <= 32)
set_swap(diskdev, NULL); set_swap(pm->diskdev, NULL);
return 1; return 1;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:47 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:41 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -83,7 +83,7 @@ md_get_info(void)
char dev_name[100]; char dev_name[100];
struct disklabel disklabel; struct disklabel disklabel;
snprintf(dev_name, 100, "/dev/r%sc", diskdev); snprintf(dev_name, 100, "/dev/r%sc", pm->diskdev);
fd = open(dev_name, O_RDONLY, 0); fd = open(dev_name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
@ -109,12 +109,12 @@ md_get_info(void)
exit(1); exit(1);
} }
dlcyl = disklabel.d_ncylinders; pm->dlcyl = disklabel.d_ncylinders;
dlhead = disklabel.d_ntracks; pm->dlhead = disklabel.d_ntracks;
dlsec = disklabel.d_nsectors; pm->dlsec = disklabel.d_nsectors;
sectorsize = disklabel.d_secsize; pm->sectorsize = disklabel.d_secsize;
dlcylsize = disklabel.d_secpercyl; pm->dlcylsize = disklabel.d_secpercyl;
dlsize = dlcyl*dlhead*dlsec; pm->dlsize = pm->dlcyl*pm->dlhead*pm->dlsec;
if (read(fd, buf, 1024) < 0) { if (read(fd, buf, 1024) < 0) {
endwin(); endwin();
@ -134,7 +134,7 @@ md_get_info(void)
} }
#endif #endif
/* preserve first 64 sectors for system. */ /* preserve first 64 sectors for system. */
ptstart = 64; pm->ptstart = 64;
/* preserve existing partitions? */ /* preserve existing partitions? */
@ -165,22 +165,22 @@ md_check_partitions(void)
for (part = PART_A; part < 8; part++) { for (part = PART_A; part < 8; part++) {
if (part == PART_C) if (part == PART_C)
continue; continue;
if (last >= PART_A && bsdlabel[part].pi_size > 0) { if (last >= PART_A && pm->bsdlabel[part].pi_size > 0) {
msg_display(MSG_emptypart, part+'a'); msg_display(MSG_emptypart, part+'a');
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return 0; return 0;
} }
if (bsdlabel[part].pi_size == 0) { if (pm->bsdlabel[part].pi_size == 0) {
if (last < PART_A) if (last < PART_A)
last = part; last = part;
} else { } else {
if (start >= bsdlabel[part].pi_offset) { if (start >= pm->bsdlabel[part].pi_offset) {
msg_display(MSG_ordering, part+'a'); msg_display(MSG_ordering, part+'a');
process_menu(MENU_yesno, NULL); process_menu(MENU_yesno, NULL);
if (yesno) if (yesno)
return 0; return 0;
} }
start = bsdlabel[part].pi_offset; start = pm->bsdlabel[part].pi_offset;
} }
} }
@ -205,10 +205,10 @@ md_check_partitions(void)
break; break;
} }
} }
emptylabel(bsdlabel); emptylabel(pm->bsdlabel);
bsdlabel[C].pi_fstype = FS_UNUSED; pm->bsdlabel[C].pi_fstype = FS_UNUSED;
bsdlabel[C].pi_offset = 0; pm->bsdlabel[C].pi_offset = 0;
bsdlabel[C].pi_size = dlsize; pm->bsdlabel[C].pi_size = pm->dlsize;
for (i = 0, j = A; i < NDOSPART;) { for (i = 0, j = A; i < NDOSPART;) {
if (j == C) { if (j == C) {
j++; j++;
@ -221,22 +221,22 @@ md_check_partitions(void)
i++; i++;
continue; continue;
} }
bsdlabel[j].pi_fstype = (i == 1) ? FS_SWAP : FS_BSDFFS; pm->bsdlabel[j].pi_fstype = (i == 1) ? FS_SWAP : FS_BSDFFS;
bsdlabel[j].pi_offset = md_disklabel.dosparts[i].dp_start*2; pm->bsdlabel[j].pi_offset = md_disklabel.dosparts[i].dp_start*2;
bsdlabel[j].pi_size = md_disklabel.dosparts[i].dp_size*2; pm->bsdlabel[j].pi_size = md_disklabel.dosparts[i].dp_size*2;
i++; i++;
j++; j++;
} }
if (j > 6) { if (j > 6) {
msg_display(MSG_nofreepart, diskdev); msg_display(MSG_nofreepart, pm->diskdev);
return 0; return 0;
} }
md_nfreepart = 8 - j; md_nfreepart = 8 - j;
/* check for free space */ /* check for free space */
fsptsize = bsdlabel[A].pi_offset - 64; fspm->ptsize = pm->bsdlabel[A].pi_offset - 64;
if (fptsize <= 0) { /* XXX: should not be 0; minfsdb? */ if (fpm->ptsize <= 0) { /* XXX: should not be 0; minfsdb? */
msg_display(MSG_notfirst, diskdev); msg_display(MSG_notfirst, pm->diskdev);
process_menu(MENU_ok); process_menu(MENU_ok);
exit(1); exit(1);
} }
@ -263,7 +263,7 @@ int
md_post_disklabel(void) md_post_disklabel(void)
{ {
if (get_ramsize() < 6) if (get_ramsize() < 6)
set_swap(diskdev, bsdlabel); set_swap(pm->diskdev, pm->bsdlabel);
return 0; return 0;
} }
@ -278,11 +278,11 @@ int
md_post_newfs(void) md_post_newfs(void)
{ {
/* boot blocks ... */ /* boot blocks ... */
msg_display(MSG_dobootblks, diskdev); msg_display(MSG_dobootblks, pm->diskdev);
cp_to_target("/usr/mdec/boot", "/boot"); cp_to_target("/usr/mdec/boot", "/boot");
if (run_program(RUN_DISPLAY | RUN_NO_CLEAR, if (run_program(RUN_DISPLAY | RUN_NO_CLEAR,
"/usr/mdec/installboot.new /usr/mdec/sdboot_ufs /dev/r%sa", "/usr/mdec/installboot.new /usr/mdec/sdboot_ufs /dev/r%sa",
diskdev)) pm->diskdev))
process_menu(MENU_ok, process_menu(MENU_ok,
deconst("Warning: disk is probably not bootable")); deconst("Warning: disk is probably not bootable"));
return 0; return 0;
@ -306,7 +306,7 @@ int
md_pre_update(void) md_pre_update(void)
{ {
if (get_ramsize() < 6) if (get_ramsize() < 6)
set_swap(diskdev, NULL); set_swap(pm->diskdev, NULL);
return 1; return 1;
} }
@ -321,10 +321,10 @@ md_update(void)
static int static int
md_newdisk(void) md_newdisk(void)
{ {
msg_display(MSG_newdisk, diskdev, diskdev); msg_display(MSG_newdisk, pm->diskdev, pm->diskdev);
return run_program(RUN_FATAL|RUN_DISPLAY, return run_program(RUN_FATAL|RUN_DISPLAY,
"/usr/mdec/newdisk -v %s", diskdev); "/usr/mdec/newdisk -v %s", pm->diskdev);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.1 2014/07/26 19:30:47 dholland Exp $ */ /* $NetBSD: md.c,v 1.2 2014/08/03 16:09:41 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -100,7 +100,7 @@ md_pre_disklabel(void)
msg_display(MSG_dofdisk); msg_display(MSG_dofdisk);
/* write edited MBR onto disk. */ /* write edited MBR onto disk. */
if (write_mbr(diskdev, &mbr, 1) != 0) { if (write_mbr(pm->diskdev, &mbr, 1) != 0) {
msg_display(MSG_wmbrfail); msg_display(MSG_wmbrfail);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return 1; return 1;
@ -130,7 +130,7 @@ md_post_newfs(void)
ssize_t sz; ssize_t sz;
int fd = -1; int fd = -1;
snprintf(adevname, sizeof(adevname), "/dev/r%sa", diskdev); snprintf(adevname, sizeof(adevname), "/dev/r%sa", pm->diskdev);
fd = open(adevname, O_RDWR); fd = open(adevname, O_RDWR);
if (fd < 0) if (fd < 0)
goto out; goto out;

View File

@ -1,4 +1,4 @@
/* $NetBSD: bsddisklabel.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: bsddisklabel.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -52,8 +52,6 @@
#include "msg_defs.h" #include "msg_defs.h"
#include "menu_defs.h" #include "menu_defs.h"
static int check_partitions(void);
/* For the current state of this file blame abs@NetBSD.org */ /* For the current state of this file blame abs@NetBSD.org */
/* Even though he wasn't the last to hack it, but he did admit doing so :-) */ /* Even though he wasn't the last to hack it, but he did admit doing so :-) */
@ -91,11 +89,12 @@ save_ptn(int ptn, daddr_t start, daddr_t size, int fstype, const char *mountpt)
static int maxptn; static int maxptn;
partinfo *p; partinfo *p;
int pp; int pp;
char *buf;
if (maxptn == 0) if (maxptn == 0)
maxptn = getmaxpartitions(); maxptn = getmaxpartitions();
if (ptn < 0 || bsdlabel[ptn].pi_fstype != FS_UNUSED) { if (ptn < 0 || pm->bsdlabel[ptn].pi_fstype != FS_UNUSED) {
ptn = getrawpartition() + 1; ptn = getrawpartition() + 1;
#ifdef PART_FIRST_FREE #ifdef PART_FIRST_FREE
if (ptn < PART_FIRST_FREE) if (ptn < PART_FIRST_FREE)
@ -106,7 +105,7 @@ save_ptn(int ptn, daddr_t start, daddr_t size, int fstype, const char *mountpt)
return -1; return -1;
if (ptn == PART_USR) if (ptn == PART_USR)
continue; continue;
if (bsdlabel[ptn].pi_fstype == FS_UNUSED) if (pm->bsdlabel[ptn].pi_fstype == FS_UNUSED)
break; break;
} }
} }
@ -114,17 +113,25 @@ save_ptn(int ptn, daddr_t start, daddr_t size, int fstype, const char *mountpt)
if (fstype == FS_UNUSED) if (fstype == FS_UNUSED)
return ptn; return ptn;
p = bsdlabel + ptn; p = pm->bsdlabel + ptn;
p->pi_offset = start; p->pi_offset = start;
p->pi_size = size; p->pi_size = size;
set_ptype(p, fstype, mountpt ? PIF_NEWFS : 0); set_ptype(p, fstype, mountpt ? PIF_NEWFS : 0);
if (mountpt != NULL) { /* Hack because we does not have something like FS_LVMPV */
p->lvmpv = 0;
if (mountpt != NULL && strcmp(mountpt, "lvm") == 0)
p->lvmpv = 1;
else if (mountpt != NULL) {
for (pp = 0; pp < maxptn; pp++) { for (pp = 0; pp < maxptn; pp++) {
if (strcmp(bsdlabel[pp].pi_mount, mountpt) == 0) if (strcmp(pm->bsdlabel[pp].pi_mount, mountpt) == 0)
bsdlabel[pp].pi_flags &= ~PIF_MOUNT; pm->bsdlabel[pp].pi_flags &= ~PIF_MOUNT;
} }
strlcpy(p->pi_mount, mountpt, sizeof p->pi_mount); if (mountpt[0] != '/')
asprintf(&buf, "/%s", mountpt);
else
asprintf(&buf, "%s", mountpt);
strlcpy(p->pi_mount, buf, sizeof p->pi_mount);
p->pi_flags |= PIF_MOUNT; p->pi_flags |= PIF_MOUNT;
/* Default to UFS2. */ /* Default to UFS2. */
if (p->pi_fstype == FS_BSDFFS) { if (p->pi_fstype == FS_BSDFFS) {
@ -135,6 +142,7 @@ save_ptn(int ptn, daddr_t start, daddr_t size, int fstype, const char *mountpt)
p->pi_flags |= PIF_FFSv2; p->pi_flags |= PIF_FFSv2;
#endif #endif
} }
free(buf);
} }
return ptn; return ptn;
@ -145,7 +153,7 @@ set_ptn_titles(menudesc *m, int opt, void *arg)
{ {
struct ptn_info *pi = arg; struct ptn_info *pi = arg;
struct ptn_size *p; struct ptn_size *p;
int sm = MEG / sectorsize; int sm = MEG / pm->sectorsize;
daddr_t size; daddr_t size;
char inc_free[12]; char inc_free[12];
@ -161,7 +169,7 @@ set_ptn_titles(menudesc *m, int opt, void *arg)
else else
inc_free[0] = 0; inc_free[0] = 0;
wprintw(m->mw, "%6" PRIi64 "%8s%10" PRIi64 "%10" PRIi64 " %c %s", wprintw(m->mw, "%6" PRIi64 "%8s%10" PRIi64 "%10" PRIi64 " %c %s",
size / sm, inc_free, size / dlcylsize, size, size / sm, inc_free, size / pm->dlcylsize, size,
p == pi->pool_part ? '+' : ' ', p->mount); p == pi->pool_part ? '+' : ' ', p->mount);
} }
@ -217,8 +225,8 @@ set_ptn_size(menudesc *m, void *arg)
return 0; return 0;
if (p->mount[0] == 0) { if (p->mount[0] == 0) {
msg_prompt_win(MSG_askfsmount, -1, 18, 0, 0, msg_prompt_win(partman_go?MSG_askfsmountadv:MSG_askfsmount,
NULL, p->mount, sizeof p->mount); -1, 18, 0, 0, NULL, p->mount, sizeof p->mount);
if (p->mount[0] == 0) if (p->mount[0] == 0)
return 0; return 0;
} }
@ -259,15 +267,15 @@ set_ptn_size(menudesc *m, void *arg)
mult = 1; mult = 1;
break; break;
case 'c': case 'c':
mult = dlcylsize; mult = pm->dlcylsize;
break; break;
case 'm': case 'm':
case 'M': case 'M':
mult = MEG / sectorsize; mult = MEG / pm->sectorsize;
break; break;
case 'g': case 'g':
case 'G': case 'G':
mult = 1024 * MEG / sectorsize; mult = 1024 * MEG / pm->sectorsize;
break; break;
case '+': case '+':
cp--; cp--;
@ -284,7 +292,7 @@ set_ptn_size(menudesc *m, void *arg)
break; break;
} }
size = NUMSEC(size, mult, dlcylsize); size = NUMSEC(size, mult, pm->dlcylsize);
if (p->ptn_id == PART_TMP_RAMDISK) { if (p->ptn_id == PART_TMP_RAMDISK) {
p->size = size; p->size = size;
return 0; return 0;
@ -294,7 +302,7 @@ set_ptn_size(menudesc *m, void *arg)
if (*cp == '+' && p->limit == 0) { if (*cp == '+' && p->limit == 0) {
pi->pool_part = p; pi->pool_part = p;
if (size == 0) if (size == 0)
size = dlcylsize; size = pm->dlcylsize;
} }
if (p->limit != 0 && size > p->limit) if (p->limit != 0 && size > p->limit)
size = p->limit; size = p->limit;
@ -320,9 +328,9 @@ set_ptn_size(menudesc *m, void *arg)
* but keep cylinder alignment * but keep cylinder alignment
*/ */
if (f < 0) if (f < 0)
f = -roundup(-f, dlcylsize); f = -roundup(-f, pm->dlcylsize);
else else
f = rounddown(f, dlcylsize); f = rounddown(f, pm->dlcylsize);
size += f; size += f;
if (size != 0) { if (size != 0) {
pi->free_space -= f; pi->free_space -= f;
@ -336,6 +344,7 @@ set_ptn_size(menudesc *m, void *arg)
return 0; return 0;
} }
/* Menu to change sizes of /, /usr, /home and etc. partitions */
void void
get_ptn_sizes(daddr_t part_start, daddr_t sectors, int no_swap) get_ptn_sizes(daddr_t part_start, daddr_t sectors, int no_swap)
{ {
@ -344,8 +353,10 @@ get_ptn_sizes(daddr_t part_start, daddr_t sectors, int no_swap)
int sm; /* sectors in 1MB */ int sm; /* sectors in 1MB */
struct ptn_size *p; struct ptn_size *p;
daddr_t size; daddr_t size;
static int swap_created = 0, root_created = 0;
static struct ptn_info pi = { -1, { if (pm->pi.menu_no < 0)
pm->pi = (struct ptn_info) { -1, {
#define PI_ROOT 0 #define PI_ROOT 0
{ PART_ROOT, { '/', '\0' }, { PART_ROOT, { '/', '\0' },
DEFROOTSIZE, DEFROOTSIZE , 0, 0}, DEFROOTSIZE, DEFROOTSIZE , 0, 0},
@ -377,134 +388,139 @@ get_ptn_sizes(daddr_t part_start, daddr_t sectors, int no_swap)
msg_display(MSG_ptnsizes); msg_display(MSG_ptnsizes);
msg_table_add(MSG_ptnheaders); msg_table_add(MSG_ptnheaders);
if (pi.menu_no < 0) { if (pm->pi.menu_no < 0) {
/* If there is a swap partition elsewhere, don't add one here.*/ /* If there is a swap partition elsewhere, don't add one here.*/
if (no_swap) { if (no_swap || (swap_created && partman_go)) {
pi.ptn_sizes[PI_SWAP].size = 0; pm->pi.ptn_sizes[PI_SWAP].size = 0;
} else { } else {
#if DEFSWAPSIZE == -1 #if DEFSWAPSIZE == -1
/* Dynamic swap size. */ /* Dynamic swap size. */
pi.ptn_sizes[PI_SWAP].dflt_size = get_ramsize(); pm->pi.ptn_sizes[PI_SWAP].dflt_size = get_ramsize();
pi.ptn_sizes[PI_SWAP].size = pm->pi.ptn_sizes[PI_SWAP].size =
pi.ptn_sizes[PI_SWAP].dflt_size; pm->pi.ptn_sizes[PI_SWAP].dflt_size;
#endif #endif
} }
/* If installing X increase default size of /usr */ /* If installing X increase default size of /usr */
if (set_X11_selected()) if (set_X11_selected())
pi.ptn_sizes[PI_USR].dflt_size += XNEEDMB; pm->pi.ptn_sizes[PI_USR].dflt_size += XNEEDMB;
/* Start of planning to give free space to / */ /* Start of planning to give free space to / */
pi.pool_part = &pi.ptn_sizes[PI_ROOT]; pm->pi.pool_part = &pm->pi.ptn_sizes[PI_ROOT];
/* Make size of root include default size of /usr */ /* Make size of root include default size of /usr */
pi.ptn_sizes[PI_ROOT].size += pi.ptn_sizes[PI_USR].dflt_size; pm->pi.ptn_sizes[PI_ROOT].size += pm->pi.ptn_sizes[PI_USR].dflt_size;
sm = MEG / sectorsize; sm = MEG / pm->sectorsize;
if (root_limit != 0) { if (root_limit != 0) {
/* Bah - bios can not read all the disk, limit root */ /* Bah - bios can not read all the disk, limit root */
pi.ptn_sizes[PI_ROOT].limit = root_limit - part_start; pm->pi.ptn_sizes[PI_ROOT].limit = root_limit - part_start;
/* Allocate a /usr partition if bios can't read /* Allocate a /usr partition if bios can't read
* everything except swap. * everything except swap.
*/ */
if (pi.ptn_sizes[PI_ROOT].limit if (pm->pi.ptn_sizes[PI_ROOT].limit
< sectors - pi.ptn_sizes[PI_SWAP].size * sm) { < sectors - pm->pi.ptn_sizes[PI_SWAP].size * sm) {
/* Root won't be able to access all the space */ /* Root won't be able to access all the space */
/* Claw back space for /usr */ /* Claw back space for /usr */
pi.ptn_sizes[PI_USR].size = pm->pi.ptn_sizes[PI_USR].size =
pi.ptn_sizes[PI_USR].dflt_size; pm->pi.ptn_sizes[PI_USR].dflt_size;
pi.ptn_sizes[PI_ROOT].size -= pm->pi.ptn_sizes[PI_ROOT].size -=
pi.ptn_sizes[PI_USR].dflt_size; pm->pi.ptn_sizes[PI_USR].dflt_size;
pi.ptn_sizes[PI_ROOT].changed = 1; pm->pi.ptn_sizes[PI_ROOT].changed = 1;
/* Give free space to /usr */ /* Give free space to /usr */
pi.pool_part = &pi.ptn_sizes[PI_USR]; pm->pi.pool_part = &pm->pi.ptn_sizes[PI_USR];
} }
} }
/* Change preset sizes from MB to sectors */ /* Change preset sizes from MB to sectors */
pi.free_space = sectors; pm->pi.free_space = sectors;
for (p = pi.ptn_sizes; p->mount[0]; p++) { for (p = pm->pi.ptn_sizes; p->mount[0]; p++) {
p->size = NUMSEC(p->size, sm, dlcylsize); p->size = NUMSEC(p->size, sm, pm->dlcylsize);
p->dflt_size = NUMSEC(p->dflt_size, sm, dlcylsize); p->dflt_size = NUMSEC(p->dflt_size, sm, pm->dlcylsize);
pi.free_space -= p->size; pm->pi.free_space -= p->size;
} }
/* Steal space from swap to make things fit.. */ /* Steal space from swap to make things fit.. */
if (pi.free_space < 0) { if (pm->pi.free_space < 0) {
i = roundup(-pi.free_space, dlcylsize); i = roundup(-pm->pi.free_space, pm->dlcylsize);
if (i > pi.ptn_sizes[PI_SWAP].size) if (i > pm->pi.ptn_sizes[PI_SWAP].size)
i = pi.ptn_sizes[PI_SWAP].size; i = pm->pi.ptn_sizes[PI_SWAP].size;
pi.ptn_sizes[PI_SWAP].size -= i; pm->pi.ptn_sizes[PI_SWAP].size -= i;
pi.free_space += i; pm->pi.free_space += i;
} }
/* Add space for 2 system dumps to / (traditional) */ /* Add space for 2 system dumps to / (traditional) */
i = get_ramsize() * sm; i = get_ramsize() * sm;
i = roundup(i, dlcylsize); i = roundup(i, pm->dlcylsize);
if (pi.free_space > i * 2) if (pm->pi.free_space > i * 2)
i *= 2; i *= 2;
if (pi.free_space > i) { if (pm->pi.free_space > i) {
pi.ptn_sizes[PI_ROOT].size += i; pm->pi.ptn_sizes[PI_ROOT].size += i;
pi.free_space -= i; pm->pi.free_space -= i;
}
if (root_created && partman_go) {
pm->pi.ptn_sizes[PI_ROOT].size = 0;
pm->pi.pool_part = 0;
} }
/* Ensure all of / is readable by the system boot code */ /* Ensure all of / is readable by the system boot code */
i = pi.ptn_sizes[PI_ROOT].limit; i = pm->pi.ptn_sizes[PI_ROOT].limit;
if (i != 0 && (i -= pi.ptn_sizes[PI_ROOT].size) < 0) { if (i != 0 && (i -= pm->pi.ptn_sizes[PI_ROOT].size) < 0) {
pi.ptn_sizes[PI_ROOT].size += i; pm->pi.ptn_sizes[PI_ROOT].size += i;
pi.free_space -= i; pm->pi.free_space -= i;
} }
/* Count free partition slots */ /* Count free partition slots */
pi.free_parts = 0; pm->pi.free_parts = 0;
for (i = 0; i < maxpart; i++) { for (i = 0; i < maxpart; i++) {
if (bsdlabel[i].pi_size == 0) if (pm->bsdlabel[i].pi_size == 0)
pi.free_parts++; pm->pi.free_parts++;
} }
for (i = 0; i < MAXPARTITIONS; i++) { for (i = 0; i < MAXPARTITIONS; i++) {
p = &pi.ptn_sizes[i]; p = &pm->pi.ptn_sizes[i];
if (i != 0 && p->ptn_id == 0) if (i != 0 && p->ptn_id == 0)
p->ptn_id = PART_EXTRA; p->ptn_id = PART_EXTRA;
if (p->size != 0) if (p->size != 0)
pi.free_parts--; pm->pi.free_parts--;
} }
pi.menu_no = new_menu(0, pi.ptn_menus, nelem(pi.ptn_menus), pm->pi.menu_no = new_menu(0, pm->pi.ptn_menus, nelem(pm->pi.ptn_menus),
3, -1, 12, 70, 3, -1, 12, 70,
MC_NOSHORTCUT |
MC_ALWAYS_SCROLL | MC_NOBOX | MC_NOCLEAR, MC_ALWAYS_SCROLL | MC_NOBOX | MC_NOCLEAR,
NULL, set_ptn_titles, NULL, NULL, set_ptn_titles, NULL,
"help", pi.exit_msg); "help", pm->pi.exit_msg);
if (pi.menu_no < 0) if (pm->pi.menu_no < 0)
return; return;
} }
do { do {
set_ptn_menu(&pi); set_ptn_menu(&pm->pi);
current_cylsize = dlcylsize; pm->current_cylsize = pm->dlcylsize;
process_menu(pi.menu_no, &pi); process_menu(pm->pi.menu_no, &pm->pi);
} while (pi.free_space < 0 || pi.free_parts < 0); } while (pm->pi.free_space < 0 || pm->pi.free_parts < 0);
/* Give any cylinder fragment to last partition */ /* Give any cylinder fragment to last partition */
if (pi.pool_part != NULL || pi.free_space < dlcylsize) { if (pm->pi.pool_part != NULL || pm->pi.free_space < pm->dlcylsize) {
for (p = pi.ptn_sizes + nelem(pi.ptn_sizes) - 1; ;p--) { for (p = pm->pi.ptn_sizes + nelem(pm->pi.ptn_sizes) - 1; ;p--) {
if (p->size == 0) { if (p->size == 0) {
if (p == pi.ptn_sizes) if (p == pm->pi.ptn_sizes)
break; break;
continue; continue;
} }
if (p->ptn_id == PART_TMP_RAMDISK) if (p->ptn_id == PART_TMP_RAMDISK)
continue; continue;
p->size += pi.free_space % dlcylsize; p->size += pm->pi.free_space % pm->dlcylsize;
pm->pi.free_space -= pm->pi.free_space % pm->dlcylsize;
break; break;
} }
} }
for (p = pi.ptn_sizes; p->mount[0]; p++, part_start += size) { for (p = pm->pi.ptn_sizes; p->mount[0]; p++, part_start += size) {
size = p->size; size = p->size;
if (p == pi.pool_part) { if (p == pm->pi.pool_part) {
size += rounddown(pi.free_space, dlcylsize); size += rounddown(pm->pi.free_space, pm->dlcylsize);
if (p->limit != 0 && size > p->limit) if (p->limit != 0 && size > p->limit)
size = p->limit; size = p->limit;
} }
@ -516,10 +532,21 @@ get_ptn_sizes(daddr_t part_start, daddr_t sectors, int no_swap)
} }
if (size == 0) if (size == 0)
continue; continue;
if (i == PART_ROOT && size > 0)
root_created = 1;
if (i == PART_SWAP) { if (i == PART_SWAP) {
if (size > 0)
swap_created = 1;
save_ptn(i, part_start, size, FS_SWAP, NULL); save_ptn(i, part_start, size, FS_SWAP, NULL);
continue; continue;
} }
if (!strcmp(p->mount, "raid")) {
save_ptn(i, part_start, size, FS_RAID, NULL);
continue;
} else if (!strcmp(p->mount, "cgd")) {
save_ptn(i, part_start, size, FS_CGD, NULL);
continue;
}
save_ptn(i, part_start, size, FS_BSDFFS, p->mount); save_ptn(i, part_start, size, FS_BSDFFS, p->mount);
} }
} }
@ -537,52 +564,57 @@ make_bsd_partitions(void)
int part_raw, part_bsd; int part_raw, part_bsd;
daddr_t ptend; daddr_t ptend;
int no_swap = 0, valid_part = -1; int no_swap = 0, valid_part = -1;
partinfo *p; partinfo *p, savedlabel[MAXPARTITIONS];
memcpy(&savedlabel, &pm->bsdlabel, sizeof savedlabel);
/* /*
* Initialize global variables that track space used on this disk. * Initialize global variables that track space used on this disk.
* Standard 4.4BSD 8-partition labels always cover whole disk. * Standard 4.4BSD 8-partition labels always cover whole disk.
*/ */
if (logfp) fprintf(logfp, "dlsize=%" PRId64 " ptsize=%" PRId64 " ptstart=%" PRId64 "\n", dlsize,ptsize,ptstart); if (pm->ptsize == 0)
if (ptsize == 0) pm->ptsize = pm->dlsize - pm->ptstart;
ptsize = dlsize - ptstart; if (pm->dlsize == 0)
if (dlsize == 0) pm->dlsize = pm->ptstart + pm->ptsize;
dlsize = ptstart + ptsize; if (logfp) fprintf(logfp, "dlsize=%" PRId64 " ptsize=%" PRId64
" ptstart=%" PRId64 "\n",
pm->dlsize, pm->ptsize, pm->ptstart);
partstart = ptstart; partstart = pm->ptstart;
ptend = ptstart + ptsize; ptend = pm->ptstart + pm->ptsize;
/* Ask for layout type -- standard or special */ /* Ask for layout type -- standard or special */
msg_display(MSG_layout, if (partman_go == 0) {
(int) (ptsize / (MEG / sectorsize)), msg_display(MSG_layout,
(int) (pm->ptsize / (MEG / pm->sectorsize)),
DEFROOTSIZE + DEFSWAPSIZE + DEFUSRSIZE, DEFROOTSIZE + DEFSWAPSIZE + DEFUSRSIZE,
DEFROOTSIZE + DEFSWAPSIZE + DEFUSRSIZE + XNEEDMB); DEFROOTSIZE + DEFSWAPSIZE + DEFUSRSIZE + XNEEDMB);
process_menu(MENU_layout, NULL);
process_menu(MENU_layout, NULL); }
/* Set so we use the 'real' geometry for rounding, input in MB */ /* Set so we use the 'real' geometry for rounding, input in MB */
current_cylsize = dlcylsize; pm->current_cylsize = pm->dlcylsize;
set_sizemultname_meg(); set_sizemultname_meg();
/* Build standard partitions */ /* Build standard partitions */
memset(&bsdlabel, 0, sizeof bsdlabel); memset(&pm->bsdlabel, 0, sizeof pm->bsdlabel);
/* Set initial partition types to unused */ /* Set initial partition types to unused */
for (part = 0 ; part < maxpart ; ++part) for (part = 0 ; part < maxpart ; ++part)
bsdlabel[part].pi_fstype = FS_UNUSED; pm->bsdlabel[part].pi_fstype = FS_UNUSED;
/* Whole disk partition */ /* Whole disk partition */
part_raw = getrawpartition(); part_raw = getrawpartition();
if (part_raw == -1) if (part_raw == -1)
part_raw = PART_C; /* for sanity... */ part_raw = PART_C; /* for sanity... */
bsdlabel[part_raw].pi_offset = 0; pm->bsdlabel[part_raw].pi_offset = 0;
bsdlabel[part_raw].pi_size = dlsize; pm->bsdlabel[part_raw].pi_size = pm->dlsize;
if (part_raw == PART_D) { if (part_raw == PART_D) {
/* Probably a system that expects an i386 style mbr */ /* Probably a system that expects an i386 style mbr */
part_bsd = PART_C; part_bsd = PART_C;
bsdlabel[PART_C].pi_offset = ptstart; pm->bsdlabel[PART_C].pi_offset = pm->ptstart;
bsdlabel[PART_C].pi_size = ptsize; pm->bsdlabel[PART_C].pi_size = pm->ptsize;
} else { } else {
part_bsd = part_raw; part_bsd = part_raw;
} }
@ -591,60 +623,60 @@ make_bsd_partitions(void)
i = BOOT_SIZE; i = BOOT_SIZE;
if (i >= 1024) { if (i >= 1024) {
/* Treat big numbers as a byte count */ /* Treat big numbers as a byte count */
i = (i + dlcylsize * sectorsize - 1) / (dlcylsize * sectorsize); i = (i + pm->dlcylsize * pm->sectorsize - 1) / (pm->dlcylsize * pm->sectorsize);
i *= dlcylsize; i *= pm->dlcylsize;
} }
#if defined(PART_BOOT_FFS) #if defined(PART_BOOT_FFS)
bsdlabel[PART_BOOT].pi_fstype = FS_BSDFFS; pm->bsdlabel[PART_BOOT].pi_fstype = FS_BSDFFS;
bsdlabel[PART_BOOT].pi_flags = PIF_NEWFS; pm->bsdlabel[PART_BOOT].pi_flags = PIF_NEWFS;
#else #else
bsdlabel[PART_BOOT].pi_fstype = FS_BOOT; pm->bsdlabel[PART_BOOT].pi_fstype = FS_BOOT;
#endif #endif
bsdlabel[PART_BOOT].pi_size = i; pm->bsdlabel[PART_BOOT].pi_size = i;
#ifdef BOOT_HIGH #ifdef BOOT_HIGH
bsdlabel[PART_BOOT].pi_offset = ptend - i; pm->bsdlabel[PART_BOOT].pi_offset = ptend - i;
ptend -= i; ptend -= i;
#else #else
bsdlabel[PART_BOOT].pi_offset = ptstart; pm->bsdlabel[PART_BOOT].pi_offset = pm->ptstart;
partstart += i; partstart += i;
#endif #endif
#elif defined(PART_BOOT) #elif defined(PART_BOOT)
if (bootsize != 0) { if (pm->bootsize != 0) {
#if defined(PART_BOOT_MSDOS) #if defined(PART_BOOT_MSDOS)
bsdlabel[PART_BOOT].pi_fstype = FS_MSDOS; pm->bsdlabel[PART_BOOT].pi_fstype = FS_MSDOS;
#else #else
bsdlabel[PART_BOOT].pi_fstype = FS_BOOT; pm->bsdlabel[PART_BOOT].pi_fstype = FS_BOOT;
#endif #endif
bsdlabel[PART_BOOT].pi_size = bootsize; pm->bsdlabel[PART_BOOT].pi_size = pm->bootsize;
bsdlabel[PART_BOOT].pi_offset = bootstart; pm->bsdlabel[PART_BOOT].pi_offset = pm->bootstart;
#if defined(PART_BOOT_PI_FLAGS) #if defined(PART_BOOT_PI_FLAGS)
bsdlabel[PART_BOOT].pi_flags |= PART_BOOT_PI_FLAGS; pm->bsdlabel[PART_BOOT].pi_flags |= PART_BOOT_PI_FLAGS;
#endif #endif
#if defined(PART_BOOT_PI_MOUNT) #if defined(PART_BOOT_PI_MOUNT)
strlcpy(bsdlabel[PART_BOOT].pi_mount, PART_BOOT_PI_MOUNT, strlcpy(pm->bsdlabel[PART_BOOT].pi_mount, PART_BOOT_PI_MOUNT,
sizeof bsdlabel[PART_BOOT].pi_mount); sizeof pm->bsdlabel[PART_BOOT].pi_mount);
#endif #endif
} }
#endif /* PART_BOOT w/o BOOT_SIZE */ #endif /* PART_BOOT w/o BOOT_SIZE */
#if defined(PART_SYSVBFS) && defined(SYSVBFS_SIZE) #if defined(PART_SYSVBFS) && defined(SYSVBFS_SIZE)
bsdlabel[PART_SYSVBFS].pi_offset = partstart; pm->bsdlabel[PART_SYSVBFS].pi_offset = partstart;
bsdlabel[PART_SYSVBFS].pi_fstype = FS_SYSVBFS; pm->bsdlabel[PART_SYSVBFS].pi_fstype = FS_SYSVBFS;
bsdlabel[PART_SYSVBFS].pi_size = SYSVBFS_SIZE; pm->bsdlabel[PART_SYSVBFS].pi_size = SYSVBFS_SIZE;
bsdlabel[PART_SYSVBFS].pi_flags |= PIF_NEWFS | PIF_MOUNT; pm->bsdlabel[PART_SYSVBFS].pi_flags |= PIF_NEWFS | PIF_MOUNT;
strlcpy(bsdlabel[PART_SYSVBFS].pi_mount, "/stand", strlcpy(pm->bsdlabel[PART_SYSVBFS].pi_mount, "/stand",
sizeof bsdlabel[PART_SYSVBFS].pi_mount); sizeof pm->bsdlabel[PART_SYSVBFS].pi_mount);
partstart += SYSVBFS_SIZE; partstart += SYSVBFS_SIZE;
#endif #endif
#ifdef PART_REST #ifdef PART_REST
bsdlabel[PART_REST].pi_offset = 0; pm->bsdlabel[PART_REST].pi_offset = 0;
bsdlabel[PART_REST].pi_size = ptstart; pm->bsdlabel[PART_REST].pi_size = pm->ptstart;
#endif #endif
if (layoutkind == 4) { if (layoutkind == LY_USEEXIST) {
/* /*
* If 'oldlabel' is a default label created by the kernel it * If 'pm->oldlabel' is a default label created by the kernel it
* will have exactly one valid partition besides raw_part * will have exactly one valid partition besides raw_part
* which covers the whole disk - but might lie outside the * which covers the whole disk - but might lie outside the
* mbr partition we (by now) have offset by a few sectors. * mbr partition we (by now) have offset by a few sectors.
@ -654,7 +686,7 @@ make_bsd_partitions(void)
for (i = 0; i < maxpart; i++) { for (i = 0; i < maxpart; i++) {
if (i == part_raw) if (i == part_raw)
continue; continue;
if (oldlabel[i].pi_size > 0 && PI_ISBSDFS(&oldlabel[i])) { if (pm->oldlabel[i].pi_size > 0 && PI_ISBSDFS(&pm->oldlabel[i])) {
if (valid_part >= 0) { if (valid_part >= 0) {
/* nope, not the default case */ /* nope, not the default case */
valid_part = -1; valid_part = -1;
@ -663,9 +695,9 @@ make_bsd_partitions(void)
valid_part = i; valid_part = i;
} }
} }
if (valid_part >= 0 && oldlabel[valid_part].pi_offset < ptstart) { if (valid_part >= 0 && pm->oldlabel[valid_part].pi_offset < pm->ptstart) {
oldlabel[valid_part].pi_offset = ptstart; pm->oldlabel[valid_part].pi_offset = pm->ptstart;
oldlabel[valid_part].pi_size -= ptstart; pm->oldlabel[valid_part].pi_size -= pm->ptstart;
} }
} }
@ -676,16 +708,16 @@ make_bsd_partitions(void)
* partitions on a multiboot i386 system. * partitions on a multiboot i386 system.
*/ */
for (i = maxpart; i--;) { for (i = maxpart; i--;) {
if (bsdlabel[i].pi_size != 0) if (pm->bsdlabel[i].pi_size != 0)
/* Don't overwrite special partitions */ /* Don't overwrite special partitions */
continue; continue;
p = &oldlabel[i]; p = &pm->oldlabel[i];
if (p->pi_fstype == FS_UNUSED || p->pi_size == 0) if (p->pi_fstype == FS_UNUSED || p->pi_size == 0)
continue; continue;
if (layoutkind == 4) { if (layoutkind == LY_USEEXIST) {
if (PI_ISBSDFS(p)) { if (PI_ISBSDFS(p)) {
p->pi_flags |= PIF_MOUNT; p->pi_flags |= PIF_MOUNT;
if (layoutkind == 4 && i == valid_part) { if (layoutkind == LY_USEEXIST && i == valid_part) {
int fstype = p->pi_fstype; int fstype = p->pi_fstype;
p->pi_fstype = 0; p->pi_fstype = 0;
strcpy(p->pi_mount, "/"); strcpy(p->pi_mount, "/");
@ -693,36 +725,53 @@ make_bsd_partitions(void)
} }
} }
} else { } else {
if (p->pi_offset < ptstart + ptsize && if (p->pi_offset < pm->ptstart + pm->ptsize &&
p->pi_offset + p->pi_size > ptstart) p->pi_offset + p->pi_size > pm->ptstart)
/* Not outside area we are allocating */ /* Not outside area we are allocating */
continue; continue;
if (p->pi_fstype == FS_SWAP) if (p->pi_fstype == FS_SWAP)
no_swap = 1; no_swap = 1;
} }
bsdlabel[i] = oldlabel[i]; pm->bsdlabel[i] = pm->oldlabel[i];
} }
if (layoutkind != 4) if (layoutkind == LY_SETNEW)
get_ptn_sizes(partstart, ptend - partstart, no_swap); get_ptn_sizes(partstart, ptend - partstart, no_swap);
else if (layoutkind == LY_NEWRAID) {
set_ptype(&(pm->bsdlabel[PART_E]), FS_RAID, 0);
pm->bsdlabel[PART_E].pi_size = pm->ptsize;
}
else if (layoutkind == LY_NEWCGD) {
set_ptype(&(pm->bsdlabel[PART_E]), FS_CGD, 0);
pm->bsdlabel[PART_E].pi_size = pm->ptsize;
}
else if (layoutkind == LY_NEWLVM) {
set_ptype(&(pm->bsdlabel[PART_E]), FS_BSDFFS, 0);
pm->bsdlabel[PART_E].pi_size = pm->ptsize;
pm->bsdlabel[PART_E].lvmpv = 1;
}
/* /*
* OK, we have a partition table. Give the user the chance to * OK, we have a partition table. Give the user the chance to
* edit it and verify it's OK, or abort altogether. * edit it and verify it's OK, or abort altogether.
*/ */
edit_check: do {
if (edit_and_check_label(bsdlabel, maxpart, part_raw, part_bsd) == 0) { if (edit_and_check_label(pm->bsdlabel, maxpart, part_raw, part_bsd) == 0) {
msg_display(MSG_abort); msg_display(MSG_abort);
return 0; memcpy(&pm->bsdlabel, &savedlabel, sizeof pm->bsdlabel);
} return 0;
if (check_partitions() == 0) }
goto edit_check; } while (partman_go == 0 && check_partitions() == 0);
/* Disk name */ /* Disk name */
msg_prompt(MSG_packname, bsddiskname, bsddiskname, sizeof bsddiskname); if (!partman_go)
msg_prompt(MSG_packname, pm->bsddiskname, pm->bsddiskname,
sizeof pm->bsddiskname);
/* save label to disk for MI code to update. */ /* save label to disk for MI code to update. */
(void) savenewlabel(bsdlabel, maxpart); if (! partman_go)
(void) savenewlabel(pm->bsdlabel, maxpart);
/* Everything looks OK. */ /* Everything looks OK. */
return (1); return (1);
@ -731,11 +780,11 @@ make_bsd_partitions(void)
/* /*
* check that there is at least a / somewhere. * check that there is at least a / somewhere.
*/ */
static int int
check_partitions(void) check_partitions(void)
{ {
#ifdef HAVE_BOOTXX_xFS #ifdef HAVE_BOOTXX_xFS
int rv; int rv = 1;
char *bootxx; char *bootxx;
#endif #endif
#ifndef HAVE_UFS2_BOOT #ifndef HAVE_UFS2_BOOT
@ -756,9 +805,9 @@ check_partitions(void)
} }
#endif #endif
#ifndef HAVE_UFS2_BOOT #ifndef HAVE_UFS2_BOOT
fstype = bsdlabel[rootpart].pi_fstype; fstype = pm->bsdlabel[pm->rootpart].pi_fstype;
if (fstype == FS_BSDFFS && if (fstype == FS_BSDFFS &&
(bsdlabel[rootpart].pi_flags & PIF_FFSv2) != 0) { (pm->bsdlabel[pm->rootpart].pi_flags & PIF_FFSv2) != 0) {
process_menu(MENU_ok, deconst(MSG_cannot_ufs2_root)); process_menu(MENU_ok, deconst(MSG_cannot_ufs2_root));
return 0; return 0;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: configmenu.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: configmenu.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/*- /*-
* Copyright (c) 2012 The NetBSD Foundation, Inc. * Copyright (c) 2012 The NetBSD Foundation, Inc.
@ -34,6 +34,7 @@
#include <stdio.h> #include <stdio.h>
#include <curses.h> #include <curses.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h>
#include "defs.h" #include "defs.h"
#include "msg_defs.h" #include "msg_defs.h"
#include "menu_defs.h" #include "menu_defs.h"
@ -68,6 +69,10 @@ enum {
CONFIGOPT_NTPD, CONFIGOPT_NTPD,
CONFIGOPT_NTPDATE, CONFIGOPT_NTPDATE,
CONFIGOPT_MDNSD, CONFIGOPT_MDNSD,
CONFIGOPT_XDM,
CONFIGOPT_CGD,
CONFIGOPT_LVM,
CONFIGOPT_RAIDFRAME,
CONFIGOPT_ADDUSER, CONFIGOPT_ADDUSER,
CONFIGOPT_LAST CONFIGOPT_LAST
}; };
@ -86,12 +91,16 @@ configinfo config_list[] = {
{MSG_timezone, CONFIGOPT_TZ, NULL, set_timezone_menu, NULL}, {MSG_timezone, CONFIGOPT_TZ, NULL, set_timezone_menu, NULL},
{MSG_Root_shell, CONFIGOPT_ROOTSH, NULL, set_root_shell, NULL}, {MSG_Root_shell, CONFIGOPT_ROOTSH, NULL, set_root_shell, NULL},
{MSG_change_rootpw, CONFIGOPT_ROOTPW, NULL, change_root_password, MSG_change}, {MSG_change_rootpw, CONFIGOPT_ROOTPW, NULL, change_root_password, MSG_change},
{MSG_enable_binpkg, CONFIGOPT_BINPKG, NULL, set_binpkg, MSG_configure}, {MSG_enable_binpkg, CONFIGOPT_BINPKG, NULL, set_binpkg, MSG_install},
{MSG_get_pkgsrc, CONFIGOPT_PKGSRC, NULL, set_pkgsrc, MSG_install}, {MSG_get_pkgsrc, CONFIGOPT_PKGSRC, NULL, set_pkgsrc, MSG_install},
{MSG_enable_sshd, CONFIGOPT_SSHD, "sshd", toggle_rcvar, NULL}, {MSG_enable_sshd, CONFIGOPT_SSHD, "sshd", toggle_rcvar, NULL},
{MSG_enable_ntpd, CONFIGOPT_NTPD, "ntpd", toggle_rcvar, NULL}, {MSG_enable_ntpd, CONFIGOPT_NTPD, "ntpd", toggle_rcvar, NULL},
{MSG_run_ntpdate, CONFIGOPT_NTPDATE, "ntpdate", toggle_rcvar, NULL}, {MSG_run_ntpdate, CONFIGOPT_NTPDATE, "ntpdate", toggle_rcvar, NULL},
{MSG_enable_mdnsd, CONFIGOPT_MDNSD, "mdnsd", toggle_rcvar, NULL}, {MSG_enable_mdnsd, CONFIGOPT_MDNSD, "mdnsd", toggle_rcvar, NULL},
{MSG_enable_xdm, CONFIGOPT_XDM, "xdm", toggle_rcvar, NULL},
{MSG_enable_cgd, CONFIGOPT_CGD, "cgd", toggle_rcvar, NULL},
{MSG_enable_lvm, CONFIGOPT_LVM, "lvm", toggle_rcvar, NULL},
{MSG_enable_raid, CONFIGOPT_RAIDFRAME, "raidframe", toggle_rcvar, NULL},
{MSG_add_a_user, CONFIGOPT_ADDUSER, NULL, add_new_user, ""}, {MSG_add_a_user, CONFIGOPT_ADDUSER, NULL, add_new_user, ""},
{NULL, CONFIGOPT_LAST, NULL, NULL, NULL} {NULL, CONFIGOPT_LAST, NULL, NULL, NULL}
}; };
@ -201,8 +210,9 @@ set_root_shell(struct menudesc *menu, void *arg)
configinfo **confp = arg; configinfo **confp = arg;
process_menu(MENU_rootsh, &confp[menu->cursel]->setting); process_menu(MENU_rootsh, &confp[menu->cursel]->setting);
run_program(RUN_PROGRESS | RUN_CHROOT, if (run_program(RUN_PROGRESS | RUN_CHROOT,
"chpass -s %s root", confp[menu->cursel]->setting); "chpass -s %s root", confp[menu->cursel]->setting) != 0)
confp[menu->cursel]->setting = MSG_failed;
return 0; return 0;
} }
@ -269,10 +279,13 @@ change_root_password(struct menudesc *menu, void *arg)
msg_display(MSG_rootpw); msg_display(MSG_rootpw);
process_menu(MENU_yesno, NULL); process_menu(MENU_yesno, NULL);
if (yesno) if (yesno) {
run_program(RUN_DISPLAY | RUN_PROGRESS | RUN_CHROOT, if (run_program(RUN_DISPLAY | RUN_PROGRESS | RUN_CHROOT,
"passwd -l root"); "passwd -l root") == 0)
confp[menu->cursel]->setting = MSG_password_set; confp[menu->cursel]->setting = MSG_password_set;
else
confp[menu->cursel]->setting = MSG_failed;
}
return 0; return 0;
} }
@ -280,25 +293,24 @@ static int
set_binpkg(struct menudesc *menu, void *arg) set_binpkg(struct menudesc *menu, void *arg)
{ {
configinfo **confp = arg; configinfo **confp = arg;
char additional_pkgs[STRSIZE] = {0};
char pattern[STRSIZE]; char pattern[STRSIZE];
int allok = 0;
/* binary pkg config requires network at this point, so if do {
it's not already configured, do it. */ yesno = -1;
if (network_up == 0) { process_menu(MENU_binpkg, additional_pkgs);
if (config_network()) if (yesno == SET_SKIP) {
mnt_net_config(); confp[menu->cursel]->setting = MSG_abandoned;
} return 0;
}
process_menu(MENU_binpkg, NULL);
make_url(pkgpath, &pkg, pkg_dir); make_url(pkgpath, &pkg, pkg_dir);
if ( run_program(RUN_DISPLAY | RUN_PROGRESS | RUN_CHROOT, if (run_program(RUN_DISPLAY | RUN_PROGRESS | RUN_CHROOT,
"pkg_add %s/pkgin", pkgpath) != 0) { "pkg_add %s/pkgin", pkgpath) == 0) {
msg_display(MSG_pkgin_failed); allok = 1;
process_menu(MENU_ok, NULL); }
confp[menu->cursel]->setting = MSG_failed; } while (allok == 0);
return 0;
}
/* configure pkgin to use $pkgpath as a repository */ /* configure pkgin to use $pkgpath as a repository */
snprintf(pattern, STRSIZE, "s,^[^#].*$,%s,", pkgpath); snprintf(pattern, STRSIZE, "s,^[^#].*$,%s,", pkgpath);
@ -307,9 +319,13 @@ set_binpkg(struct menudesc *menu, void *arg)
run_program(RUN_DISPLAY | RUN_PROGRESS | RUN_CHROOT, run_program(RUN_DISPLAY | RUN_PROGRESS | RUN_CHROOT,
"/usr/pkg/bin/pkgin -y update"); "/usr/pkg/bin/pkgin -y update");
if (strlen(additional_pkgs) > 0)
run_program(RUN_DISPLAY | RUN_PROGRESS | RUN_CHROOT,
"/usr/pkg/bin/pkgin -y install %s", additional_pkgs);
msg_display(MSG_binpkg_installed); msg_display(MSG_binpkg_installed);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
confp[menu->cursel]->setting = MSG_DONE; confp[menu->cursel]->setting = MSG_DONE;
return 0; return 0;
} }
@ -343,8 +359,7 @@ set_pkgsrc(struct menudesc *menu, void *arg)
} }
} }
while (status == SET_RETRY); while (status == SET_RETRY);
confp[menu->cursel]->setting = MSG_DONE; confp[menu->cursel]->setting = MSG_DONE;
return 0; return 0;
} }
@ -375,9 +390,9 @@ toggle_rcvar(struct menudesc *menu, void *arg)
} }
if (!(fp = fopen(target_expand("/etc/rc.conf"), "r"))) { if (!(fp = fopen(target_expand("/etc/rc.conf"), "r"))) {
msg_display(MSG_rcconf_delete_failed, varname); msg_display(MSG_openfail, target_expand("/etc/rc.conf"), strerror(errno));
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return -1; return 0;
} }
while (fgets(buf, sizeof buf, fp) != NULL) { while (fgets(buf, sizeof buf, fp) != NULL) {
@ -428,13 +443,9 @@ do_configmenu()
menu_ent me[CONFIGOPT_LAST]; menu_ent me[CONFIGOPT_LAST];
configinfo *ce[CONFIGOPT_LAST]; configinfo *ce[CONFIGOPT_LAST];
wrefresh(curscr);
wmove(stdscr, 0, 0);
wclear(stdscr);
wrefresh(stdscr);
/* if the target isn't mounted already, figure it out. */ /* if the target isn't mounted already, figure it out. */
if (target_mounted() == 0) { if (target_mounted() == 0) {
partman_go = 0;
if (find_disks(msg_string(MSG_configure_prior)) < 0) if (find_disks(msg_string(MSG_configure_prior)) < 0)
return; return;
@ -446,6 +457,11 @@ do_configmenu()
make_url(pkgpath, &pkg, pkg_dir); make_url(pkgpath, &pkg, pkg_dir);
opts = init_config_menu(config_list, me, ce); opts = init_config_menu(config_list, me, ce);
wrefresh(curscr);
wmove(stdscr, 0, 0);
wclear(stdscr);
wrefresh(stdscr);
menu_no = new_menu(NULL, me, opts, 0, -4, 0, 70, menu_no = new_menu(NULL, me, opts, 0, -4, 0, 70,
MC_SCROLL | MC_NOBOX | MC_DFLTEXIT, MC_SCROLL | MC_NOBOX | MC_DFLTEXIT,
configmenu_hdr, set_config, NULL, "XXX Help String", configmenu_hdr, set_config, NULL, "XXX Help String",
@ -453,7 +469,4 @@ do_configmenu()
process_menu(menu_no, ce); process_menu(menu_no, ce);
free_menu(menu_no); free_menu(menu_no);
sanity_check();
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: defs.h,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: defs.h,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -38,8 +38,10 @@
/* defs.h -- definitions for use in the sysinst program. */ /* defs.h -- definitions for use in the sysinst program. */
/* System includes needed for this. */ /* System includes needed for this. */
#include <sys/queue.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/disklabel.h> #include <sys/disklabel.h>
#include <sys/disk.h>
const char *getfslabelname(uint8_t); const char *getfslabelname(uint8_t);
@ -83,6 +85,9 @@ deconst(const void *p)
#define RUN_NO_CLEAR 0x0100 /* Leave program output after error */ #define RUN_NO_CLEAR 0x0100 /* Leave program output after error */
#define RUN_XFER_DIR 0x0200 /* cd to xfer_dir in child */ #define RUN_XFER_DIR 0x0200 /* cd to xfer_dir in child */
/* for bsddisklabel.c */
enum { LY_SETNEW, LY_NEWRAID, LY_NEWCGD, LY_NEWLVM, LY_USEEXIST };
/* Installation sets */ /* Installation sets */
enum { enum {
SET_NONE, SET_NONE,
@ -190,6 +195,7 @@ typedef struct distinfo {
const char *marker_file; /* set assumed installed if exists */ const char *marker_file; /* set assumed installed if exists */
} distinfo; } distinfo;
#define MOUNTLEN 20
typedef struct _partinfo { typedef struct _partinfo {
struct partition pi_partition; struct partition pi_partition;
#define pi_size pi_partition.p_size #define pi_size pi_partition.p_size
@ -198,7 +204,7 @@ typedef struct _partinfo {
#define pi_fstype pi_partition.p_fstype #define pi_fstype pi_partition.p_fstype
#define pi_frag pi_partition.p_frag #define pi_frag pi_partition.p_frag
#define pi_cpg pi_partition.p_cpg #define pi_cpg pi_partition.p_cpg
char pi_mount[20]; char pi_mount[MOUNTLEN];
uint pi_isize; /* bytes per inode (for # inodes) */ uint pi_isize; /* bytes per inode (for # inodes) */
uint pi_flags; uint pi_flags;
#define PIF_NEWFS 0x0001 /* need to 'newfs' partition */ #define PIF_NEWFS 0x0001 /* need to 'newfs' partition */
@ -214,13 +220,17 @@ typedef struct _partinfo {
#define PIF_LOG 0x0800 /* mount -o log */ #define PIF_LOG 0x0800 /* mount -o log */
#define PIF_MOUNT_OPTS 0x0ff0 /* all above mount flags */ #define PIF_MOUNT_OPTS 0x0ff0 /* all above mount flags */
#define PIF_RESET 0x1000 /* internal - restore previous values */ #define PIF_RESET 0x1000 /* internal - restore previous values */
const char *mnt_opts;
const char *fsname;
char mounted[MOUNTLEN];
int lvmpv; /* should we use partition as LVM PV? */
} partinfo; /* Single partition from a disklabel */ } partinfo; /* Single partition from a disklabel */
struct ptn_info { struct ptn_info {
int menu_no; int menu_no;
struct ptn_size { struct ptn_size {
int ptn_id; int ptn_id;
char mount[20]; char mount[MOUNTLEN];
daddr_t dflt_size; daddr_t dflt_size;
daddr_t size; daddr_t size;
int limit; int limit;
@ -247,41 +257,79 @@ pid_t ttysig_forward;
int layoutkind; int layoutkind;
int sizemult; int sizemult;
const char *multname; const char *multname;
int partman_go; /* run extended partition manager */
/* loging variables */ /* logging variables */
FILE *logfp; FILE *logfp;
FILE *script; FILE *script;
/* Actual name of the disk. */
char diskdev[SSTRSIZE];
int no_mbr; /* set for raid (etc) */
int rootpart; /* partition we install into */
const char *disktype; /* ST506, SCSI, ... */
/* Area of disk we can allocate, start and size in disk sectors. */
daddr_t ptstart, ptsize;
/* If we have an MBR boot partition, start and size in sectors */
int bootstart, bootsize;
/* Actual values for current disk - set by find_disks() or md_get_info() */
int sectorsize;
int dlcyl, dlhead, dlsec, dlcylsize;
daddr_t dlsize;
int current_cylsize;
unsigned int root_limit; /* BIOS (etc) read limit */
/* Information for the NetBSD disklabel */ /* Information for the NetBSD disklabel */
enum DLTR { PART_A, PART_B, PART_C, PART_D, PART_E, PART_F, PART_G, PART_H, 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}; PART_I, PART_J, PART_K, PART_L, PART_M, PART_N, PART_O, PART_P};
#define partition_name(x) ('a' + (x)) #define partition_name(x) ('a' + (x))
partinfo oldlabel[MAXPARTITIONS]; /* What we found on the disk */
partinfo bsdlabel[MAXPARTITIONS]; /* What we want it to look like */
daddr_t tmp_ramdisk_size; daddr_t tmp_ramdisk_size;
#define MAX_DISKS 15
unsigned int root_limit; /* BIOS (etc) read limit */
enum SHRED_T { SHRED_NONE=0, SHRED_ZEROS, SHRED_RANDOM, SHRED_CRYPTO };
/* All information that is unique for each drive */
SLIST_HEAD(pm_head_t, pm_devs_t) pm_head;
typedef struct pm_devs_t {
int unsaved; /* Flag indicating to partman that device need saving */
int found; /* Flag to delete unplugged and unconfigured devices */
int blocked; /* Device is busy and cannot be changed */
void *refdev; /* If device is blocked thats is a pointers to a parent dev */
int isspecial; /* LVM LV or DK device that doesnot accept disklabel */
char diskdev[SSTRSIZE]; /* Actual name of the disk. */
char diskdev_descr[STRSIZE];
int bootable;
#define DISKNAME_SIZE 16 #define DISKNAME_SIZE 16
char bsddiskname[DISKNAME_SIZE]; char bsddiskname[DISKNAME_SIZE];
const char *doessf; partinfo oldlabel[MAXPARTITIONS]; /* What we found on the disk */
partinfo bsdlabel[MAXPARTITIONS]; /* What we want it to look like */
int gpt;
int no_mbr; /* set for raid (etc) */
int rootpart; /* partition we install into */
const char *disktype; /* ST506, SCSI, ... */
const char *doessf;
/* Actual values for current disk - set by find_disks() or md_get_info() */
int sectorsize, dlcyl, dlhead, dlsec, dlcylsize, current_cylsize;
daddr_t dlsize;
/* Area of disk we can allocate, start and size in disk sectors. */
daddr_t ptstart, ptsize;
/* If we have an MBR boot partition, start and size in sectors */
int bootstart, bootsize;
struct ptn_info pi;
SLIST_ENTRY(pm_devs_t) l;
} pm_devs_t;
pm_devs_t *pm; /* Pointer to currend device with which we work */
pm_devs_t *pm_new; /* Pointer for next allocating device in find_disks() */
#define MAX_WEDGES 16 /* num of dk* devices */
typedef struct pm_wedge_t {
int allocated;
int todel;
pm_devs_t *pm;
int ptn;
} pm_wedge_t;
pm_wedge_t wedges[MAX_WEDGES];
/* Generic structure for partman */
typedef struct {
int retvalue;
int dev_num;
int wedge_num;
void *dev_ptr;
int dev_ptr_delta;
char fullname[SSTRSIZE];
enum {PM_DISK_T=1, PM_PART_T, PM_WEDGE_T, PM_SPEC_T, PM_RAID_T, PM_CGD_T,
PM_VND_T, PM_LVM_T, PM_LVMLV_T} type;
} part_entry_t;
/* Relative file name for storing a distribution. */ /* Relative file name for storing a distribution. */
char xfer_dir[STRSIZE]; char xfer_dir[STRSIZE];
@ -363,6 +411,7 @@ char dist_postfix[SSTRSIZE];
/* needed prototypes */ /* needed prototypes */
void set_menu_numopts(int, int); void set_menu_numopts(int, int);
void remove_color_options(void);
/* Machine dependent functions .... */ /* Machine dependent functions .... */
void md_init(void); void md_init(void);
@ -400,7 +449,11 @@ int make_fstab(void);
int mount_disks(void); int mount_disks(void);
int set_swap(const char *, partinfo *); int set_swap(const char *, partinfo *);
int check_swap(const char *, int); int check_swap(const char *, int);
char *bootxx_name(void); char *bootxx_name(void);
void label_read(void);
int get_dkwedges(struct dkwedge_info **, const char *);
const char *get_gptfs_by_id(int);
/* from disks_lfs.c */ /* from disks_lfs.c */
int fs_is_lfs(void *); int fs_is_lfs(void *);
@ -413,6 +466,8 @@ int edit_and_check_label(partinfo *, int, int, int);
void set_bsize(partinfo *, int); void set_bsize(partinfo *, int);
void set_fsize(partinfo *, int); void set_fsize(partinfo *, int);
void set_ptype(partinfo *, int, int); void set_ptype(partinfo *, int, int);
int edit_ptn(menudesc *, void *);
int checkoverlap(partinfo *, int, int, int);
/* from install.c */ /* from install.c */
void do_install(void); void do_install(void);
@ -477,6 +532,7 @@ void add_sysctl_conf(const char *, ...) __printflike(1, 2);
void enable_rc_conf(void); void enable_rc_conf(void);
void set_sizemultname_cyl(void); void set_sizemultname_cyl(void);
void set_sizemultname_meg(void); void set_sizemultname_meg(void);
int binary_available(const char *);
int check_lfs_progs(void); int check_lfs_progs(void);
void init_set_status(int); void init_set_status(int);
void customise_sets(void); void customise_sets(void);
@ -487,6 +543,8 @@ const char *ext_dir_for_set(const char *);
void replace(const char *, const char *, ...); void replace(const char *, const char *, ...);
void get_tz_default(void); void get_tz_default(void);
int extract_file(distinfo *, int); int extract_file(distinfo *, int);
void do_coloring (unsigned int, unsigned int);
int set_menu_select(menudesc *, void *);
/* from target.c */ /* from target.c */
#if defined(DEBUG) || defined(DEBUG_ROOT) #if defined(DEBUG) || defined(DEBUG_ROOT)
@ -512,6 +570,7 @@ void dup_file_into_target(const char *);
void mv_within_target_or_die(const char *, const char *); void mv_within_target_or_die(const char *, const char *);
int cp_within_target(const char *, const char *, int); int cp_within_target(const char *, const char *, int);
int target_mount(const char *, const char *, int, const char *); int target_mount(const char *, const char *, int, const char *);
int target_mount_do(const char *, const char *, const char *);
int target_test(unsigned int, const char *); int target_test(unsigned int, const char *);
int target_dir_exists_p(const char *); int target_dir_exists_p(const char *);
int target_file_exists_p(const char *); int target_file_exists_p(const char *);
@ -519,6 +578,21 @@ int target_symlink_exists_p(const char *);
void unwind_mounts(void); void unwind_mounts(void);
int target_mounted(void); int target_mounted(void);
/* from partman.c */
int partman(void);
int pm_partusage(pm_devs_t *, int, int);
int pm_getrefdev(pm_devs_t *);
void pm_setfstype(pm_devs_t *, int, int);
int pm_editpart(int);
void pm_rename(pm_devs_t *);
int pm_shred(pm_devs_t *, int, int);
void pm_umount(pm_devs_t *, int);
int pm_unconfigure(pm_devs_t *);
int pm_cgd_edit(void *, part_entry_t *);
int pm_gpt_convert(pm_devs_t *);
void pm_wedges_fill(pm_devs_t *);
void pm_make_bsd_partitions(pm_devs_t *);
/* from bsddisklabel.c */ /* from bsddisklabel.c */
int make_bsd_partitions(void); int make_bsd_partitions(void);
int save_ptn(int, daddr_t, daddr_t, int, const char *); int save_ptn(int, daddr_t, daddr_t, int, const char *);
@ -526,6 +600,7 @@ void set_ptn_titles(menudesc *, int, void *);
void set_ptn_menu(struct ptn_info *); void set_ptn_menu(struct ptn_info *);
int set_ptn_size(menudesc *, void *); int set_ptn_size(menudesc *, void *);
void get_ptn_sizes(daddr_t, daddr_t, int); void get_ptn_sizes(daddr_t, daddr_t, int);
int check_partitions(void);
/* from aout2elf.c */ /* from aout2elf.c */
int move_aout_libs(void); int move_aout_libs(void);
@ -544,4 +619,6 @@ void do_configmenu(void);
/* from checkrc.c */ /* from checkrc.c */
int check_rcvar(const char *); int check_rcvar(const char *);
int check_rcdefault(const char *); int check_rcdefault(const char *);
WINDOW *mainwin;
#endif /* _DEFS_H_ */ #endif /* _DEFS_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: disks.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: disks.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -41,6 +41,7 @@
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <util.h> #include <util.h>
#include <uuid.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
@ -49,6 +50,7 @@
#include <ufs/ffs/fs.h> #include <ufs/ffs/fs.h>
#define FSTYPENAMES #define FSTYPENAMES
#include <sys/disklabel.h> #include <sys/disklabel.h>
#include <sys/disklabel_gpt.h>
#include <dev/scsipi/scsipi_all.h> #include <dev/scsipi/scsipi_all.h>
#include <sys/scsiio.h> #include <sys/scsiio.h>
@ -63,7 +65,6 @@
#include "txtwalk.h" #include "txtwalk.h"
/* Disk descriptions */ /* Disk descriptions */
#define MAX_DISKS 15
struct disk_desc { struct disk_desc {
char dd_name[SSTRSIZE]; char dd_name[SSTRSIZE];
char dd_descr[70]; char dd_descr[70];
@ -75,6 +76,29 @@ struct disk_desc {
uint dd_totsec; uint dd_totsec;
}; };
/* gpt(8) use different filesystem names.
So, we cant use ./common/lib/libutil/getfstypename.c */
struct gptfs_t {
const char *name;
int id;
uuid_t uuid;
};
static const struct gptfs_t gpt_filesystems[] = {
{ "swap", FS_SWAP, GPT_ENT_TYPE_NETBSD_SWAP, },
{ "ffs", FS_BSDFFS, GPT_ENT_TYPE_NETBSD_FFS, },
{ "lfs", FS_BSDLFS, GPT_ENT_TYPE_NETBSD_LFS, },
{ "linux", FS_EX2FS, GPT_ENT_TYPE_LINUX_DATA, },
{ "windows,", FS_MSDOS, GPT_ENT_TYPE_MS_BASIC_DATA, },
{ "hfs", FS_HFS, GPT_ENT_TYPE_APPLE_HFS, },
{ "ufs", FS_OTHER, GPT_ENT_TYPE_APPLE_UFS, },
{ "ccd", FS_CCD, GPT_ENT_TYPE_NETBSD_CCD, },
{ "raid", FS_RAID, GPT_ENT_TYPE_NETBSD_RAIDFRAME, },
{ "cgd", FS_CGD, GPT_ENT_TYPE_NETBSD_CGD, },
{ "efi", FS_OTHER, GPT_ENT_TYPE_EFI, },
{ "bios", FS_OTHER, GPT_ENT_TYPE_BIOS, },
{ NULL, -1, GPT_ENT_TYPE_UNUSED, },
};
/* Local prototypes */ /* Local prototypes */
static int foundffs(struct data *, size_t); static int foundffs(struct data *, size_t);
#ifdef USE_SYSVBFS #ifdef USE_SYSVBFS
@ -82,12 +106,14 @@ static int foundsysvbfs(struct data *, size_t);
#endif #endif
static int fsck_preen(const char *, int, const char *); static int fsck_preen(const char *, int, const char *);
static void fixsb(const char *, const char *, char); static void fixsb(const char *, const char *, char);
static int is_gpt(const char *);
static int incoregpt(pm_devs_t *, partinfo *);
#ifndef DISK_NAMES #ifndef DISK_NAMES
#define DISK_NAMES "wd", "sd", "ld", "raid" #define DISK_NAMES "wd", "sd", "ld", "raid"
#endif #endif
static const char *disk_names[] = { DISK_NAMES, "vnd", NULL }; static const char *disk_names[] = { DISK_NAMES, "vnd", "cgd", NULL };
static bool tmpfs_on_var_shm(void); static bool tmpfs_on_var_shm(void);
@ -319,6 +345,7 @@ get_descr(struct disk_desc *dd)
/* try SCSI */ /* try SCSI */
if (get_descr_scsi(dd, fd)) if (get_descr_scsi(dd, fd))
goto done; goto done;
/* XXX: get description from raid, cgd, vnd... */
done: done:
if (fd >= 0) if (fd >= 0)
@ -421,23 +448,16 @@ get_disks(struct disk_desc *dd)
return numdisks; return numdisks;
} }
static int
set_dsk_select(menudesc *m, void *arg)
{
*(int *)arg = m->cursel;
return 1;
}
int int
find_disks(const char *doingwhat) find_disks(const char *doingwhat)
{ {
struct disk_desc disks[MAX_DISKS]; struct disk_desc disks[MAX_DISKS];
menu_ent dsk_menu[nelem(disks)]; menu_ent dsk_menu[nelem(disks) + 1]; // + 1 for extended partitioning entry
struct disk_desc *disk; struct disk_desc *disk;
int i; int i, already_found;
int numdisks; int numdisks, selected_disk = -1;
int selected_disk = 0;
int menu_no; int menu_no;
pm_devs_t *pm_i, *pm_last = NULL;
/* Find disks. */ /* Find disks. */
numdisks = get_disks(disks); numdisks = get_disks(disks);
@ -448,75 +468,138 @@ find_disks(const char *doingwhat)
/* Kill typeahead, it won't be what the user had in mind */ /* Kill typeahead, it won't be what the user had in mind */
fpurge(stdin); fpurge(stdin);
if (numdisks == 0) { /* partman_go: <0 - we want to see menu with extended partitioning
/* No disks found! */ ==0 - we want to see simple select disk menu
msg_display(MSG_nodisk); >0 - we do not want to see any menus, just detect all disks */
process_menu(MENU_ok, NULL); if (partman_go <= 0) {
/*endwin();*/ if (numdisks == 0) {
return -1; /* No disks found! */
} msg_display(MSG_nodisk);
process_menu(MENU_ok, NULL);
if (numdisks == 1) { /*endwin();*/
/* One disk found! */
msg_display(MSG_onedisk, disks[0].dd_descr, doingwhat);
process_menu(MENU_ok, NULL);
} else {
/* Multiple disks found! */
for (i = 0; i < numdisks; i++) {
dsk_menu[i].opt_name = disks[i].dd_descr;
dsk_menu[i].opt_menu = OPT_NOMENU;
dsk_menu[i].opt_flags = OPT_EXIT;
dsk_menu[i].opt_action = set_dsk_select;
}
menu_no = new_menu(MSG_Available_disks,
dsk_menu, numdisks, -1, 4, 0, 0,
MC_SCROLL | MC_NOEXITOPT,
NULL, NULL, NULL, NULL, NULL);
if (menu_no == -1)
return -1; return -1;
msg_display(MSG_ask_disk, doingwhat); } else {
process_menu(menu_no, &selected_disk); /* One or more disks found! */
free_menu(menu_no); for (i = 0; i < numdisks; i++) {
dsk_menu[i].opt_name = disks[i].dd_descr;
dsk_menu[i].opt_menu = OPT_NOMENU;
dsk_menu[i].opt_flags = OPT_EXIT;
dsk_menu[i].opt_action = set_menu_select;
}
if (partman_go < 0) {
dsk_menu[i].opt_name = MSG_partman;
dsk_menu[i].opt_menu = OPT_NOMENU;
dsk_menu[i].opt_flags = OPT_EXIT;
dsk_menu[i].opt_action = set_menu_select;
}
menu_no = new_menu(MSG_Available_disks,
dsk_menu, numdisks + ((partman_go<0)?1:0), -1, 4, 0, 0, MC_SCROLL,
NULL, NULL, NULL, NULL, NULL);
if (menu_no == -1)
return -1;
msg_display(MSG_ask_disk, doingwhat);
process_menu(menu_no, &selected_disk);
free_menu(menu_no);
}
if (partman_go < 0 && selected_disk == numdisks) {
partman_go = 1;
return -2;
} else
partman_go = 0;
if (selected_disk < 0 || selected_disk >= numdisks)
return -1;
} }
disk = disks + selected_disk; /* Fill pm struct with device(s) info */
strlcpy(diskdev, disk->dd_name, sizeof diskdev); for (i = 0; i < numdisks; i++) {
if (! partman_go)
disk = disks + selected_disk;
else {
disk = disks + i;
already_found = 0;
SLIST_FOREACH(pm_i, &pm_head, l) {
pm_last = pm_i;
if (!already_found &&
strcmp(pm_i->diskdev, disk->dd_name) == 0) {
pm_i->found = 1;
break;
}
}
if (pm_i != NULL && pm_i->found)
/* We already added this device, skipping */
continue;
}
pm = pm_new;
pm->found = 1;
pm->bootable = 0;
pm->pi.menu_no = -1;
pm->disktype = "unknown";
pm->doessf = "";
strlcpy(pm->diskdev, disk->dd_name, sizeof pm->diskdev);
strlcpy(pm->diskdev_descr, disk->dd_descr, sizeof pm->diskdev_descr);
/* Use as a default disk if the user has the sets on a local disk */
strlcpy(localfs_dev, disk->dd_name, sizeof localfs_dev);
/* Use as a default disk if the user has the sets on a local disk */ pm->gpt = is_gpt(pm->diskdev);
strlcpy(localfs_dev, disk->dd_name, sizeof localfs_dev); pm->no_mbr = disk->dd_no_mbr || pm->gpt;
pm->sectorsize = disk->dd_secsize;
pm->dlcyl = disk->dd_cyl;
pm->dlhead = disk->dd_head;
pm->dlsec = disk->dd_sec;
pm->dlsize = disk->dd_totsec;
if (pm->dlsize == 0)
pm->dlsize = disk->dd_cyl * disk->dd_head * disk->dd_sec;
if (pm->dlsize > UINT32_MAX && ! partman_go) {
if (logfp)
fprintf(logfp, "Cannot process disk %s: too big size (%d)\n",
pm->diskdev, (int)pm->dlsize);
msg_display(MSG_toobigdisklabel);
process_menu(MENU_ok, NULL);
return -1;
}
pm->dlcylsize = pm->dlhead * pm->dlsec;
sectorsize = disk->dd_secsize; label_read();
dlcyl = disk->dd_cyl; if (partman_go) {
dlhead = disk->dd_head; pm_getrefdev(pm_new);
dlsec = disk->dd_sec; if (SLIST_EMPTY(&pm_head) || pm_last == NULL)
dlsize = disk->dd_totsec; SLIST_INSERT_HEAD(&pm_head, pm_new, l);
no_mbr = disk->dd_no_mbr; else
if (dlsize == 0) SLIST_INSERT_AFTER(pm_last, pm_new, l);
dlsize = disk->dd_cyl * disk->dd_head * disk->dd_sec; pm_new = malloc(sizeof (pm_devs_t));
if (dlsize > UINT32_MAX) { memset(pm_new, 0, sizeof *pm_new);
msg_display(MSG_toobigdisklabel); } else
process_menu(MENU_ok, NULL); /* We is not in partman and do not want to process all devices, exit */
return -1; break;
} }
dlcylsize = dlhead * dlsec;
/* Get existing/default label */
memset(&oldlabel, 0, sizeof oldlabel);
incorelabel(diskdev, oldlabel);
/* Set 'target' label to current label in case we don't change it */
memcpy(&bsdlabel, &oldlabel, sizeof bsdlabel);
return numdisks; return numdisks;
} }
void
label_read(void)
{
/* Get existing/default label */
memset(&pm->oldlabel, 0, sizeof pm->oldlabel);
if (! pm->gpt)
incorelabel(pm->diskdev, pm->oldlabel);
else
incoregpt(pm, pm->oldlabel);
/* Set 'target' label to current label in case we don't change it */
memcpy(&pm->bsdlabel, &pm->oldlabel, sizeof pm->bsdlabel);
#ifndef NO_DISKLABEL
if (! pm->gpt)
savenewlabel(pm->oldlabel, getmaxpartitions());
#endif
}
void void
fmt_fspart(menudesc *m, int ptn, void *arg) fmt_fspart(menudesc *m, int ptn, void *arg)
{ {
unsigned int poffset, psize, pend; unsigned int poffset, psize, pend;
const char *desc; const char *desc;
static const char *Yes; static const char *Yes;
partinfo *p = bsdlabel + ptn; partinfo *p = pm->bsdlabel + ptn;
if (Yes == NULL) if (Yes == NULL)
Yes = msg_string(MSG_Yes); Yes = msg_string(MSG_Yes);
@ -572,7 +655,7 @@ write_disklabel (void)
#ifdef DISKLABEL_CMD #ifdef DISKLABEL_CMD
/* disklabel the disk */ /* disklabel the disk */
return run_program(RUN_DISPLAY, "%s -f /tmp/disktab %s '%s'", return run_program(RUN_DISPLAY, "%s -f /tmp/disktab %s '%s'",
DISKLABEL_CMD, diskdev, bsddiskname); DISKLABEL_CMD, pm->diskdev, pm->bsddiskname);
#else #else
return 0; return 0;
#endif #endif
@ -582,8 +665,8 @@ write_disklabel (void)
static int static int
ptn_sort(const void *a, const void *b) ptn_sort(const void *a, const void *b)
{ {
return strcmp(bsdlabel[*(const int *)a].pi_mount, return strcmp(pm->bsdlabel[*(const int *)a].pi_mount,
bsdlabel[*(const int *)b].pi_mount); pm->bsdlabel[*(const int *)b].pi_mount);
} }
int int
@ -591,16 +674,14 @@ make_filesystems(void)
{ {
unsigned int i; unsigned int i;
int ptn; int ptn;
int ptn_order[nelem(bsdlabel)]; int ptn_order[nelem(pm->bsdlabel)];
int error = 0; int error = 0;
unsigned int maxpart = getmaxpartitions(); unsigned int maxpart = getmaxpartitions();
char *newfs; char *newfs = NULL, *dev = NULL, *devdev = NULL;
const char *mnt_opts;
const char *fsname;
partinfo *lbl; partinfo *lbl;
if (maxpart > nelem(bsdlabel)) if (maxpart > nelem(pm->bsdlabel))
maxpart = nelem(bsdlabel); maxpart = nelem(pm->bsdlabel);
/* Making new file systems and mounting them */ /* Making new file systems and mounting them */
@ -616,24 +697,36 @@ make_filesystems(void)
* point defined, or is marked preserve, don't touch it! * point defined, or is marked preserve, don't touch it!
*/ */
ptn = ptn_order[i]; ptn = ptn_order[i];
lbl = bsdlabel + ptn; lbl = pm->bsdlabel + ptn;
if (is_active_rootpart(diskdev, ptn)) if (is_active_rootpart(pm->diskdev, ptn))
continue; continue;
if (*lbl->pi_mount == 0) if (*lbl->pi_mount == 0)
/* No mount point */ /* No mount point */
continue; continue;
if (pm->isspecial) {
asprintf(&dev, "%s", pm->diskdev);
ptn = 0 - 'a';
} else {
asprintf(&dev, "%s%c", pm->diskdev, 'a' + ptn);
}
if (dev == NULL)
return (ENOMEM);
asprintf(&devdev, "/dev/%s", dev);
if (devdev == NULL)
return (ENOMEM);
newfs = NULL; newfs = NULL;
mnt_opts = NULL; lbl->mnt_opts = NULL;
fsname = NULL; lbl->fsname = NULL;
switch (lbl->pi_fstype) { switch (lbl->pi_fstype) {
case FS_APPLEUFS: case FS_APPLEUFS:
asprintf(&newfs, "/sbin/newfs %s%.0d", asprintf(&newfs, "/sbin/newfs %s%.0d",
lbl->pi_isize != 0 ? "-i" : "", lbl->pi_isize); lbl->pi_isize != 0 ? "-i" : "", lbl->pi_isize);
mnt_opts = "-tffs -o async"; lbl->mnt_opts = "-tffs -o async";
fsname = "ffs"; lbl->fsname = "ffs";
break; break;
case FS_BSDFFS: case FS_BSDFFS:
asprintf(&newfs, asprintf(&newfs,
@ -642,36 +735,36 @@ make_filesystems(void)
lbl->pi_fsize * lbl->pi_frag, lbl->pi_fsize, lbl->pi_fsize * lbl->pi_frag, lbl->pi_fsize,
lbl->pi_isize != 0 ? " -i " : "", lbl->pi_isize); lbl->pi_isize != 0 ? " -i " : "", lbl->pi_isize);
if (lbl->pi_flags & PIF_LOG) if (lbl->pi_flags & PIF_LOG)
mnt_opts = "-tffs -o log"; lbl->mnt_opts = "-tffs -o log";
else else
mnt_opts = "-tffs -o async"; lbl->mnt_opts = "-tffs -o async";
fsname = "ffs"; lbl->fsname = "ffs";
break; break;
case FS_BSDLFS: case FS_BSDLFS:
asprintf(&newfs, "/sbin/newfs_lfs -b %d", asprintf(&newfs, "/sbin/newfs_lfs -b %d",
lbl->pi_fsize * lbl->pi_frag); lbl->pi_fsize * lbl->pi_frag);
mnt_opts = "-tlfs"; lbl->mnt_opts = "-tlfs";
fsname = "lfs"; lbl->fsname = "lfs";
break; break;
case FS_MSDOS: case FS_MSDOS:
#ifdef USE_NEWFS_MSDOS #ifdef USE_NEWFS_MSDOS
asprintf(&newfs, "/sbin/newfs_msdos"); asprintf(&newfs, "/sbin/newfs_msdos");
#endif #endif
mnt_opts = "-tmsdos"; lbl->mnt_opts = "-tmsdos";
fsname = "msdos"; lbl->fsname = "msdos";
break; break;
#ifdef USE_SYSVBFS #ifdef USE_SYSVBFS
case FS_SYSVBFS: case FS_SYSVBFS:
asprintf(&newfs, "/sbin/newfs_sysvbfs"); asprintf(&newfs, "/sbin/newfs_sysvbfs");
mnt_opts = "-tsysvbfs"; lbl->mnt_opts = "-tsysvbfs";
fsname = "sysvbfs"; lbl->fsname = "sysvbfs";
break; break;
#endif #endif
#ifdef USE_EXT2FS #ifdef USE_EXT2FS
case FS_EX2FS: case FS_EX2FS:
asprintf(&newfs, "/sbin/newfs_ext2fs"); asprintf(&newfs, "/sbin/newfs_ext2fs");
mnt_opts = "-text2fs"; lbl->mnt_opts = "-text2fs";
fsname = "ext2fs"; lbl->fsname = "ext2fs";
break; break;
#endif #endif
} }
@ -680,42 +773,43 @@ make_filesystems(void)
if (lbl->pi_fstype == FS_MSDOS) { if (lbl->pi_fstype == FS_MSDOS) {
/* newfs only if mount fails */ /* newfs only if mount fails */
if (run_program(RUN_SILENT | RUN_ERROR_OK, if (run_program(RUN_SILENT | RUN_ERROR_OK,
"mount -rt msdos /dev/%s%c /mnt2", "mount -rt msdos /dev/%s /mnt2", dev) != 0)
diskdev, 'a' + ptn) != 0)
error = run_program( error = run_program(
RUN_DISPLAY | RUN_PROGRESS, RUN_DISPLAY | RUN_PROGRESS,
"%s /dev/r%s%c", "%s /dev/r%s",
newfs, diskdev, 'a' + ptn); newfs, dev);
else { else {
run_program(RUN_SILENT | RUN_ERROR_OK, run_program(RUN_SILENT | RUN_ERROR_OK,
"umount /mnt2"); "umount /mnt2");
error = 0; error = 0;
} }
} else } else
#endif #endif
error = run_program(RUN_DISPLAY | RUN_PROGRESS, error = run_program(RUN_DISPLAY | RUN_PROGRESS,
"%s /dev/r%s%c", newfs, diskdev, 'a' + ptn); "%s /dev/r%s", newfs, dev);
} else { } else {
/* We'd better check it isn't dirty */ /* We'd better check it isn't dirty */
error = fsck_preen(diskdev, ptn, fsname); error = fsck_preen(pm->diskdev, ptn, lbl->fsname);
} }
free(newfs); free(newfs);
if (error != 0) if (error != 0)
return error; return error;
lbl->pi_flags ^= PIF_NEWFS;
md_pre_mount(); md_pre_mount();
if (lbl->pi_flags & PIF_MOUNT && mnt_opts != NULL) { if (partman_go == 0 && lbl->pi_flags & PIF_MOUNT &&
lbl->mnt_opts != NULL) {
make_target_dir(lbl->pi_mount); make_target_dir(lbl->pi_mount);
error = target_mount(mnt_opts, diskdev, ptn, error = target_mount_do(lbl->mnt_opts, devdev, lbl->pi_mount);
lbl->pi_mount);
if (error) { if (error) {
msg_display(MSG_mountfail, msg_display(MSG_mountfail, dev, ' ', lbl->pi_mount);
diskdev, 'a' + ptn, lbl->pi_mount);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return error; return error;
} }
} }
free(devdev);
free(dev);
} }
return 0; return 0;
} }
@ -726,21 +820,27 @@ make_fstab(void)
FILE *f; FILE *f;
int i, swap_dev = -1; int i, swap_dev = -1;
const char *dump_dev; const char *dump_dev;
char *dev = NULL;
pm_devs_t *pm_i;
#ifndef HAVE_TMPFS
pm_devs_t *pm_with_swap;
#endif
/* Create the fstab. */ /* Create the fstab. */
make_target_dir("/etc"); make_target_dir("/etc");
f = target_fopen("/etc/fstab", "w"); f = target_fopen("/etc/fstab", "w");
if (logfp)
(void)fprintf(logfp,
"Creating %s/etc/fstab.\n", target_prefix());
scripting_fprintf(NULL, "cat <<EOF >%s/etc/fstab\n", target_prefix()); scripting_fprintf(NULL, "cat <<EOF >%s/etc/fstab\n", target_prefix());
if (logfp)
(void)fprintf(logfp,
"Making %s/etc/fstab (%s).\n", target_prefix(), pm->diskdev);
if (f == NULL) { if (f == NULL) {
#ifndef DEBUG
msg_display(MSG_createfstab); msg_display(MSG_createfstab);
if (logfp) if (logfp)
(void)fprintf(logfp, "Failed to make /etc/fstab!\n"); (void)fprintf(logfp, "Failed to make /etc/fstab!\n");
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
#ifndef DEBUG
return 1; return 1;
#else #else
f = stdout; f = stdout;
@ -748,87 +848,114 @@ make_fstab(void)
} }
scripting_fprintf(f, "# NetBSD %s/etc/fstab\n# See /usr/share/examples/" scripting_fprintf(f, "# NetBSD %s/etc/fstab\n# See /usr/share/examples/"
"fstab/ for more examples.\n", target_prefix()); "fstab/ for more examples.\n", target_prefix());
for (i = 0; i < getmaxpartitions(); i++) { if (! partman_go) {
const char *s = ""; /* We want to process only one disk... */
const char *mp = bsdlabel[i].pi_mount; pm_i = pm;
const char *fstype = "ffs"; goto onlyonediskinfstab;
int fsck_pass = 0, dump_freq = 0;
if (!*mp) {
/*
* No mount point specified, comment out line and
* use /mnt as a placeholder for the mount point.
*/
s = "# ";
mp = "/mnt";
}
switch (bsdlabel[i].pi_fstype) {
case FS_UNUSED:
continue;
case FS_BSDLFS:
/* If there is no LFS, just comment it out. */
if (!check_lfs_progs())
s = "# ";
fstype = "lfs";
/* FALLTHROUGH */
case FS_BSDFFS:
fsck_pass = (strcmp(mp, "/") == 0) ? 1 : 2;
dump_freq = 1;
break;
case FS_MSDOS:
fstype = "msdos";
break;
case FS_SWAP:
if (swap_dev == -1) {
swap_dev = i;
dump_dev = ",dp";
} else {
dump_dev ="";
}
scripting_fprintf(f, "/dev/%s%c\t\tnone\tswap\tsw%s\t\t 0 0\n",
diskdev, 'a' + i, dump_dev);
continue;
#ifdef USE_SYSVBFS
case FS_SYSVBFS:
fstype = "sysvbfs";
make_target_dir("/stand");
break;
#endif
default:
fstype = "???";
s = "# ";
break;
}
/* The code that remounts root rw doesn't check the partition */
if (strcmp(mp, "/") == 0 && !(bsdlabel[i].pi_flags & PIF_MOUNT))
s = "# ";
scripting_fprintf(f,
"%s/dev/%s%c\t\t%s\t%s\trw%s%s%s%s%s%s%s%s\t\t %d %d\n",
s, diskdev, 'a' + i, mp, fstype,
bsdlabel[i].pi_flags & PIF_LOG ? ",log" : "",
bsdlabel[i].pi_flags & PIF_MOUNT ? "" : ",noauto",
bsdlabel[i].pi_flags & PIF_ASYNC ? ",async" : "",
bsdlabel[i].pi_flags & PIF_NOATIME ? ",noatime" : "",
bsdlabel[i].pi_flags & PIF_NODEV ? ",nodev" : "",
bsdlabel[i].pi_flags & PIF_NODEVMTIME ? ",nodevmtime" : "",
bsdlabel[i].pi_flags & PIF_NOEXEC ? ",noexec" : "",
bsdlabel[i].pi_flags & PIF_NOSUID ? ",nosuid" : "",
dump_freq, fsck_pass);
} }
SLIST_FOREACH(pm_i, &pm_head, l) {
onlyonediskinfstab:
for (i = 0; i < getmaxpartitions(); i++) {
const char *s = "";
const char *mp = pm_i->bsdlabel[i].pi_mount;
const char *fstype = "ffs";
int fsck_pass = 0, dump_freq = 0;
if (dev != NULL)
free(dev);
if (pm_i->isspecial)
asprintf(&dev, "%s", pm_i->diskdev);
else
asprintf(&dev, "%s%c", pm_i->diskdev, 'a' + i);
if (dev == NULL)
return (ENOMEM);
if (!*mp) {
/*
* No mount point specified, comment out line and
* use /mnt as a placeholder for the mount point.
*/
s = "# ";
mp = "/mnt";
}
switch (pm_i->bsdlabel[i].pi_fstype) {
case FS_UNUSED:
continue;
case FS_BSDLFS:
/* If there is no LFS, just comment it out. */
if (!check_lfs_progs())
s = "# ";
fstype = "lfs";
/* FALLTHROUGH */
case FS_BSDFFS:
fsck_pass = (strcmp(mp, "/") == 0) ? 1 : 2;
dump_freq = 1;
break;
case FS_MSDOS:
fstype = "msdos";
break;
case FS_SWAP:
if (pm_i->isspecial)
continue;
if (swap_dev == -1) {
swap_dev = i;
dump_dev = ",dp";
#ifndef HAVE_TMPFS
pm_with_swap = pm_i;
#endif
} else {
dump_dev = "";
}
scripting_fprintf(f, "/dev/%s\t\tnone\tswap\tsw%s\t\t 0 0\n",
dev, dump_dev);
continue;
#ifdef USE_SYSVBFS
case FS_SYSVBFS:
fstype = "sysvbfs";
make_target_dir("/stand");
break;
#endif
default:
fstype = "???";
s = "# ";
break;
}
/* The code that remounts root rw doesn't check the partition */
if (strcmp(mp, "/") == 0 && !(pm_i->bsdlabel[i].pi_flags & PIF_MOUNT))
s = "# ";
scripting_fprintf(f,
"%s/dev/%s\t\t%s\t%s\trw%s%s%s%s%s%s%s%s\t\t %d %d\n",
s, dev, mp, fstype,
pm_i->bsdlabel[i].pi_flags & PIF_LOG ? ",log" : "",
pm_i->bsdlabel[i].pi_flags & PIF_MOUNT ? "" : ",noauto",
pm_i->bsdlabel[i].pi_flags & PIF_ASYNC ? ",async" : "",
pm_i->bsdlabel[i].pi_flags & PIF_NOATIME ? ",noatime" : "",
pm_i->bsdlabel[i].pi_flags & PIF_NODEV ? ",nodev" : "",
pm_i->bsdlabel[i].pi_flags & PIF_NODEVMTIME ? ",nodevmtime" : "",
pm_i->bsdlabel[i].pi_flags & PIF_NOEXEC ? ",noexec" : "",
pm_i->bsdlabel[i].pi_flags & PIF_NOSUID ? ",nosuid" : "",
dump_freq, fsck_pass);
if (pm_i->isspecial)
/* Special device (such as dk*) have only one partition */
break;
}
/* Simple install, only one disk */
if (!partman_go)
break;
}
if (tmp_ramdisk_size != 0) { if (tmp_ramdisk_size != 0) {
#ifdef HAVE_TMPFS #ifdef HAVE_TMPFS
scripting_fprintf(f, "tmpfs\t\t/tmp\ttmpfs\trw,-m=1777,-s=%" scripting_fprintf(f, "tmpfs\t\t/tmp\ttmpfs\trw,-m=1777,-s=%"
PRIi64 "\n", PRIi64 "\n",
tmp_ramdisk_size * 512); tmp_ramdisk_size * 512);
#else #else
if (swap_dev != -1) if (swap_dev != -1 && pm_with_swap != NULL)
scripting_fprintf(f, "/dev/%s%c\t\t/tmp\tmfs\trw,-s=%" scripting_fprintf(f, "/dev/%s%c\t\t/tmp\tmfs\trw,-s=%"
PRIi64 "\n", PRIi64 "\n",
diskdev, 'a' + swap_dev, tmp_ramdisk_size); pm_with_swap->diskdev, 'a' + swap_dev, tmp_ramdisk_size);
else else
scripting_fprintf(f, "swap\t\t/tmp\tmfs\trw,-s=%" scripting_fprintf(f, "swap\t\t/tmp\tmfs\trw,-s=%"
PRIi64 "\n", PRIi64 "\n",
@ -852,10 +979,10 @@ make_fstab(void)
scripting_fprintf(NULL, "EOF\n"); scripting_fprintf(NULL, "EOF\n");
#ifndef DEBUG if (dev != NULL)
free(dev);
fclose(f); fclose(f);
fflush(NULL); fflush(NULL);
#endif
return 0; return 0;
} }
@ -914,7 +1041,7 @@ fsck_preen(const char *disk, int ptn, const char *fsname)
char *prog; char *prog;
int error; int error;
ptn += 'a'; ptn = (ptn < 0)? 0 : 'a' + ptn;
if (fsname == NULL) if (fsname == NULL)
return 0; return 0;
/* first, check if fsck program exists, if not, assume ok */ /* first, check if fsck program exists, if not, assume ok */
@ -998,8 +1125,9 @@ static int
mount_root(void) mount_root(void)
{ {
int error; int error;
int ptn = (pm->isspecial)? 0 - 'a' : pm->rootpart;
error = fsck_preen(diskdev, rootpart, "ffs"); error = fsck_preen(pm->diskdev, ptn, "ffs");
if (error != 0) if (error != 0)
return error; return error;
@ -1011,7 +1139,7 @@ mount_root(void)
* XXX consider -o remount in case target root is * XXX consider -o remount in case target root is
* current root, still readonly from single-user? * current root, still readonly from single-user?
*/ */
return target_mount("", diskdev, rootpart, ""); return target_mount("", pm->diskdev, ptn, "");
} }
/* Get information on the file systems mounted from the root filesystem. /* Get information on the file systems mounted from the root filesystem.
@ -1049,7 +1177,7 @@ mount_disks(void)
/* Check the target /etc/fstab exists before trying to parse it. */ /* Check the target /etc/fstab exists before trying to parse it. */
if (target_dir_exists_p("/etc") == 0 || if (target_dir_exists_p("/etc") == 0 ||
target_file_exists_p("/etc/fstab") == 0) { target_file_exists_p("/etc/fstab") == 0) {
msg_display(MSG_noetcfstab, diskdev); msg_display(MSG_noetcfstab, pm->diskdev);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return -1; return -1;
} }
@ -1059,9 +1187,9 @@ mount_disks(void)
fstabsize = target_collect_file(T_FILE, &fstab, "/etc/fstab"); fstabsize = target_collect_file(T_FILE, &fstab, "/etc/fstab");
if (fstabsize < 0) { if (fstabsize < 0) {
/* error ! */ /* error ! */
msg_display(MSG_badetcfstab, diskdev); msg_display(MSG_badetcfstab, pm->diskdev);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return -1; return -2;
} }
error = walk(fstab, (size_t)fstabsize, fstabbuf, numfstabbuf); error = walk(fstab, (size_t)fstabsize, fstabbuf, numfstabbuf);
free(fstab); free(fstab);
@ -1077,7 +1205,7 @@ set_swap(const char *disk, partinfo *pp)
int rval; int rval;
if (pp == NULL) if (pp == NULL)
pp = oldlabel; pp = pm->oldlabel;
for (i = 0; i < MAXPARTITIONS; i++) { for (i = 0; i < MAXPARTITIONS; i++) {
if (pp[i].pi_fstype != FS_SWAP) if (pp[i].pi_fstype != FS_SWAP)
@ -1153,11 +1281,11 @@ bootxx_name(void)
char *bootxx; char *bootxx;
/* check we have boot code for the root partition type */ /* check we have boot code for the root partition type */
fstype = bsdlabel[rootpart].pi_fstype; fstype = pm->bsdlabel[pm->rootpart].pi_fstype;
switch (fstype) { switch (fstype) {
#if defined(BOOTXX_FFSV1) || defined(BOOTXX_FFSV2) #if defined(BOOTXX_FFSV1) || defined(BOOTXX_FFSV2)
case FS_BSDFFS: case FS_BSDFFS:
if (bsdlabel[rootpart].pi_flags & PIF_FFSv2) { if (pm->bsdlabel[pm->rootpart].pi_flags & PIF_FFSv2) {
#ifdef BOOTXX_FFSV2 #ifdef BOOTXX_FFSV2
bootxxname = BOOTXX_FFSV2; bootxxname = BOOTXX_FFSV2;
#else #else
@ -1189,3 +1317,147 @@ bootxx_name(void)
return bootxx; return bootxx;
} }
#endif #endif
static int
get_fsid_by_gptuuid(const char *str)
{
int i;
uuid_t uuid;
uint32_t status;
uuid_from_string(str, &uuid, &status);
if (status == uuid_s_ok) {
for (i = 0; gpt_filesystems[i].id > 0; i++)
if (uuid_equal(&uuid, &(gpt_filesystems[i].uuid), NULL))
return gpt_filesystems[i].id;
}
return FS_OTHER;
}
const char *
get_gptfs_by_id(int filesystem)
{
int i;
for (i = 0; gpt_filesystems[i].id > 0; i++)
if (filesystem == gpt_filesystems[i].id)
return gpt_filesystems[i].name;
return NULL;
}
/* from dkctl.c */
static int
get_dkwedges_sort(const void *a, const void *b)
{
const struct dkwedge_info *dkwa = a, *dkwb = b;
const daddr_t oa = dkwa->dkw_offset, ob = dkwb->dkw_offset;
return (oa < ob) ? -1 : (oa > ob) ? 1 : 0;
}
int
get_dkwedges(struct dkwedge_info **dkw, const char *diskdev)
{
int fd;
char buf[STRSIZE];
size_t bufsize;
struct dkwedge_list dkwl;
*dkw = NULL;
dkwl.dkwl_buf = *dkw;
dkwl.dkwl_bufsize = 0;
fd = opendisk(diskdev, O_RDONLY, buf, STRSIZE, 0);
if (fd < 0)
return -1;
for (;;) {
if (ioctl(fd, DIOCLWEDGES, &dkwl) == -1)
return -2;
if (dkwl.dkwl_nwedges == dkwl.dkwl_ncopied)
break;
bufsize = dkwl.dkwl_nwedges * sizeof(**dkw);
if (dkwl.dkwl_bufsize < bufsize) {
*dkw = realloc(dkwl.dkwl_buf, bufsize);
if (*dkw == NULL)
return -3;
dkwl.dkwl_buf = *dkw;
dkwl.dkwl_bufsize = bufsize;
}
}
if (dkwl.dkwl_nwedges > 0)
qsort(*dkw, dkwl.dkwl_nwedges, sizeof(**dkw), get_dkwedges_sort);
close(fd);
return dkwl.dkwl_nwedges;
}
/* XXX: rewrite */
static int
incoregpt(pm_devs_t *pm_cur, partinfo *lp)
{
int i, num;
uint32_t p_start, p_size, p_num;
char *textbuf, *t, *tt, p_type[STRSIZE];
struct dkwedge_info *dkw;
num = get_dkwedges(&dkw, pm_cur->diskdev);
if (dkw != NULL) {
for (i = 0; i < num && i < MAX_WEDGES; i++)
run_program(RUN_SILENT, "dkctl %s delwedge %s",
pm_cur->diskdev, dkw[i].dkw_devname);
free (dkw);
}
if (collect(T_OUTPUT, &textbuf, "gpt show -u %s 2>/dev/null", pm_cur->diskdev) < 1)
return -1;
(void)strtok(textbuf, "\n"); /* ignore first line */
while ((t = strtok(NULL, "\n")) != NULL) {
i = 0; p_start = -1; p_size = -1; p_num = -1; strcpy(p_type, ""); /* init */
while ((tt = strsep(&t, " \t")) != NULL) {
if (strlen(tt) < 1)
continue;
if (i == 0)
p_start = atoi(tt);
if (i == 1)
p_size = atoi(tt);
if (i == 2)
p_num = atoi(tt);
if (i > 2 || (i == 2 && p_num == 0))
if (
strcmp(tt, "GPT") &&
strcmp(tt, "part") &&
strcmp(tt, "-")
)
strncat(p_type, tt, STRSIZE);
i++;
}
if (p_start < 1 || p_size < 1)
continue;
else if (! strcmp(p_type, "Pritable"))
pm_cur->ptstart = p_start + p_size;
else if (! strcmp(p_type, "Sectable"))
pm_cur->ptsize = p_start - pm_cur->ptstart - 1;
else if (p_num < 1 && strlen(p_type) > 0)
/* Utilitary entry (PMBR, etc) */
continue;
else if (p_num < 1) {
/* Free space */
continue;
} else {
/* Usual partition */
lp[p_num].pi_size = p_size;
lp[p_num].pi_offset = p_start;
lp[p_num].pi_fstype = get_fsid_by_gptuuid(p_type);
}
}
free(textbuf);
return 0;
}
static int
is_gpt(const char *dev)
{
return ! run_program(RUN_SILENT | RUN_ERROR_OK,
"sh -c 'gpt show %s |grep -e Pri\\ GPT\\ table'", dev);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: install.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: install.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -45,71 +45,73 @@
void void
do_install(void) do_install(void)
{ {
int find_disks_ret;
int retcode = 0;
partman_go = -1;
#ifndef DEBUG
msg_display(MSG_installusure); msg_display(MSG_installusure);
process_menu(MENU_noyes, NULL); process_menu(MENU_noyes, NULL);
if (!yesno) if (!yesno)
return; return;
#endif
get_ramsize(); get_ramsize();
if (find_disks(msg_string(MSG_install)) < 0) /* Create and mount partitions */
return; find_disks_ret = find_disks(msg_string(MSG_install));
clear(); if (partman_go == 1) {
refresh(); if (partman() < 0) {
msg_display(MSG_abort);
if (check_swap(diskdev, 0) > 0) {
msg_display(MSG_swapactive);
process_menu(MENU_ok, NULL);
if (check_swap(diskdev, 1) < 0) {
msg_display(MSG_swapdelfailed);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
if (!debug) return;
return;
} }
} else if (find_disks_ret < 0)
return;
else {
/* Classical partitioning wizard */
partman_go = 0;
clear();
refresh();
if (check_swap(pm->diskdev, 0) > 0) {
msg_display(MSG_swapactive);
process_menu(MENU_ok, NULL);
if (check_swap(pm->diskdev, 1) < 0) {
msg_display(MSG_swapdelfailed);
process_menu(MENU_ok, NULL);
if (!debug)
return;
}
}
if (!md_get_info() || md_make_bsd_partitions() == 0) {
msg_display(MSG_abort);
process_menu(MENU_ok, NULL);
return;
}
/* Last chance ... do you really want to do this? */
clear();
refresh();
msg_display(MSG_lastchance, pm->diskdev);
process_menu(MENU_noyes, NULL);
if (!yesno)
return;
if (md_pre_disklabel() != 0 ||
write_disklabel() != 0 ||
md_post_disklabel() != 0 ||
make_filesystems() ||
make_fstab() != 0 ||
md_post_newfs() != 0)
return;
} }
process_menu(MENU_distset, NULL);
if (!md_get_info()) {
msg_display(MSG_abort);
process_menu(MENU_ok, NULL);
return;
}
if (md_make_bsd_partitions() == 0) {
msg_display(MSG_abort);
process_menu(MENU_ok, NULL);
return;
}
/* Last chance ... do you really want to do this? */
clear();
refresh();
msg_display(MSG_lastchance, diskdev);
process_menu(MENU_noyes, NULL);
if (!yesno)
return;
if (md_pre_disklabel() != 0)
return;
if (write_disklabel() != 0)
return;
if (md_post_disklabel() != 0)
return;
if (make_filesystems())
return;
if (make_fstab() != 0)
return;
if (md_post_newfs() != 0)
return;
/* Unpack the distribution. */ /* Unpack the distribution. */
process_menu(MENU_distset, &retcode);
if (retcode == 0)
return;
if (get_and_unpack_sets(0, MSG_disksetupdone, if (get_and_unpack_sets(0, MSG_disksetupdone,
MSG_extractcomplete, MSG_abortinst) != 0) MSG_extractcomplete, MSG_abortinst) != 0)
return; return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: label.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: label.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Jonathan Stone * Copyright 1997 Jonathan Stone
@ -36,7 +36,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: label.c,v 1.1 2014/07/26 19:30:44 dholland Exp $"); __RCSID("$NetBSD: label.c,v 1.2 2014/08/03 16:09:38 martin Exp $");
#endif #endif
#include <sys/types.h> #include <sys/types.h>
@ -141,6 +141,17 @@ checklabel(partinfo *lp, int nparts, int rawpart, int bsdpart,
return (0); return (0);
} }
int
checkoverlap(partinfo *lp, int nparts, int rawpart, int bsdpart)
{
int i, j;
if (checklabel(lp, nparts, rawpart, bsdpart, &i, &j)) {
msg_display(MSG_partitions_overlap,'a'+i,'a'+j);
return 1;
}
return 0;
}
static int static int
check_one_root(partinfo *lp, int nparts) check_one_root(partinfo *lp, int nparts)
{ {
@ -161,7 +172,7 @@ check_one_root(partinfo *lp, int nparts)
return 0; return 0;
foundroot = 1; foundroot = 1;
/* Save partition number, a few things need to know it */ /* Save partition number, a few things need to know it */
rootpart = part; pm->rootpart = part;
} }
return foundroot; return foundroot;
} }
@ -193,7 +204,7 @@ edit_fs_size(menudesc *m, void *arg)
size = getpartsize(p->pi_offset, p->pi_size); size = getpartsize(p->pi_offset, p->pi_size);
if (size == ~0u) if (size == ~0u)
size = dlsize - p->pi_offset; size = pm->dlsize - p->pi_offset;
p->pi_size = size; p->pi_size = size;
if (size == 0) { if (size == 0) {
p->pi_offset = 0; p->pi_offset = 0;
@ -358,7 +369,7 @@ static void set_ptn_header(menudesc *m, void *arg);
static void set_ptn_label(menudesc *m, int opt, void *arg); static void set_ptn_label(menudesc *m, int opt, void *arg);
int all_fstype_menu = -1; int all_fstype_menu = -1;
static int int
edit_ptn(menudesc *menu, void *arg) edit_ptn(menudesc *menu, void *arg)
{ {
static menu_ent fs_fields[] = { static menu_ent fs_fields[] = {
@ -413,7 +424,7 @@ edit_ptn(menudesc *menu, void *arg)
get_fstype, NULL, NULL, NULL, MSG_unchanged); get_fstype, NULL, NULL, NULL, MSG_unchanged);
} }
p = bsdlabel + menu->cursel; p = pm->bsdlabel + menu->cursel;
p->pi_flags &= ~PIF_RESET; p->pi_flags &= ~PIF_RESET;
p_save = *p; p_save = *p;
for (;;) { for (;;) {
@ -434,7 +445,7 @@ set_ptn_header(menudesc *m, void *arg)
int t; int t;
msg_clear(); msg_clear();
msg_table_add(MSG_edfspart, 'a' + (p - bsdlabel)); msg_table_add(MSG_edfspart, 'a' + (p - pm->bsdlabel));
/* Determine which of the properties can be changed */ /* Determine which of the properties can be changed */
for (i = PTN_MENU_START; i <= PTN_MENU_MOUNTPT; i++) { for (i = PTN_MENU_START; i <= PTN_MENU_MOUNTPT; i++) {
@ -476,10 +487,10 @@ set_ptn_header(menudesc *m, void *arg)
static void static void
disp_sector_count(menudesc *m, msg fmt, uint s) disp_sector_count(menudesc *m, msg fmt, uint s)
{ {
uint ms = MEG / sectorsize; uint ms = MEG / pm->sectorsize;
wprintw(m->mw, msg_string(fmt), wprintw(m->mw, msg_string(fmt),
s / ms, s / dlcylsize, s % dlcylsize ? '*' : ' ', s ); s / ms, s / pm->dlcylsize, s % pm->dlcylsize ? '*' : ' ', s );
} }
static void static void
@ -590,7 +601,7 @@ set_label_texts(menudesc *menu, void *arg)
m->opt_flags = OPT_IGNORE; m->opt_flags = OPT_IGNORE;
} else { } else {
m->opt_flags = 0; m->opt_flags = 0;
if (bsdlabel[ptn].pi_fstype == FS_UNUSED) if (pm->bsdlabel[ptn].pi_fstype == FS_UNUSED)
continue; continue;
} }
show_unused_ptn = ptn + 2; show_unused_ptn = ptn + 2;
@ -644,24 +655,19 @@ edit_and_check_label(partinfo *lp, int nparts, int rawpart, int bsdpart)
return 1; return 1;
pi.flags = 0; pi.flags = 0;
current_cylsize = dlcylsize; pm->current_cylsize = pm->dlcylsize;
for (;;) { for (;;) {
int i, j;
/* first give the user the option to edit the label... */ /* first give the user the option to edit the label... */
process_menu(menu_no, &pi); process_menu(menu_no, &pi);
/* User thinks the label is OK. */ /* User thinks the label is OK. */
/* check we have a single root fs */ /* check we have a single root fs */
if (check_one_root(lp, nparts) == 0) if (check_one_root(lp, nparts) == 0 && partman_go == 0)
msg_display(MSG_must_be_one_root); msg_display(MSG_must_be_one_root);
else else
/* Check for overlaps */ /* Check for overlaps */
if (checklabel(lp, nparts, rawpart, bsdpart, &i, &j)) if (checkoverlap(lp, nparts, rawpart, bsdpart) == 0)
/* partitions overlap */
msg_display(MSG_partitions_overlap,'a'+i,'a'+j);
else
return 1; return 1;
/*XXX ???*/ /*XXX ???*/
@ -701,7 +707,7 @@ incorelabel(const char *dkname, partinfo *lp)
* than d_diskname. Who knows why, but pull the value back here. * than d_diskname. Who knows why, but pull the value back here.
*/ */
if (lab.d_typename[0] != 0 && strcmp(lab.d_typename, "unknown") != 0) if (lab.d_typename[0] != 0 && strcmp(lab.d_typename, "unknown") != 0)
strlcpy(bsddiskname, lab.d_typename, sizeof bsddiskname); strlcpy(pm->bsddiskname, lab.d_typename, sizeof pm->bsddiskname);
fd = opendisk(dkname, O_RDONLY, buf, sizeof buf, 0); fd = opendisk(dkname, O_RDONLY, buf, sizeof buf, 0);
pp = &lab.d_partitions[0]; pp = &lab.d_partitions[0];
@ -821,10 +827,10 @@ getpartoff(uint32_t defpartstart)
if (isize[1] == '\0' && isize[0] >= 'a' && if (isize[1] == '\0' && isize[0] >= 'a' &&
isize[0] <= maxpartc) { isize[0] <= maxpartc) {
partn = isize[0] - 'a'; partn = isize[0] - 'a';
i = bsdlabel[partn].pi_size + bsdlabel[partn].pi_offset; i = pm->bsdlabel[partn].pi_size + pm->bsdlabel[partn].pi_offset;
localsizemult = 1; localsizemult = 1;
} else if (atoi(isize) == -1) { } else if (atoi(isize) == -1) {
i = ptstart; i = pm->ptstart;
localsizemult = 1; localsizemult = 1;
} else { } else {
if (atofsb(isize, &i, &localsizemult)) { if (atofsb(isize, &i, &localsizemult)) {
@ -833,13 +839,13 @@ getpartoff(uint32_t defpartstart)
} }
} }
/* round to cylinder size if localsizemult != 1 */ /* round to cylinder size if localsizemult != 1 */
i = NUMSEC(i/localsizemult, localsizemult, dlcylsize); i = NUMSEC(i/localsizemult, localsizemult, pm->dlcylsize);
/* Adjust to start of slice if needed */ /* Adjust to start of slice if needed */
if ((i < ptstart && (ptstart - i) < localsizemult) || if ((i < pm->ptstart && (pm->ptstart - i) < localsizemult) ||
(i > ptstart && (i - ptstart) < localsizemult)) { (i > pm->ptstart && (i - pm->ptstart) < localsizemult)) {
i = ptstart; i = pm->ptstart;
} }
if (i <= dlsize) if (i <= pm->dlsize)
break; break;
errmsg = msg_string(MSG_startoutsidedisk); errmsg = msg_string(MSG_startoutsidedisk);
} }
@ -854,7 +860,7 @@ getpartsize(uint32_t partstart, uint32_t defpartsize)
char dsize[20], isize[20], maxpartc; char dsize[20], isize[20], maxpartc;
const char *errmsg = "\n"; const char *errmsg = "\n";
uint32_t i, partend, localsizemult; uint32_t i, partend, localsizemult;
uint32_t fsptend = ptstart + ptsize; uint32_t fsptend = pm->ptstart + pm->ptsize;
int partn; int partn;
maxpartc = 'a' + getmaxpartitions() - 1; maxpartc = 'a' + getmaxpartitions() - 1;
@ -868,7 +874,7 @@ getpartsize(uint32_t partstart, uint32_t defpartsize)
if (isize[1] == '\0' && isize[0] >= 'a' && if (isize[1] == '\0' && isize[0] >= 'a' &&
isize[0] <= maxpartc) { isize[0] <= maxpartc) {
partn = isize[0] - 'a'; partn = isize[0] - 'a';
i = bsdlabel[partn].pi_offset - partstart; i = pm->bsdlabel[partn].pi_offset - partstart;
localsizemult = 1; localsizemult = 1;
} else if (atoi(isize) == -1) { } else if (atoi(isize) == -1) {
i = fsptend - partstart; i = fsptend - partstart;
@ -884,17 +890,17 @@ getpartsize(uint32_t partstart, uint32_t defpartsize)
* is not 1 sector * is not 1 sector
*/ */
partend = NUMSEC((partstart + i) / localsizemult, partend = NUMSEC((partstart + i) / localsizemult,
localsizemult, dlcylsize); localsizemult, pm->dlcylsize);
/* Align to end-of-disk or end-of-slice if close enough */ /* Align to end-of-disk or end-of-slice if close enough */
if (partend > (dlsize - localsizemult) if (partend > (pm->dlsize - localsizemult)
&& partend < (dlsize + localsizemult)) && partend < (pm->dlsize + localsizemult))
partend = dlsize; partend = pm->dlsize;
if (partend > (fsptend - localsizemult) if (partend > (fsptend - localsizemult)
&& partend < (fsptend + localsizemult)) && partend < (fsptend + localsizemult))
partend = fsptend; partend = fsptend;
/* sanity checks */ /* sanity checks */
if (partend > dlsize) { if (partend > pm->dlsize) {
partend = dlsize; partend = pm->dlsize;
msg_prompt_win(MSG_endoutsidedisk, -1, 13, 70, 6, msg_prompt_win(MSG_endoutsidedisk, -1, 13, 70, 6,
NULL, isize, 1, NULL, isize, 1,
(partend - partstart) / sizemult, multname); (partend - partstart) / sizemult, multname);
@ -937,15 +943,15 @@ atofsb(const char *str, uint32_t *p_val, uint32_t *localsizemult)
} }
if (str[i] == 'G' || str[i] == 'g') { if (str[i] == 'G' || str[i] == 'g') {
val *= 1024; val *= 1024;
*localsizemult = MEG / sectorsize; *localsizemult = MEG / pm->sectorsize;
break; break;
} }
if (str[i] == 'M' || str[i] == 'm') { if (str[i] == 'M' || str[i] == 'm') {
*localsizemult = MEG / sectorsize; *localsizemult = MEG / pm->sectorsize;
break; break;
} }
if (str[i] == 'c') { if (str[i] == 'c') {
*localsizemult = dlcylsize; *localsizemult = pm->dlcylsize;
break; break;
} }
if (str[i] == 's') { if (str[i] == 's') {

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: main.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -67,8 +67,17 @@ FILE *script; /* script file */
extern int log_flip(void); extern int log_flip(void);
#endif #endif
/* Definion for colors */
struct {
unsigned int bg;
unsigned int fg;
} clr_arg;
/* String defaults and stuff for processing the -f file argument. */ /* String defaults and stuff for processing the -f file argument. */
static char bsddiskname[DISKNAME_SIZE]; /* default name for fist selected disk */
struct f_arg { struct f_arg {
const char *name; const char *name;
const char *dflt; const char *dflt;
@ -119,14 +128,19 @@ static void
init(void) init(void)
{ {
const struct f_arg *arg; const struct f_arg *arg;
sizemult = 1; sizemult = 1;
disktype = "unknown"; multname = msg_string(MSG_secname);
tmp_ramdisk_size = 0; tmp_ramdisk_size = 0;
doessf = "";
clean_xfer_dir = 0; clean_xfer_dir = 0;
mnt2_mounted = 0; mnt2_mounted = 0;
fd_type = "msdos"; fd_type = "msdos";
layoutkind = LY_SETNEW;
pm_head = (struct pm_head_t) SLIST_HEAD_INITIALIZER(pm_head);
SLIST_INIT(&pm_head);
pm_new = malloc (sizeof (pm_devs_t));
memset(pm_new, 0, sizeof *pm_new);
for (arg = fflagopts; arg->name != NULL; arg++) { for (arg = fflagopts; arg->name != NULL; arg++) {
if (arg->var == cdrom_dev) if (arg->var == cdrom_dev)
@ -134,7 +148,11 @@ init(void)
else else
strlcpy(arg->var, arg->dflt, arg->size); strlcpy(arg->var, arg->dflt, arg->size);
} }
strlcpy(pm_new->bsddiskname, bsddiskname, sizeof pm_new->bsddiskname);
pkg.xfer_type = pkgsrc.xfer_type = "http"; pkg.xfer_type = pkgsrc.xfer_type = "http";
clr_arg.bg=COLOR_BLUE;
clr_arg.fg=COLOR_WHITE;
} }
__weakref_visible void prelim_menu(void) __weakref_visible void prelim_menu(void)
@ -143,13 +161,13 @@ __weakref_visible void prelim_menu(void)
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
WINDOW *win;
int ch; int ch;
init(); init();
#ifdef DEBUG #ifdef DEBUG
log_flip(); log_flip();
#endif #endif
/* Check for TERM ... */ /* Check for TERM ... */
if (!getenv("TERM")) { if (!getenv("TERM")) {
(void)fprintf(stderr, (void)fprintf(stderr,
@ -158,7 +176,7 @@ main(int argc, char **argv)
} }
/* argv processing */ /* argv processing */
while ((ch = getopt(argc, argv, "Dr:f:")) != -1) while ((ch = getopt(argc, argv, "Dr:f:C:p")) != -1)
switch(ch) { switch(ch) {
case 'D': /* set to get past certain errors in testing */ case 'D': /* set to get past certain errors in testing */
debug = 1; debug = 1;
@ -171,6 +189,14 @@ main(int argc, char **argv)
/* Definition file to read. */ /* Definition file to read. */
process_f_flag(optarg); process_f_flag(optarg);
break; break;
case 'C':
/* Define colors */
sscanf(optarg, "%u:%u", &clr_arg.bg, &clr_arg.fg);
break;
case 'p':
/* Partition tool */
partman_go = 1;
break;
case '?': case '?':
default: default:
usage(); usage();
@ -188,21 +214,19 @@ main(int argc, char **argv)
* Put 'messages' in a window that has a one-character border * Put 'messages' in a window that has a one-character border
* on the real screen. * on the real screen.
*/ */
win = newwin(getmaxy(stdscr) - 2, getmaxx(stdscr) - 2, 1, 1); mainwin = newwin(getmaxy(stdscr) - 2, getmaxx(stdscr) - 2, 1, 1);
if (win == NULL) { if (mainwin == NULL) {
(void)fprintf(stderr, (void)fprintf(stderr,
"sysinst: screen too small\n"); "sysinst: screen too small\n");
exit(1); exit(1);
} }
if (has_colors()) { if (has_colors()) {
/* start_color();
* XXX This color trick should be done so much better, do_coloring(clr_arg.fg,clr_arg.bg);
* but is it worth it? } else {
*/ remove_color_options();
wbkgd(win, COLOR_PAIR(1));
wattrset(win, COLOR_PAIR(1));
} }
msg_window(win); msg_window(mainwin);
/* Watch for signals and clean up */ /* Watch for signals and clean up */
(void)atexit(cleanup); (void)atexit(cleanup);
@ -227,7 +251,10 @@ main(int argc, char **argv)
#endif #endif
/* Menu processing */ /* Menu processing */
process_menu(MENU_netbsd, NULL); if (partman_go)
partman();
else
process_menu(MENU_netbsd, NULL);
exit_cleanly = 1; exit_cleanly = 1;
return 0; return 0;
@ -344,6 +371,13 @@ select_language(void)
void void
toplevel(void) toplevel(void)
{ {
/*
* Undo any stateful side-effects of previous menu choices.
* XXX must be idempotent, since we get run each time the main
* menu is displayed.
*/
chdir(getenv("HOME"));
unwind_mounts();
/* Display banner message in (english, francais, deutsch..) */ /* Display banner message in (english, francais, deutsch..) */
msg_display(MSG_hello); msg_display(MSG_hello);
@ -351,14 +385,6 @@ toplevel(void)
if (md_may_remove_boot_medium()) if (md_may_remove_boot_medium())
msg_display_add(MSG_md_may_remove_boot_medium); msg_display_add(MSG_md_may_remove_boot_medium);
msg_display_add(MSG_thanks); msg_display_add(MSG_thanks);
/*
* Undo any stateful side-effects of previous menu choices.
* XXX must be idempotent, since we get run each time the main
* menu is displayed.
*/
unwind_mounts();
/* ... */
} }
@ -486,6 +512,7 @@ process_f_flag(char *f_name)
break; break;
} }
} }
strlcpy(pm_new->bsddiskname, bsddiskname, sizeof pm_new->bsddiskname);
fclose(fp); fclose(fp);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: mbr.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: mbr.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -196,8 +196,8 @@ set_bios_geom_with_mbr_guess(void)
int cyl, head; int cyl, head;
daddr_t sec; daddr_t sec;
read_mbr(diskdev, &mbr); read_mbr(pm->diskdev, &mbr);
msg_display(MSG_nobiosgeom, dlcyl, dlhead, dlsec); msg_display(MSG_nobiosgeom, pm->dlcyl, pm->dlhead, pm->dlsec);
if (guess_biosgeom_from_mbr(&mbr, &cyl, &head, &sec) >= 0) if (guess_biosgeom_from_mbr(&mbr, &cyl, &head, &sec) >= 0)
msg_display_add(MSG_biosguess, cyl, head, sec); msg_display_add(MSG_biosguess, cyl, head, sec);
set_bios_geom(cyl, head, sec); set_bios_geom(cyl, head, sec);
@ -227,8 +227,8 @@ set_bios_geom(int cyl, int head, int sec)
bhead = atoi(res); bhead = atoi(res);
} while (bhead <= 0 || bhead > 256); } while (bhead <= 0 || bhead > 256);
bcyl = dlsize / bsec / bhead; bcyl = pm->dlsize / bsec / bhead;
if (dlsize != bcyl * bsec * bhead) if (pm->dlsize != bcyl * bsec * bhead)
bcyl++; bcyl++;
} }
@ -237,7 +237,7 @@ void
disp_cur_geom(void) disp_cur_geom(void)
{ {
msg_display_add(MSG_realgeom, dlcyl, dlhead, dlsec); msg_display_add(MSG_realgeom, pm->dlcyl, pm->dlhead, pm->dlsec);
msg_display_add(MSG_biosgeom, bcyl, bhead, bsec); msg_display_add(MSG_biosgeom, bcyl, bhead, bsec);
} }
#endif #endif
@ -267,7 +267,7 @@ remove_old_partitions(uint start, int64_t size)
if (end == 0) if (end == 0)
return; return;
for (p = oldlabel; p < oldlabel + nelem(oldlabel); p++) { for (p = pm->oldlabel; p < pm->oldlabel + nelem(pm->oldlabel); p++) {
if (p->pi_offset >= end || p->pi_offset + p->pi_size <= start) if (p->pi_offset >= end || p->pi_offset + p->pi_size <= start)
continue; continue;
memset(p, 0, sizeof *p); memset(p, 0, sizeof *p);
@ -282,7 +282,7 @@ find_mbr_space(struct mbr_sector *mbrs, uint *start, uint *size, uint from, int
uint s, e; uint s, e;
check_again: check_again:
sz = dlsize - from; sz = pm->dlsize - from;
for (i = 0; i < MBR_PART_COUNT; i++) { for (i = 0; i < MBR_PART_COUNT; i++) {
if (i == ignore) if (i == ignore)
continue; continue;
@ -1174,7 +1174,7 @@ set_mbr_header(menudesc *m, void *arg)
msg_display(MSG_editparttable); msg_display(MSG_editparttable);
msg_table_add(MSG_part_header, (unsigned long)(dlsize/sizemult), msg_table_add(MSG_part_header, (unsigned long)(pm->dlsize/sizemult),
multname, multname, multname, multname); multname, multname, multname, multname);
if (num_opts == 0) { if (num_opts == 0) {
@ -1242,12 +1242,12 @@ mbr_use_wholedisk(mbr_info_t *mbri)
memset(&mbri->mbrb, 0, sizeof mbri->mbrb); memset(&mbri->mbrb, 0, sizeof mbri->mbrb);
#endif #endif
part[0].mbrp_type = MBR_PTYPE_NETBSD; part[0].mbrp_type = MBR_PTYPE_NETBSD;
part[0].mbrp_size = dlsize - ptn_0_offset; part[0].mbrp_size = pm->dlsize - ptn_0_offset;
part[0].mbrp_start = ptn_0_offset; part[0].mbrp_start = ptn_0_offset;
part[0].mbrp_flag = MBR_PFLAG_ACTIVE; part[0].mbrp_flag = MBR_PFLAG_ACTIVE;
ptstart = ptn_0_offset; pm->ptstart = ptn_0_offset;
ptsize = dlsize - ptn_0_offset; pm->ptsize = pm->dlsize - ptn_0_offset;
return 1; return 1;
} }
@ -1271,9 +1271,13 @@ edit_mbr(mbr_info_t *mbri)
/* Ask full/part */ /* Ask full/part */
part = &mbrs->mbr_parts[0]; part = &mbrs->mbr_parts[0];
get_ptn_alignment(part); /* update ptn_alignment */ get_ptn_alignment(part); /* update ptn_alignment */
msg_display(MSG_fullpart, diskdev); if (partman_go)
process_menu(MENU_fullpart, &usefull); usefull = 0;
else {
msg_display(MSG_fullpart, pm->diskdev);
process_menu(MENU_fullpart, &usefull);
}
/* DOS fdisk label checking and value setting. */ /* DOS fdisk label checking and value setting. */
if (usefull) { if (usefull) {
@ -1310,11 +1314,11 @@ edit_mbr(mbr_info_t *mbri)
/* Default to MB, and use bios geometry for cylinder size */ /* Default to MB, and use bios geometry for cylinder size */
set_sizemultname_meg(); set_sizemultname_meg();
current_cylsize = bhead * bsec; pm->current_cylsize = bhead * bsec;
for (;;) { for (;;) {
ptstart = 0; pm->ptstart = 0;
ptsize = 0; pm->ptsize = 0;
process_menu(mbr_menu, mbri); process_menu(mbr_menu, mbri);
activepart = 0; activepart = 0;
@ -1329,8 +1333,8 @@ edit_mbr(mbr_info_t *mbri)
continue; continue;
start = ext->sector + part->mbrp_start; start = ext->sector + part->mbrp_start;
if (start == mbri->install) { if (start == mbri->install) {
ptstart = mbri->install; pm->ptstart = mbri->install;
ptsize = part->mbrp_size; pm->ptsize = part->mbrp_size;
} }
if (bsdstart != 0) if (bsdstart != 0)
bsdstart = ~0; bsdstart = ~0;
@ -1342,12 +1346,12 @@ edit_mbr(mbr_info_t *mbri)
} }
/* Install in only netbsd partition if none tagged */ /* Install in only netbsd partition if none tagged */
if (ptstart == 0 && bsdstart != ~0u) { if (pm->ptstart == 0 && bsdstart != ~0u) {
ptstart = bsdstart; pm->ptstart = bsdstart;
ptsize = bsdsize; pm->ptsize = bsdsize;
} }
if (ptstart == 0) { if (pm->ptstart == 0) {
if (bsdstart == 0) if (bsdstart == 0)
msg_display(MSG_nobsdpart); msg_display(MSG_nobsdpart);
else else
@ -1455,10 +1459,10 @@ read_mbr(const char *disk, mbr_info_t *mbri)
* partition headers we might have to produce. * partition headers we might have to produce.
*/ */
if (bsec == 0) if (bsec == 0)
bsec = dlsec; bsec = pm->dlsec;
ptn_0_offset = bsec; ptn_0_offset = bsec;
/* use 1MB default offset on large disks as fdisk(8) */ /* use 1MB default offset on large disks as fdisk(8) */
if (dlsize > 2048 * 1024 * 128) if (pm->dlsize > 2048 * 1024 * 128)
ptn_0_offset = 2048; ptn_0_offset = 2048;
memset(mbri, 0, sizeof *mbri); memset(mbri, 0, sizeof *mbri);
@ -1762,13 +1766,13 @@ guess_biosgeom_from_mbr(mbr_info_t *mbri, int *cyl, int *head, daddr_t *sec)
* the invalid physical one. * the invalid physical one.
*/ */
xcylinders = dlcyl; xcylinders = pm->dlcyl;
xheads = dlhead; xheads = pm->dlhead;
xsectors = dlsec; xsectors = pm->dlsec;
if (xcylinders > MAXCYL || xheads > MAXHEAD || xsectors > MAXSECTOR) { if (xcylinders > MAXCYL || xheads > MAXHEAD || xsectors > MAXSECTOR) {
xsectors = MAXSECTOR; xsectors = MAXSECTOR;
xheads = MAXHEAD; xheads = MAXHEAD;
xcylinders = dlsize / (MAXSECTOR * MAXHEAD); xcylinders = pm->dlsize / (MAXSECTOR * MAXHEAD);
if (xcylinders > MAXCYL) if (xcylinders > MAXCYL)
xcylinders = MAXCYL; xcylinders = MAXCYL;
} }
@ -1806,8 +1810,8 @@ guess_biosgeom_from_mbr(mbr_info_t *mbri, int *cyl, int *head, daddr_t *sec)
* Estimate the number of cylinders. * Estimate the number of cylinders.
* XXX relies on get_disks having been called. * XXX relies on get_disks having been called.
*/ */
xcylinders = dlsize / xheads / xsectors; xcylinders = pm->dlsize / xheads / xsectors;
if (dlsize != xcylinders * xheads * xsectors) if (pm->dlsize != xcylinders * xheads * xsectors)
xcylinders++; xcylinders++;
/* /*
@ -1890,7 +1894,7 @@ get_ptn_alignment(struct mbr_partition *mbrp0)
} }
} else { } else {
/* Use 1MB offset for large (>128GB) disks */ /* Use 1MB offset for large (>128GB) disks */
if (dlsize > 2048 * 1024 * 128) { if (pm->dlsize > 2048 * 1024 * 128) {
ptn_alignment = 2048; ptn_alignment = 2048;
ptn_0_offset = 2048; ptn_0_offset = 2048;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: menus.mi,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: menus.mi,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/*- /*-
* Copyright (c) 2003 The NetBSD Foundation, Inc. * Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -48,6 +48,8 @@
#include "msg_defs.h" #include "msg_defs.h"
#include "menu_defs.h" #include "menu_defs.h"
static menudesc menu_def[];
static void static void
src_legend(menudesc *menu, const char *legend, const char *text) src_legend(menudesc *menu, const char *legend, const char *text)
{ {
@ -59,6 +61,34 @@ src_prompt(const char *prompt, char *buf, size_t size)
{ {
msg_prompt_win(prompt, -1, 12, 0, 0, buf, buf, size); msg_prompt_win(prompt, -1, 12, 0, 0, buf, buf, size);
} }
void
remove_color_options()
{
/*
* Current terminal type does not support colors, so remove all
* menu entries (actually that is: Utils/Color Scheme) that do not
* make any sense in this case.
*/
for (size_t i = 0; i < DYN_MENU_START; i++) {
for (int j = 0; j < menu_def[i].numopts; j++) {
if ((menu_def[i].opts[j].opt_flags & OPT_SUB)
&& menu_def[i].opts[j].opt_menu == MENU_colors) {
for (int k = j + 1; k < menu_def[i].numopts;
k++) {
menu_def[i].opts[k-1] =
menu_def[i].opts[k];
}
menu_def[i].numopts--;
return;
}
}
}
}
} }
default y=12, no exit, scrollable; default y=12, no exit, scrollable;
@ -165,7 +195,7 @@ menu netbsd, title MSG_NetBSD_VERSION_Install_System, y=-1,
option MSG_Config_menu, action { do_configmenu(); }; option MSG_Config_menu, action { do_configmenu(); };
menu utility, title MSG_NetBSD_VERSION_Utilities, exit, menu utility, title MSG_NetBSD_VERSION_Utilities, exit,
exitstring MSG_exit_utility_menu; exitstring MSG_exit_menu_generic;
display action { toplevel(); }; display action { toplevel(); };
option MSG_Run_bin_sh, option MSG_Run_bin_sh,
action (endwin) { system("/bin/sh"); }; action (endwin) { system("/bin/sh"); };
@ -174,15 +204,23 @@ menu utility, title MSG_NetBSD_VERSION_Utilities, exit,
option MSG_Configure_network, option MSG_Configure_network,
action { action {
extern int network_up; extern int network_up;
network_up = 0; network_up = 0;
config_network(); config_network();
}; };
/* option MSG_Partition a disk; XXX add later. */ option MSG_Partition_a_disk, action { partman_go = 1; partman(); };
option MSG_Logging_functions, action { do_logging(); }; option MSG_Logging_functions, action { do_logging(); };
option MSG_Color_scheme, sub menu colors;
option MSG_Halt_the_system, exit, option MSG_Halt_the_system, exit,
action (endwin) { system("/sbin/halt -q"); }; action (endwin) { system("/sbin/halt -q"); };
menu colors, title MSG_Color_scheme, exit,
exitstring MSG_exit_menu_generic;
option MSG_White_on_black, action { do_coloring(COLOR_WHITE,COLOR_BLACK); };
option MSG_Black_on_white, action { do_coloring(COLOR_BLACK,COLOR_WHITE); };
option MSG_White_on_blue, action { do_coloring(COLOR_WHITE,COLOR_BLUE); };
option MSG_Green_on_black, action { do_coloring(COLOR_GREEN,COLOR_BLACK); };
menu yesno, y=-10; menu yesno, y=-10;
display action { menu->title = arg ? arg : MSG_yes_or_no; }; display action { menu->title = arg ? arg : MSG_yes_or_no; };
option MSG_Yes, exit, action {yesno = 1;}; option MSG_Yes, exit, action {yesno = 1;};
@ -198,22 +236,22 @@ menu ok, no shortcut, y=-10;
option MSG_Hit_enter_to_continue, exit; option MSG_Hit_enter_to_continue, exit;
menu layout, sub menu, y=-1, title MSG_Choose_your_installation; menu layout, sub menu, y=-1, title MSG_Choose_your_installation;
option MSG_Set_Sizes, exit, action { layoutkind = 1; }; option MSG_Set_Sizes, exit, action { layoutkind = LY_SETNEW; };
option MSG_Use_Existing, exit, action { layoutkind = 4; }; option MSG_Use_Existing, exit, action { layoutkind = LY_USEEXIST; };
menu sizechoice, sub menu, y=0, title MSG_Choose_your_size_specifier; menu sizechoice, sub menu, y=0, title MSG_Choose_your_size_specifier;
display action { display action {
if (sizemult == current_cylsize) if (sizemult == pm->current_cylsize)
menu->cursel = 1; menu->cursel = 1;
else if (sizemult == 1) else if (sizemult == 1)
menu->cursel = 2; menu->cursel = 2;
}; };
option MSG_Megabytes, exit, action option MSG_Megabytes, exit, action
{ sizemult = MEG / sectorsize; { sizemult = MEG / pm->sectorsize;
multname = msg_string(MSG_megname); multname = msg_string(MSG_megname);
}; };
option MSG_Cylinders, exit, action option MSG_Cylinders, exit, action
{ sizemult = current_cylsize; { sizemult = pm->current_cylsize;
multname = msg_string(MSG_cylname); multname = msg_string(MSG_cylname);
}; };
option MSG_Sectors, exit, action option MSG_Sectors, exit, action
@ -233,12 +271,12 @@ menu distmedium, title MSG_Select_medium, y=-5;
option MSG_Skip_group,exit, action { *(int *)arg = SET_SKIP_GROUP; }; option MSG_Skip_group,exit, action { *(int *)arg = SET_SKIP_GROUP; };
option MSG_Abandon, exit, action { *(int *)arg = SET_ABANDON; }; option MSG_Abandon, exit, action { *(int *)arg = SET_ABANDON; };
menu distset, title MSG_Select_your_distribution; menu distset, title MSG_Select_your_distribution, exit, no default exit;
display action { msg_display (MSG_distset); }; display action { msg_display (MSG_distset); };
option MSG_Full_installation, exit, action { init_set_status(0); }; option MSG_Full_installation, exit, action { *(int *)arg = 1; init_set_status(0); };
option MSG_Full_installation_nox, exit, action { init_set_status(SFLAG_NOX); }; option MSG_Full_installation_nox, exit, action { *(int *)arg = 1; init_set_status(SFLAG_NOX); };
option MSG_Minimal_installation, exit, action { init_set_status(SFLAG_MINIMAL); }; option MSG_Minimal_installation, exit, action { *(int *)arg = 1; init_set_status(SFLAG_MINIMAL); };
option MSG_Custom_installation, exit, action { init_set_status(SFLAG_MINIMAL); customise_sets(); }; option MSG_Custom_installation, exit, action { *(int *)arg = 1; init_set_status(SFLAG_MINIMAL); customise_sets(); };
menu ftpsource, y=-4, x=0, w=70, no box, no clear, menu ftpsource, y=-4, x=0, w=70, no box, no clear,
exitstring MSG_Get_Distribution; exitstring MSG_Get_Distribution;
@ -281,10 +319,17 @@ menu ftpsource, y=-4, x=0, w=70, no box, no clear,
clean_xfer_dir ? MSG_Yes : MSG_No);}, clean_xfer_dir ? MSG_Yes : MSG_No);},
action {process_menu(MENU_yesno, deconst(MSG_delete_xfer_file)); action {process_menu(MENU_yesno, deconst(MSG_delete_xfer_file));
clean_xfer_dir = yesno; }; clean_xfer_dir = yesno; };
option MSG_Configure_network,
action {
extern int network_up;
network_up = 0;
config_network();
};
option MSG_exit_menu_generic, exit, action { yesno = SET_RETRY; };
menu nfssource, y=-4, x=0, w=70, no box, no clear, menu nfssource, y=-4, x=0, w=70, no box, no clear,
exitstring MSG_Continue; exitstring MSG_Get_Distribution;
display action { msg_display(MSG_nfssource); }; display action { msg_display(MSG_nfssource); };
option {src_legend(menu, MSG_Host, nfs_host);}, option {src_legend(menu, MSG_Host, nfs_host);},
action { src_prompt(MSG_Host, nfs_host, sizeof nfs_host); }; action { src_prompt(MSG_Host, nfs_host, sizeof nfs_host); };
@ -294,6 +339,13 @@ menu nfssource, y=-4, x=0, w=70, no box, no clear,
action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); }; action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
option {src_legend(menu, MSG_Set_dir_src, set_dir_src);}, option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); }; action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
option MSG_Configure_network,
action {
extern int network_up;
network_up = 0;
config_network();
};
option MSG_exit_menu_generic, exit, action { yesno = SET_RETRY; };
menu fdremount, title MSG_What_do_you_want_to_do; menu fdremount, title MSG_What_do_you_want_to_do;
option MSG_Try_again, exit, action { *(int *)arg = SET_CONTINUE; }; option MSG_Try_again, exit, action { *(int *)arg = SET_CONTINUE; };
@ -323,6 +375,7 @@ menu floppysource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
clean_xfer_dir ? MSG_Yes : MSG_No);}, clean_xfer_dir ? MSG_Yes : MSG_No);},
action {process_menu(MENU_yesno, deconst(MSG_delete_xfer_file)); action {process_menu(MENU_yesno, deconst(MSG_delete_xfer_file));
clean_xfer_dir = yesno; }; clean_xfer_dir = yesno; };
option MSG_exit_menu_generic, exit, action { yesno = SET_RETRY; };
menu cdromsource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue; menu cdromsource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
display action { msg_display(MSG_cdromsource); }; display action { msg_display(MSG_cdromsource); };
@ -332,6 +385,7 @@ menu cdromsource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); }; action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
option {src_legend(menu, MSG_Set_dir_src, set_dir_src);}, option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); }; action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
option MSG_exit_menu_generic, exit, action { yesno = SET_RETRY; };
menu localfssource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue; menu localfssource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
display action { msg_display(MSG_localfssource); }; display action { msg_display(MSG_localfssource); };
@ -345,6 +399,7 @@ menu localfssource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); }; action { src_prompt(MSG_Set_dir_bin, set_dir_bin, sizeof set_dir_bin); };
option {src_legend(menu, MSG_Set_dir_src, set_dir_src);}, option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); }; action { src_prompt(MSG_Set_dir_src, set_dir_src, sizeof set_dir_src); };
option MSG_exit_menu_generic, exit, action { yesno = SET_RETRY; };
menu localdirsource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue; menu localdirsource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
display action { msg_display(MSG_localdir); }; display action { msg_display(MSG_localdir); };
@ -354,6 +409,7 @@ menu localdirsource, y=-4, x=0, w=70, no box, no clear, exitstring MSG_Continue;
action { src_prompt(MSG_Set_dir_bin, set_dir_bin, 60); }; action { src_prompt(MSG_Set_dir_bin, set_dir_bin, 60); };
option {src_legend(menu, MSG_Set_dir_src, set_dir_src);}, option {src_legend(menu, MSG_Set_dir_src, set_dir_src);},
action { src_prompt(MSG_Set_dir_src, set_dir_src, 60); }; action { src_prompt(MSG_Set_dir_src, set_dir_src, 60); };
option MSG_exit_menu_generic, exit, action { yesno = SET_RETRY; };
menu namesrv6, title MSG_Select_IPv6_DNS_server; menu namesrv6, title MSG_Select_IPv6_DNS_server;
option "google-public-dns-a.google.com", exit, action option "google-public-dns-a.google.com", exit, action
@ -422,6 +478,17 @@ menu binpkg, y=-4, x=0, w=70, no box, no clear,
setenv("http_proxy", pkg.proxy, 1); setenv("http_proxy", pkg.proxy, 1);
} }
}; };
option {src_legend(menu, "Additional packages", (char*)arg); }, /*TODO*/
action { src_prompt("Additional packages", (char*)arg,
sizeof(char) * STRSIZE); };
option MSG_Configure_network,
action {
extern int network_up;
network_up = 0;
config_network();
mnt_net_config();
};
option MSG_quit_pkgs_install, exit, action { yesno = SET_SKIP; };
menu pkgsrc, y=-4, x=0, w=70, no box, no clear, menu pkgsrc, y=-4, x=0, w=70, no box, no clear,
exit, exitstring MSG_Install_pkgsrc; exit, exitstring MSG_Install_pkgsrc;
@ -467,3 +534,137 @@ menu usersh, title MSG_User_shell, no clear;
option "/bin/sh", exit, action { ushell = "/bin/sh";}; option "/bin/sh", exit, action { ushell = "/bin/sh";};
option "/bin/ksh", exit, action { ushell = "/bin/ksh";}; option "/bin/ksh", exit, action { ushell = "/bin/ksh";};
option "/bin/csh", exit, action { ushell = "/bin/csh";}; option "/bin/csh", exit, action { ushell = "/bin/csh";};
menu pmdiskentry, x=50, y=5, exit, default exit;
option MSG_editbsdpart, exit, action { pm_make_bsd_partitions(pm); };
option MSG_editmbr, exit, action { md_get_info();
md_pre_disklabel();
memset(&pm->bsdlabel, 0, sizeof pm->bsdlabel);};
option MSG_switchgpt, exit, action { if (pm_gpt_convert(pm) == 0)
pm_partusage(pm, -1, 1); };
option MSG_renamedisk, exit, action { pm->unsaved = 1; pm_rename(pm); };
option MSG_fmtasraid, exit, action { pm->unsaved = 1;
pm_partusage(pm, -1, 1);
layoutkind = LY_NEWRAID;
md_make_bsd_partitions();};
option MSG_fmtaslvm, exit, action { pm->unsaved = 1;
pm_partusage(pm, -1, 1);
layoutkind = LY_NEWLVM;
md_make_bsd_partitions(); };
option MSG_encrypt, exit, action { pm->unsaved = 1;
pm_partusage(pm, -1, 1);
layoutkind = LY_NEWCGD;
md_make_bsd_partitions();
pm_cgd_edit(0, &(part_entry_t)
{.dev_ptr = pm, .dev_num = PART_E}
); };
option MSG_setbootable, exit, action { pm->unsaved = 1;
pm->bootable = !pm->bootable; };
option MSG_erase, next menu shred_modes;
option MSG_undo, exit, action { label_read(); pm->unsaved = 0;
pm_partusage(pm, -1, 1); };
option MSG_unconfig, exit, action { if (pm_unconfigure(pm) == 0)
pm_partusage(pm, -1, 1); };
menu pmpartentry, x=50, y=5, exit, default exit;
option MSG_edit, exit, action {
pm->unsaved = 1;
int tpfs = pm->bsdlabel[*(int*)arg].pi_fstype;
int tplvm = pm->bsdlabel[*(int*)arg].lvmpv;
pm_editpart(*(int*)arg);
if (tpfs != pm->bsdlabel[*(int*)arg].pi_fstype ||
tplvm != pm->bsdlabel[*(int*)arg].lvmpv)
/* Oops, partition type changed */
pm_partusage(pm, *(int*)arg, 1);
};
option MSG_fmtasraid, exit, action {
if (pm->gpt || pm->isspecial) {
process_menu(MENU_ok, deconst(MSG_notsupported));
return -1;
}
pm->unsaved = 1;
pm_partusage(pm, *(int*)arg, 1);
pm_setfstype(pm, *(int*)arg, FS_RAID);
};
option MSG_fmtaslvm, exit, action {
if (pm->gpt || pm->isspecial) {
process_menu(MENU_ok, deconst(MSG_notsupported));
return -1;
}
pm->unsaved = 1;
pm_partusage(pm, *(int*)arg, 1);
pm_setfstype(pm, *(int*)arg, FS_BSDFFS);
pm->bsdlabel[*(int*)arg].lvmpv = 1;
};
option MSG_encrypt, exit, action {
if (pm->gpt || pm->isspecial) {
process_menu(MENU_ok, deconst(MSG_notsupported));
return -1;
}
pm->unsaved = 1;
pm_partusage(pm, *(int*)arg, 1);
pm_setfstype(pm, *(int*)arg, FS_CGD);
pm_cgd_edit(0,
&(part_entry_t){.dev_ptr = pm,
.dev_num = *(int*)arg});
};
option MSG_erase, next menu shred_modes;
option MSG_doumount, exit, action { pm_umount(pm, *(int*)arg); };
option MSG_Delete_partition, exit, action {
pm->unsaved = 1;
pm_partusage(pm, *(int*)arg, 1);
if (pm->isspecial)
pm_unconfigure(pm);
else
pm->bsdlabel[*(int*)arg].pi_fstype = FS_UNUSED;
};
menu pmgptentry, x=50, y=8, exit, default exit;
option MSG_editbsdpart, exit, action { pm_make_bsd_partitions(pm); };
option MSG_switchmbr, exit, action { if (pm_gpt_convert(pm) == 0)
pm_partusage(pm, -1, 1); };
option MSG_setbootable, exit, action { pm->unsaved = 1;
pm->bootable = !pm->bootable; };
option MSG_erase, next menu shred_modes;
option MSG_undo, exit, action { label_read(); pm->unsaved = 0;
pm_partusage(pm, -1, 1); };
option MSG_unconfig, exit, action { if (pm_unconfigure(pm) == 0)
pm_partusage(pm, -1, 1); };
menu shred_modes, x=50, y=5, exit, default exit;
option MSG_fillzeros, exit,
action { pm_shred(pm, *(int*)arg, SHRED_ZEROS); };
option MSG_fillrandom, exit,
action { pm_shred(pm, *(int*)arg, SHRED_RANDOM); };
option MSG_fillcrypto, exit,
action { pm_shred(pm, *(int*)arg, SHRED_CRYPTO); };
menu raidlevel;
option MSG_raid0, exit, action { *(int *)arg = 0; };
option MSG_raid1, exit, action { *(int *)arg = 1; };
option MSG_raid4, exit, action { *(int *)arg = 4; };
option MSG_raid5, exit, action { *(int *)arg = 5; };
menu cgd_enctype;
option "aes-cbc", exit, action { *(const char**)arg = "aes-cbc"; };
option "3des-cbc", exit, action { *(const char**)arg = "3des-cbc"; };
option "blowfish-cbc", exit, action { *(const char**)arg = "blowfish-cbc"; };
menu cgd_ivtype;
option "encblkno1", exit, action { *(const char**)arg = "encblkno1"; };
option "encblkno8", exit, action { *(const char**)arg = "encblkno8"; };
menu cgd_keygentype;
option "pkcs5_pbkdf2/sha1", exit, action { *(const char**)arg = "pkcs5_pbkdf2/sha1"; };
option "pkcs5_pbkdf2", exit, action { *(const char**)arg = "pkcs5_pbkdf2"; };
option "storedkey", exit, action { *(const char**)arg = "storedkey"; };
option "randomkey", exit, action { *(const char**)arg = "randomkey"; };
option "urandomkey", exit, action { *(const char**)arg = "urandomkey"; };
option "shell_cmd", exit, action { *(const char**)arg = "shell_cmd"; };
menu cgd_verifytype;
option "none", exit, action { *(const char**)arg = "none"; };
option "disklabel", exit, action { *(const char**)arg = "disklabel"; };
option "ffs", exit, action { *(const char**)arg = "ffs"; };
option "re-enter", exit, action { *(const char**)arg = "re-enter"; };

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mbr.de,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: msg.mbr.de,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -156,8 +156,6 @@ W
message Partition_table_ok message Partition_table_ok
{Partitionstabelle OK} {Partitionstabelle OK}
message Delete_partition
{Partition löschen}
message Dont_change message Dont_change
{Nicht verändern} {Nicht verändern}
message Other_kind message Other_kind

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mbr.en,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: msg.mbr.en,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -155,8 +155,6 @@ Select the partition you wish to change:
message Partition_table_ok message Partition_table_ok
{Partition table OK} {Partition table OK}
message Delete_partition
{Delete partition}
message Dont_change message Dont_change
{Don't change} {Don't change}
message Other_kind message Other_kind

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mbr.es,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: msg.mbr.es,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -156,8 +156,6 @@ Seleccione la partici
message Partition_table_ok message Partition_table_ok
{Tabla de particiones OK} {Tabla de particiones OK}
message Delete_partition
{Borrar partición}
message Dont_change message Dont_change
{No cambiar} {No cambiar}
message Other_kind message Other_kind

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mbr.fr,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: msg.mbr.fr,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -148,8 +148,6 @@ message editparttable
message Partition_table_ok message Partition_table_ok
{Table des partitions OK} {Table des partitions OK}
message Delete_partition
{Supprimer la partition}
message Dont_change message Dont_change
{Ne pas modifier} {Ne pas modifier}
message Other_kind message Other_kind

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mbr.pl,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: msg.mbr.pl,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -145,8 +145,6 @@ message editparttable
message Partition_table_ok message Partition_table_ok
{Tablica partycji jest poprawna} {Tablica partycji jest poprawna}
message Delete_partition
{Usun partycje}
message Dont_change message Dont_change
{Nie zmieniaj} {Nie zmieniaj}
message Other_kind message Other_kind

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mi.de,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: msg.mi.de,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -35,7 +35,7 @@
/* MI Message catalog -- German, machine independent */ /* MI Message catalog -- German, machine independent */
message usage message usage
{Aufruf: sysinst [-D] [-f Definitionsdatei] [-r Version] {Aufruf: sysinst [-D] [-f Definitionsdatei] [-r Version] [-C bg:fg]
} }
/* /*
@ -522,14 +522,10 @@ message netup
Hat einer davon Zugriff auf die benötigten Server?} Hat einer davon Zugriff auf die benötigten Server?}
message asknetdev message asknetdev
{NetBSD hat folgende Netzwerkadapter gefunden: %s {Welchen Netzwerkadapter möchten Sie benutzen?}
\nWelchen möchten Sie benutzen?}
message badnet message netdevs
{Sie haben keinen der angezeigten Netzwerkadapter ausgewählt. Bitte versuchen {Verfügbare schnittstellen}
Sie es erneut.
NetBSD hat folgende Netzwerkadapter gefunden: %s
\nWelchen möchten Sie benutzen?}
message netinfo message netinfo
{Um das Netzwerk nutzen zu können, benötigen wir folgende Angaben: {Um das Netzwerk nutzen zu können, benötigen wir folgende Angaben:
@ -603,12 +599,6 @@ message slattach {
Flags für slattach Flags für slattach
} }
message netagain
{Bitte geben Sie die Informationen über Ihr Netzwerk erneut an. Diese werden
auch als Vorgabe beibehalten.
}
message wait_network message wait_network
{ {
Bitte warten Sie, während die Netzwerkgeräte initialisiert werden. Bitte warten Sie, während die Netzwerkgeräte initialisiert werden.
@ -963,6 +953,7 @@ message Reboot_the_computer {Computer neu starten}
message Utility_menu {Extras} message Utility_menu {Extras}
message Config_menu {Konfigurationsmenü} message Config_menu {Konfigurationsmenü}
message exit_utility_menu {Zurück zum Hauptmenü} message exit_utility_menu {Zurück zum Hauptmenü}
message exit_menu_generic {Zurück}
message NetBSD_VERSION_Utilities {NetBSD-@@VERSION@@ Extras} message NetBSD_VERSION_Utilities {NetBSD-@@VERSION@@ Extras}
message Run_bin_sh {Ausführen von /bin/sh} message Run_bin_sh {Ausführen von /bin/sh}
message Set_timezone {Setzen der Zeitzone} message Set_timezone {Setzen der Zeitzone}
@ -1021,6 +1012,11 @@ message Perform_IPv6_autoconfiguration {IPv6 automatisch konfigurieren?}
message Perform_DHCP_autoconfiguration {Konfiguration per DHCP ermitteln?} message Perform_DHCP_autoconfiguration {Konfiguration per DHCP ermitteln?}
message Root_shell {Root-Shell} message Root_shell {Root-Shell}
message User_shell {User-Shell} message User_shell {User-Shell}
message Color_scheme {Farbschema}
message White_on_black {Weiß auf schwarz}
message Black_on_white {Schwarz auf weiß}
message White_on_blue {Weiß auf Blau}
message Green_on_black {Grün auf schwarz}
.if AOUT2ELF .if AOUT2ELF
message aoutfail message aoutfail
@ -1088,6 +1084,10 @@ message enable_sshd {sshd aktivieren}
message enable_ntpd {ntpd aktivieren} message enable_ntpd {ntpd aktivieren}
message run_ntpdate {ntpdate beim Starten ausführen} message run_ntpdate {ntpdate beim Starten ausführen}
message enable_mdnsd {mdnsd aktivieren} message enable_mdnsd {mdnsd aktivieren}
message enable_xdm {xdm aktivieren}
message enable_cgd {cgd aktivieren}
message enable_lvm {lvm aktivieren}
message enable_raid {raidframe aktivieren}
message add_a_user {Add a user} message add_a_user {Add a user}
message configmenu {Zusätzliche Einstellungen konfigurieren.} message configmenu {Zusätzliche Einstellungen konfigurieren.}
message doneconfig {Konfiguration abgeschlossen.} message doneconfig {Konfiguration abgeschlossen.}
@ -1112,9 +1112,157 @@ installieren}
message retry_pkgsrc_network {Netzwerkkonfiguration fehlgeschlagen. Noch einmal message retry_pkgsrc_network {Netzwerkkonfiguration fehlgeschlagen. Noch einmal
versuchen?} versuchen?}
message quit_pkgsrc {Ohne Installation von pkgsrc beenden.} message quit_pkgsrc {Ohne Installation von pkgsrc beenden.}
message quit_pkgs_install {Installation von binär-Paketen beenden.}
message pkgin_failed message pkgin_failed
{Die Installation von pkgin ist fehlgeschlagen, evtl. weil keine Binärpakete {Die Installation von pkgin ist fehlgeschlagen, evtl. weil keine Binärpakete
vorhanden sind. Bitte den Pfad der Pakete überprüfen und noch einmal versuchen.} vorhanden sind. Bitte den Pfad der Pakete überprüfen und noch einmal versuchen.}
message failed {Fehlgeschlagen} message failed {Fehlgeschlagen}
message notsupported {Operation wird nicht unterstützt!}
message askfsmountadv {Mountpoint oder 'raid' oder 'cgd' oder 'lvm'?}
message partman {Erweiterte Partitionierung}
message editbsdpart {Bearbeiten BSD-Partitionen}
message editmbr {Bearbeiten und speichern MBR}
message switchgpt {Wechseln Sie zu GPT}
message switchmbr {Wechseln Sie zu MBR}
message renamedisk {Stellen Sie Festplatten-Namen}
message fmtasraid {Format als RAID}
message fmtaslvm {Format als LVM-PV}
message encrypt {Verschlüsseln}
message setbootable {Boot-Flag}
message erase {Safe Erase}
message undo {Rückgängigmachen von Änderungen}
message unconfig {Dekonfigurieren}
message edit {Bearbeiten}
message doumount {Force-umount}
message fillzeros {Füllen von Nullen}
message fillrandom {Füllen von zufälligen Daten}
message fillcrypto {Füllen von Crypto-Daten}
message raid0 {0 - Keine Parität, nur einfache Striping.}
message raid1 {1 - Mirroring. Die Parität ist der Spiegel.}
message raid4 {4 - Striping mit Parität auf die letzte Komponente gespeichert.}
message raid5 {5 - Striping mit Parität an den alle Komponenten.}
message fremove {ENTFERNEN}
message remove {Entfernen}
message add {Hinzufügen}
message auto {auto}
message removepartswarn {Diese entfernen Sie alle Partitionen auf der Festplatte. Wollen Sie fortsetzen?}
message saveprompt {Speichern Sie die Änderungen vor dem Abschluss?}
message cantsave {Änderungen können nicht gespeichert werden.}
message noroot {Kein Root-Partition definiert ist, kann nicht fortgesetzt werden \n}
message wannaunblock {Das Gerät ist blockiert. Wollen Sie zwingen sie zu entsperren und weiter?}
message wannatry {Wollen Sie probieren?}
message create_cgd {Erstellen kryptographische Volumen (CGD)}
message create_cnd {Erstellen Sie virtuelle Disk-Image (VND)}
message create_vg {Erstellen Volume-Gruppe (LVM VG)}
message create_lv { Erstellen logischer Volumen}
message create_raid {Erstellen Software-RAID}
message updpmlist {Aktualisieren Sie Geräte-Liste}
message savepm {Speichern Sie die Änderungen}
message pmblocked {GESPERRT}
message pmunchanged {NICHTS}
message pmsetboot {BOOTEN}
message pmused {BENUTZT}
message pmmounted {(montiert)}
message pmunused {(unbenutzt)}
message pmgptdisk {Festplatte mit GPT}
message finishpm {Partitionierung beenden}
message limitcount {Grenze für die Anzahl der Geräte erreicht wurde!}
message invaliddev {Ungültige Gerät!}
message avdisks {Verfügbare Festplatten:}
message nofreedev {Kann nicht zugewiesen werden Geräteknoten!}
message partman_header
{Partition Manager. Alle Festplatten, Partitionen usw. und dort angezeigt.
Auf den ersten MBR-Partitionen machen, dann machen BSD-Label.
Wenn Sie RAID verwenden, LVM oder CGD, gehen Sie folgendermaßen vor:
1) Erstellen BSD-Partitionen mit Typ benötigt; 2) Erstellen Sie RAID /
LVM VG / CGD mit diesen Partitionen; 3) Speichern Sie es;
4) Erstellen Sie Partitionen für RAID / CGD oder Logical Volumes für LVM.}
message raid_menufmt { raid%d (ebene %1d) on %-34s %11uM}
message raid_err_menufmt { LEER RAID!}
message raid_disks_fmt {Festplatten: %27s}
message raid_spares_fmt {Ersatzbedarf: %26s}
message raid_level_fmt {RAID ebene: %22d}
message raid_numrow_fmt {numRow: %22d}
message raid_numcol_fmt {numCol: %22d}
message raid_numspare_fmt {numSpare: %22d}
message raid_sectpersu_fmt {sectPerSU: %22d}
message raid_superpar_fmt {SUsPerParityUnit: %22d}
message raid_superrec_fmt {SUsPerReconUnit: %22d}
message raid_nomultidim {Mehrdimensionale Arrays werden nicht unterstützt!}
message raid_numrow_ask {numRow?}
message raid_numcol_ask {numCol?}
message raid_numspare_ask {numSpare?}
message raid_sectpersu_ask {sectPerSU?}
message raid_superpar_ask {SUsPerParityUnit?}
message raid_superrec_ask {SUsPerReconUnit?}
message raid_disks {Festplatten im RAID:}
message vnd_err_menufmt { PATH nicht definiert!}
message vnd_assgn_menufmt { vnd%1d auf %-50s ASSIGN}
message vnd_menufmt { vnd%1d auf %-44s %11uM}
message vnd_path_fmt {Dateipfad: %29s}
message vnd_assgn_fmt {Weisen Sie existieren Bild: %12s}
message vnd_size_fmt {Größe: %22sM}
message vnd_ro_fmt {Nur lesen: %22s}
message vnd_geom_fmt {Stellen Sie Geometrie von Hand: %8s}
message vnd_bps_fmt {Byte pro Sektor: %18s}
message vnd_spt_fmt {Sektoren pro Spur: %18s}
message vnd_tpc_fmt {Spuren pro Zylinder: %18s}
message vnd_cyl_fmt {Zylinder: %22s}
message vnd_path_ask {Dateipfad?}
message vnd_size_ask {Größe (MB)?}
message vnd_bps_ask {Byte pro Sektor?}
message vnd_spt_ask {Sektoren pro Spur?}
message vnd_tpc_ask {Spuren pro Zylinder?}
message vnd_cyl_ask {Zylinder?}
message cgd_err_menufmt { DISK NICHT DEFINIERT!}
message cgd_menufmt { cgd%1d %-48s %11uM}
message cgd_dev_fmt {Grundgerät: %24s}
message cgd_enc_fmt {Mausklick und: %24s}
message cgd_key_fmt {Schlüsselgröße: %24d}
message cgd_iv_fmt {IV-Algorithmus: %24s}
message cgd_keygen_fmt {Schlüsselgenerierung: %18s}
message cgd_verif_fmt {Verification Methode: %18s}
message lvm_disks {Festplatten im VG:}
message lvm_menufmt { %-44s %20sM}
message lvm_err_menufmt { VG LEER!}
message lvm_disks_fmt {PV's: %34s}
message lvm_name_fmt {Name: %34s}
message lvm_maxlv_fmt {MaxLogicalVolumes: %20s}
message lvm_maxpv_fmt {MaxPhysicalVolumes: %20s}
message lvm_extsiz_fmt {PhysicalExtentSize: %20s}
message lvm_name_ask {Name?}
message lvm_maxlv_ask {MaxLogicalVolumes?}
message lvm_maxpv_ask {MaxPhysicalVolumes?}
message lvm_extsiz_ask {PhysicalExtentSize (MB)?}
message lvmlv_menufmt { Logische Volumen%-35s% 11uM}
message lvmlv_name_fmt {Name: %34s}
message lvmlv_size_fmt {Größe: %32dM}
message lvmlv_ro_fmt {Nur lesen: %27s}
message lvmlv_cont_fmt {Zusammenhängend: %23s}
message lvmlv_extnum_fmt {LogicalExtentsNumber: %18s}
message lvmlv_minor_fmt {Minor-Nummer: %26s}
message lvmlv_mirrors_fmt {Mirrors: %27d}
message lvmlv_regsiz_fmt {MirrorLogRegionSize: %18s}
message lvmlv_pers_fmt {Persistent Minor-Nummer: %14s}
message lvmlv_readahsect_fmt {ReadAheadSectors: %18s}
message lvmlv_stripes_fmt {Stripes: %27s}
message lvmlv_stripesiz_fmt {StripeSize: %27s}
message lvmlv_zero_fmt {Nullsetzen der ersten KB:% 13s}
message lvmlv_name_ask {Name?}
message lvmlv_size_ask {Größe (MB)?}
message lvmlv_extnum_ask {LogicalExtentsNumber?}
message lvmlv_minor_ask {Minor-Nummer?}
message lvmlv_mirrors_ask {Spiegel?}
message lvmlv_regsiz_ask {MirrorLogRegionSize?}
message lvmlv_readahsect_ask {ReadAheadSectors?}
message lvmlv_stripes_ask {Stripes?}
message addusername {8 character username to add:} message addusername {8 character username to add:}
message addusertowheel {Do you wish to add this user to group wheel?} message addusertowheel {Do you wish to add this user to group wheel?}
message Delete_partition
{Partition löschen}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mi.en,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: msg.mi.en,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -35,7 +35,7 @@
/* MI Message catalog -- english, machine independent */ /* MI Message catalog -- english, machine independent */
message usage message usage
{usage: sysinst [-D] [-f definition_file] [-r release] {usage: sysinst [-D] [-f definition_file] [-r release] [-C bg:fg]
} }
message sysinst_message_language message sysinst_message_language
@ -504,13 +504,10 @@ message netup
Does one of them connect to the required server?} Does one of them connect to the required server?}
message asknetdev message asknetdev
{I have found the following network interfaces: %s {Which network device would you like to use?}
\nWhich device shall I use?}
message badnet message netdevs
{You did not choose one of the listed network devices. Please try again. {Available interfaces}
The following network devices are available: %s
\nWhich device shall I use?}
message netinfo message netinfo
{To be able to use the network, we need answers to the following: {To be able to use the network, we need answers to the following:
@ -579,12 +576,6 @@ IPv6 Nameserver: %s
message netok_ok message netok_ok
{Are they OK?} {Are they OK?}
message netagain
{Please reenter the information about your network. Your last answers
will be your default.
}
message wait_network message wait_network
{ {
Waiting while network interface comes up. Waiting while network interface comes up.
@ -903,6 +894,7 @@ message Reboot_the_computer {Reboot the computer}
message Utility_menu {Utility menu} message Utility_menu {Utility menu}
message Config_menu {Config menu} message Config_menu {Config menu}
message exit_utility_menu {Back to main menu} message exit_utility_menu {Back to main menu}
message exit_menu_generic {Exit}
message NetBSD_VERSION_Utilities {NetBSD-@@VERSION@@ Utilities} message NetBSD_VERSION_Utilities {NetBSD-@@VERSION@@ Utilities}
message Run_bin_sh {Run /bin/sh} message Run_bin_sh {Run /bin/sh}
message Set_timezone {Set timezone} message Set_timezone {Set timezone}
@ -961,6 +953,11 @@ message Perform_IPv6_autoconfiguration {Perform IPv6 autoconfiguration?}
message Perform_DHCP_autoconfiguration {Perform DHCP autoconfiguration?} message Perform_DHCP_autoconfiguration {Perform DHCP autoconfiguration?}
message Root_shell {Root shell} message Root_shell {Root shell}
message User_shell {User shell} message User_shell {User shell}
message Color_scheme {Color scheme}
message White_on_black {White on black}
message Black_on_white {Black on white}
message White_on_blue {White on blue}
message Green_on_black {Green on black}
.if AOUT2ELF .if AOUT2ELF
message aoutfail message aoutfail
@ -1020,6 +1017,10 @@ message enable_sshd {Enable sshd}
message enable_ntpd {Enable ntpd} message enable_ntpd {Enable ntpd}
message run_ntpdate {Run ntpdate at boot} message run_ntpdate {Run ntpdate at boot}
message enable_mdnsd {Enable mdnsd} message enable_mdnsd {Enable mdnsd}
message enable_xdm {Enable xdm}
message enable_cgd {Enable cgd}
message enable_lvm {Enable lvm}
message enable_raid {Enable raidframe}
message add_a_user {Add a user} message add_a_user {Add a user}
message configmenu {Configure the additional items as needed.} message configmenu {Configure the additional items as needed.}
message doneconfig {Finished configuring} message doneconfig {Finished configuring}
@ -1042,9 +1043,160 @@ message Pkgsrc_dir {pkgsrc directory}
message get_pkgsrc {Fetch and unpack pkgsrc for building from source} message get_pkgsrc {Fetch and unpack pkgsrc for building from source}
message retry_pkgsrc_network {Network configuration failed. Retry?} message retry_pkgsrc_network {Network configuration failed. Retry?}
message quit_pkgsrc {Quit without installing pkgsrc} message quit_pkgsrc {Quit without installing pkgsrc}
message quit_pkgs_install {Quit installing binary pkgs}
message pkgin_failed message pkgin_failed
{Installation of pkgin failed, possibly because no binary packages {Installation of pkgin failed, possibly because no binary packages
exist. Please check the package path and try again.} exist. Please check the package path and try again.}
message failed {Failed} message failed {Failed}
message notsupported {Operation not supported!}
message askfsmountadv {Mountpoint or 'raid' or 'cgd' or 'lvm'?}
message partman {Extended partitioning}
message editbsdpart {Edit BSD partitions}
message editmbr {Edit and save MBR}
message switchgpt {Switch to GPT}
message switchmbr {Switch to MBR}
message renamedisk {Set disk name}
message fmtasraid {Format as RAID}
message fmtaslvm {Format as LVM PV}
message encrypt {Encrypt}
message setbootable {Bootable flag}
message erase {Safe erase}
message undo {Undo changes}
message unconfig {Unconfigure}
message edit {Edit}
message doumount {Force umount}
message fillzeros {Fill by zeros}
message fillrandom {Fill by random data}
message fillcrypto {Fill by crypto data}
message raid0 {0 - No parity, only simple striping.}
message raid1 {1 - Mirroring. The parity is the mirror.}
message raid4 {4 - Striping with parity stored on the last component.}
message raid5 {5 - Striping with parity at the all components.}
message fremove {REMOVE}
message remove {Remove}
message add {Add}
message auto {auto}
message removepartswarn {This remove all partitions on disk. Do you want to continue?}
message saveprompt {Save changes before finishing?}
message cantsave {Changes cannot be saved.}
message noroot {No root partition defined, cannot continue\n}
message wannaunblock {
Device is blocked. It's editing may cause problems.
Do you want to force unblock it and continue?}
message wannatry {Do you want to try?}
message create_cgd {Create cryptographic volume (CGD)}
message create_cnd {Create virtual disk image (VND)}
message create_vg {Create volume group (LVM VG)}
message create_lv { Create logical volume}
message create_raid {Create software RAID}
message updpmlist {Update devices list}
message savepm {Save changes}
message pmblocked {BLOCKED}
message pmunchanged {UNCHANGED}
message pmsetboot {BOOT}
message pmused {USED}
message pmmounted {(mounted)}
message pmunused {(unused)}
message pmgptdisk {GPT-labeled disk}
message finishpm {Finish partitioning}
message limitcount {Limit for the devices count was reached!}
message invaliddev {Invalid device!}
message avdisks {Available disks:}
message nofreedev {Cannot allocate device node!}
message partman_header
{Partition manager. All disks, partitions and etc. displayed there.
At first make MBR partitions, then make BSD label. If you want to use RAID,
LVM or CGD, follow these steps: 1) Create BSD partitions with needed type;
2) Create RAID/LVM VG/CGD using these partitions; 3) Save it;
4) Create partitions for RAID/CGD or Logical Volumes for LVM.}
message raid_menufmt { raid%d (level %1d) on %-34s %11uM}
message raid_err_menufmt { EMPTY RAID!}
message raid_disks_fmt {Disks: %33s}
message raid_spares_fmt {Spares: %32s}
message raid_level_fmt {RAID level: %22d}
message raid_numrow_fmt {numRow: %22d}
message raid_numcol_fmt {numCol: %22d}
message raid_numspare_fmt {numSpare: %22d}
message raid_sectpersu_fmt {sectPerSU: %22d}
message raid_superpar_fmt {SUsPerParityUnit: %22d}
message raid_superrec_fmt {SUsPerReconUnit: %22d}
message raid_nomultidim {Multi-dimensional arrays are NOT supported!}
message raid_numrow_ask {numRow?}
message raid_numcol_ask {numCol?}
message raid_numspare_ask {numSpare?}
message raid_sectpersu_ask {sectPerSU?}
message raid_superpar_ask {SUsPerParityUnit?}
message raid_superrec_ask {SUsPerReconUnit?}
message raid_disks {Disks in RAID:}
message vnd_err_menufmt { PATH NOT DEFINED!}
message vnd_assgn_menufmt { vnd%1d on %-51s ASSIGN}
message vnd_menufmt { vnd%1d on %-45s %11uM}
message vnd_path_fmt {File path: %29s}
message vnd_assgn_fmt {Assign exist image: %20s}
message vnd_size_fmt {Size: %22sM}
message vnd_ro_fmt {Read-only: %22s}
message vnd_geom_fmt {Set geometry by hand: %18s}
message vnd_bps_fmt {Bytes per Sector: %18s}
message vnd_spt_fmt {Sectors per Track: %18s}
message vnd_tpc_fmt {Tracks per Cylinder: %18s}
message vnd_cyl_fmt {Cylinders: %22s}
message vnd_path_ask {File path?}
message vnd_size_ask {Size (MB)?}
message vnd_bps_ask {Bytes per Sector?}
message vnd_spt_ask {Sectors per Track?}
message vnd_tpc_ask {Tracks per Cylinder?}
message vnd_cyl_ask {Cylinders?}
message cgd_err_menufmt { DISK NOT DEFINED!}
message cgd_menufmt { cgd%1d %-48s %11uM}
message cgd_dev_fmt {Base device: %24s}
message cgd_enc_fmt {Encyption: %24s}
message cgd_key_fmt {Key size: %24d}
message cgd_iv_fmt {IV algorithm: %24s}
message cgd_keygen_fmt {Key generation: %24s}
message cgd_verif_fmt {Verification method: %17s}
message lvm_disks {Disks in VG:}
message lvm_menufmt { %-44s %20sM}
message lvm_err_menufmt { EMPTY VG!}
message lvm_disks_fmt {PV's: %34s}
message lvm_name_fmt {Name: %34s}
message lvm_maxlv_fmt {MaxLogicalVolumes: %20s}
message lvm_maxpv_fmt {MaxPhysicalVolumes: %20s}
message lvm_extsiz_fmt {PhysicalExtentSize: %20s}
message lvm_name_ask {Name?}
message lvm_maxlv_ask {MaxLogicalVolumes?}
message lvm_maxpv_ask {MaxPhysicalVolumes?}
message lvm_extsiz_ask {PhysicalExtentSize (MB)?}
message lvmlv_menufmt { Logical volume %-35s %11uM}
message lvmlv_name_fmt {Name: %34s}
message lvmlv_size_fmt {Size: %33dM}
message lvmlv_ro_fmt {Read-only: %27s}
message lvmlv_cont_fmt {Contiguous: %27s}
message lvmlv_extnum_fmt {LogicalExtentsNumber: %18s}
message lvmlv_minor_fmt {Minor number: %26s}
message lvmlv_mirrors_fmt {Mirrors: %27d}
message lvmlv_regsiz_fmt {MirrorLogRegionSize: %18s}
message lvmlv_pers_fmt {Persistent minor number: %14s}
message lvmlv_readahsect_fmt {ReadAheadSectors: %18s}
message lvmlv_stripes_fmt {Stripes: %27s}
message lvmlv_stripesiz_fmt {StripeSize: %27s}
message lvmlv_zero_fmt {Zeroing of the first KB: %13s}
message lvmlv_name_ask {Name?}
message lvmlv_size_ask {Size (MB)?}
message lvmlv_extnum_ask {LogicalExtentsNumber?}
message lvmlv_minor_ask {Minor number?}
message lvmlv_mirrors_ask {Mirrors?}
message lvmlv_regsiz_ask {MirrorLogRegionSize?}
message lvmlv_readahsect_ask {ReadAheadSectors?}
message lvmlv_stripes_ask {Stripes?}
message addusername {8 character username to add:} message addusername {8 character username to add:}
message addusertowheel {Do you wish to add this user to group wheel?} message addusertowheel {Do you wish to add this user to group wheel?}
message Delete_partition
{Delete partition}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mi.es,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: msg.mi.es,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -35,7 +35,7 @@
/* MI Message catalog -- spanish, machine independent */ /* MI Message catalog -- spanish, machine independent */
message usage message usage
{uso: sysinst [-D] [-f fichero_definición] [-r versión] {uso: sysinst [-D] [-f fichero_definición] [-r versión] [-C bg:fg]
} }
/* /*
@ -517,14 +517,10 @@ message netup
¿Conecta alguna de ellas al servidor requerido?} ¿Conecta alguna de ellas al servidor requerido?}
message asknetdev message asknetdev
{Se han encontrado las siguientes interfaces de red: %s {¿Cuál interfaces usar?}
\n¿Cuál se debería usar?}
message badnet message netdevs
{No ha seleccionado ninguna interfaz de las listadas. Por favor, vuelva a {Interfaces disponibles}
intentarlo.
Están disponibles las siguientes interfaces de red: %s
\n¿Cuál debería usar?}
message netinfo message netinfo
{Para poder usar la red, necesita responder lo siguiente: {Para poder usar la red, necesita responder lo siguiente:
@ -593,12 +589,6 @@ Serv de nombres IPv6: %s
message netok_ok message netok_ok
{¿Son correctos?} {¿Son correctos?}
message netagain
{Por favor, vuelva a introducir la información sobre su red. Sus últimas
respuestas serán las predeterminadas.
}
message wait_network message wait_network
{ {
Espere mientras las interfaces de red se levantan. Espere mientras las interfaces de red se levantan.
@ -928,6 +918,7 @@ message Re_install_sets_or_install_additional_sets {Reinstalar conjuntos o insta
message Reboot_the_computer {Reiniciar la computadora} message Reboot_the_computer {Reiniciar la computadora}
message Utility_menu {Menú de utilidades} message Utility_menu {Menú de utilidades}
message Config_menu {Menu de configuración} message Config_menu {Menu de configuración}
message exit_menu_generic {atrás}
message exit_utility_menu {Exit} message exit_utility_menu {Exit}
message NetBSD_VERSION_Utilities {Utilidades de NetBSD-@@VERSION@@} message NetBSD_VERSION_Utilities {Utilidades de NetBSD-@@VERSION@@}
message Run_bin_sh {Ejecutar /bin/sh} message Run_bin_sh {Ejecutar /bin/sh}
@ -986,6 +977,11 @@ message other {otro }
message Perform_IPv6_autoconfiguration {¿Realizar autoconfiguración IPv6?} message Perform_IPv6_autoconfiguration {¿Realizar autoconfiguración IPv6?}
message Perform_DHCP_autoconfiguration {¿Realizar autoconfiguración DHCP ?} message Perform_DHCP_autoconfiguration {¿Realizar autoconfiguración DHCP ?}
message Root_shell {Shell de root} message Root_shell {Shell de root}
message Color_scheme {Combinación de colores}
message White_on_black {Blanco sobre negro}
message Black_on_white {Negro sobre blanco}
message White_on_blue {Blanco sobre azul}
message Green_on_black {Verde sobre negro}
message User_shell {Shell de user} message User_shell {Shell de user}
.if AOUT2ELF .if AOUT2ELF
@ -1064,6 +1060,10 @@ message enable_sshd {Activar sshd}
message enable_ntpd {Activar ntpd} message enable_ntpd {Activar ntpd}
message run_ntpdate {Ejecutar ntpdate durante el arranque} message run_ntpdate {Ejecutar ntpdate durante el arranque}
message enable_mdnsd {Activar mdnsd} message enable_mdnsd {Activar mdnsd}
message enable_xdm {Enable xdm}
message enable_cgd {Enable cgd}
message enable_lvm {Enable lvm}
message enable_raid {Enable raidframe}
message add_a_user {Add a user} message add_a_user {Add a user}
message configmenu {Configurar elementos adicionales bajo demanda.} message configmenu {Configurar elementos adicionales bajo demanda.}
message doneconfig {Terminar configuración} message doneconfig {Terminar configuración}
@ -1091,10 +1091,159 @@ message get_pkgsrc
message retry_pkgsrc_network message retry_pkgsrc_network
{La configuración de la red ha fallado. ¿Reintentar?} {La configuración de la red ha fallado. ¿Reintentar?}
message quit_pkgsrc {Salir sin instalar pkgsrc} message quit_pkgsrc {Salir sin instalar pkgsrc}
message quit_pkgs_install {Salir sin instalar bin pkg}
message pkgin_failed message pkgin_failed
{La instalación de pkgin ha fallado, posiblemente porque no existen {La instalación de pkgin ha fallado, posiblemente porque no existen
paquetes binarios. Por favor verifique el camino a los paquetes y paquetes binarios. Por favor verifique el camino a los paquetes y
reinténtelo de nuevo.} reinténtelo de nuevo.}
message failed {Error} message failed {Error}
message notsupported {Operación no admitida!}
message askfsmountadv {Punto de montaje o 'raid' o 'CGD' o 'lvm'?}
message partman {Partición extendida}
message editbsdpart {Editar particiones BSD}
message editmbr {Editar y guardar MBR}
message switchgpt {Cambiar a GPT}
message switchmbr {Cambiar a MBR}
message renamedisk {Establece el nombre del disco}
message fmtasraid {Formato como RAID}
message fmtaslvm {Formato como LVM PV}
message encrypt {Cifrar}
message setbootable {La bandera de arranque}
message erase {Borrado seguro}
message undo {Deshacer los cambios}
message unconfig {Desconfigurar}
message edit {Editar}
message doumount {Fuerza umount}
message fillzeros {Llenar con ceros}
message fillrandom {Llene los datos al azar}
message fillcrypto {Rellene los datos de cifrado}
message raid0 {0 - Sin paridad, creación de bandas sólo es simple.}
message raid1 {1 - Creación de reflejos. La paridad es el espejo.}
message raid4 {4 - Striping con paridad almacenada en el último componente. component.}
message raid5 {5 - Striping con paridad en los componentes de todos. components.}
message fremove {QUITAR}
message remove {Quitar}
message add {Añadir}
message auto {auto}
message removepartswarn {Esta eliminar todas las particiones en el disco. ¿Desea continuar? want to continue?}
message saveprompt {Guarde los cambios antes de terminar?}
message cantsave {Los cambios no se pueden guardar.}
message noroot {No hay una partición raíz definida, no puede continuar \n}
message wannaunblock {El dispositivo está bloqueado. ¿Quiere forzar a desbloquear y continuar? unblock it and continue?}
message wannatry {¿Quieres probar?}
message create_cgd {Crear cifrado de volumen (CGD)}
message create_cnd {Crear imagen de disco virtual (VND)}
message create_vg {Crear grupo de volúmenes (LVM VG)}
message create_lv { Crear volúmenes lógicos}
message create_raid {Crear RAID por software}
message updpmlist {Actualizar lista de dispositivos}
message savepm {Guardar los cambios}
message pmblocked {BLOQUEADO}
message pmunchanged {SIN USO}
message pmsetboot {ARRANCAR}
message pmused {UTILIZA}
message pmmounted {(montado)}
message pmunused {(sin usar)}
message pmgptdisk {Disco con GPT}
message finishpm {Finalizar el particionado}
message limitcount {Límite para el número de dispositivos se llegó!}
message invaliddev {No válido dispositivo!}
message avdisks {Discos disponibles:}
message nofreedev {No se puede asignar nodo de dispositivo!}
message partman_header
{Partition Manager. Todos los discos, particiones y etc muestra allí.
Al principio, las particiones MBR hacen, a continuación, hacer etiquetas BSD.
Si desea utilizar RAID, LVM o CGD, siga estos pasos:
1) Crear particiones BSD con el tipo necesario;
2) Crear RAID / LVM VG / CGD el uso de estas particiones; 3) Guárdalo;
4) Crear particiones de volúmenes RAID / CGD o lógico de LVM.}
message raid_menufmt { raid%d (nivel %1d) en %-34s %11uM}
message raid_err_menufmt { RAID VACIO!}
message raid_disks_fmt {Discos: %32s}
message raid_spares_fmt {Piezas de recambio: %20s}
message raid_level_fmt {RAID de nivel: %22d}
message raid_numrow_fmt {numRow: %22d}
message raid_numcol_fmt {numCol: %22d}
message raid_numspare_fmt {numSpare: %22d}
message raid_sectpersu_fmt {sectPerSU: %22d}
message raid_superpar_fmt {SUsPerParityUnit: %22d}
message raid_superrec_fmt {SUsPerReconUnit: %22d}
message raid_nomultidim {Matrices multidimensionales no son compatibles!}
message raid_numrow_ask {numRow?}
message raid_numcol_ask {numCol?}
message raid_numspare_ask {numSpare?}
message raid_sectpersu_ask {sectPerSU?}
message raid_superpar_ask {SUsPerParityUnit?}
message raid_superrec_ask {SUsPerReconUnit?}
message raid_disks {Los discos en RAID:}
message vnd_err_menufmt { CAMINO NO DEFINIDO!}
message vnd_assgn_menufmt { vnd%1d en %-51s ASSIGN}
message vnd_menufmt { vnd%1d en %-45s %11uM}
message vnd_path_fmt {Ruta del archivo: %22s}
message vnd_assgn_fmt {Asignar existe la imagen: %14s}
message vnd_size_fmt {Tamaño: %22sM}
message vnd_ro_fmt {Sólo lectura: %22s}
message vnd_geom_fmt {Establecer la geometría de la mano: %4s}
message vnd_bps_fmt {Bytes por sector: %18s}
message vnd_spt_fmt {Sectores por pista: %18s}
message vnd_tpc_fmt {Pistas por cilindro: %18s}
message vnd_cyl_fmt {Cilindros: %22s}
message vnd_path_ask {Ruta de acceso?}
message vnd_size_ask {Tamaño (MB)?}
message vnd_bps_ask {Bytes por sector?}
message vnd_spt_ask {Sectores por pista?}
message vnd_tpc_ask {Pistas por cilindro?}
message vnd_cyl_ask {Cilindros}
message cgd_err_menufmt { DISCO NO SE DEFINE!}
message cgd_menufmt { cgd%1d %-48s %11uM}
message cgd_dev_fmt {Dispositivo de base: %19s}
message cgd_enc_fmt {Encriptación: %19s}
message cgd_key_fmt {Tamaño de la clave: %19d}
message cgd_iv_fmt {Algoritmo IV: %19s}
message cgd_keygen_fmt {La generación de claves: %15s}
message cgd_verif_fmt {Método de verificación: %15s}
message lvm_disks {Discos en VG:}
message lvm_menufmt { %-44s %20sM}
message lvm_err_menufmt { VACIAR VG!}
message lvm_disks_fmt {PV's: %34s}
message lvm_name_fmt {Nombre: %32s}
message lvm_maxlv_fmt {MaxLogicalVolumes: %20s}
message lvm_maxpv_fmt {MaxPhysicalVolumes: %20s}
message lvm_extsiz_fmt {PhysicalExtentSize: %20s}
message lvm_name_ask {Nombre?}
message lvm_maxlv_ask {MaxLogicalVolumes?}
message lvm_maxpv_ask {MaxPhysicalVolumes?}
message lvm_extsiz_ask {PhysicalExtentSize (MB)?}
message lvmlv_menufmt { El volumen lógico %-33s% 11uM}
message lvmlv_name_fmt {Nombre: %32s}
message lvmlv_size_fmt {Tamaño: %31dM}
message lvmlv_ro_fmt {Sólo lectura: %25s}
message lvmlv_cont_fmt {Contigua: %25s}
message lvmlv_extnum_fmt {LogicalExtentsNumber: %18s}
message lvmlv_minor_fmt {Menor número: %25s}
message lvmlv_mirrors_fmt {Espejos: %25d}
message lvmlv_regsiz_fmt {MirrorLogRegionSize: %18s}
message lvmlv_pers_fmt {Número de persistente menor: %11s}
message lvmlv_readahsect_fmt {ReadAheadSectors: %18s}
message lvmlv_stripes_fmt {Rayas: %25s}
message lvmlv_stripesiz_fmt {Stripesize: %25s}
message lvmlv_zero_fmt {Puesta a cero de la primera KB: %8s}
message lvmlv_name_ask {Nombre?}
message lvmlv_size_ask {Tamaño (MB)?}
message lvmlv_extnum_ask {LogicalExtentsNumber?}
message lvmlv_minor_ask {Número menor de edad?}
message lvmlv_mirrors_ask {Espejos?}
message lvmlv_regsiz_ask {MirrorLogRegionSize?}
message lvmlv_readahsect_ask {ReadAheadSectors?}
message lvmlv_stripes_ask {Rayas?}
message addusername {8 character username to add:} message addusername {8 character username to add:}
message addusertowheel {Do you wish to add this user to group wheel?} message addusertowheel {Do you wish to add this user to group wheel?}
message Delete_partition
{Borrar partición}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mi.fr,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: msg.mi.fr,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -35,7 +35,7 @@
/* MI Message catalog -- french, machine independent */ /* MI Message catalog -- french, machine independent */
message usage message usage
{utilisation: sysinst [-D] [-f fichier_de_définition] [-r version] {utilisation: sysinst [-D] [-f fichier_de_définition] [-r version] [-C bg:fg]
} }
/* /*
@ -527,15 +527,10 @@ Quelle interface souhaitez-vous utiliser ?
} }
message asknetdev message asknetdev
{Les interfaces suivantes sont utilisables : %s {Quelle interface doit être utilisée ?}
Quelle interface doit être utilisée ?
}
message badnet message netdevs
{Vous n'avez pas choisi une interface réseau dans la liste. {Interfaces disponibles}
Veuillez essayer à nouveau.
Les interfaces réseau suivantes sont utilisables : %s
\nQuel est votre choix ?}
message netinfo message netinfo
{Veuillez répondre aux points suivants afin de pouvoir utiliser {Veuillez répondre aux points suivants afin de pouvoir utiliser
@ -609,11 +604,6 @@ message slattach {
Entrez les "flags" slattach Entrez les "flags" slattach
} }
message netagain
{
Veuillez spécifier de nouveau les paramètres réseau.
}
message wait_network message wait_network
{ {
Veuillez patienter pendant la configuration de l'interface... Veuillez patienter pendant la configuration de l'interface...
@ -1000,6 +990,7 @@ message Re_install_sets_or_install_additional_sets {R
message Reboot_the_computer {Redémarrer l'ordinateur} message Reboot_the_computer {Redémarrer l'ordinateur}
message Utility_menu {Utilitaires} message Utility_menu {Utilitaires}
message Config_menu {Configuration} message Config_menu {Configuration}
message exit_menu_generic {Quitter}
message exit_utility_menu {Quitter} message exit_utility_menu {Quitter}
message NetBSD_VERSION_Utilities {Utilitaires NetBSD-@@VERSION@@} message NetBSD_VERSION_Utilities {Utilitaires NetBSD-@@VERSION@@}
message Run_bin_sh {Exécuter /bin/sh} message Run_bin_sh {Exécuter /bin/sh}
@ -1058,6 +1049,11 @@ message other {autre }
message Perform_IPv6_autoconfiguration {Configurer automatiquement l'IPv6 ?} message Perform_IPv6_autoconfiguration {Configurer automatiquement l'IPv6 ?}
message Perform_DHCP_autoconfiguration {Configurer automatiquement par DHCP ?} message Perform_DHCP_autoconfiguration {Configurer automatiquement par DHCP ?}
message Root_shell {Shell du compte "root"} message Root_shell {Shell du compte "root"}
message Color_scheme {Jeu de couleurs}
message White_on_black {Blanc sur noir}
message Black_on_white {Noir sur blanc}
message White_on_blue {Blanc sur bleu}
message Green_on_black {Vert sur noir}
message User_shell {Shell du compte "user"} message User_shell {Shell du compte "user"}
.if AOUT2ELF .if AOUT2ELF
@ -1127,6 +1123,10 @@ message enable_sshd {Activer sshd}
message enable_ntpd {Activer ntpd} message enable_ntpd {Activer ntpd}
message run_ntpdate {Executer ntpdate au démarrage} message run_ntpdate {Executer ntpdate au démarrage}
message enable_mdnsd {Activer mdnsd} message enable_mdnsd {Activer mdnsd}
message enable_xdm {Activer xdm}
message enable_cgd {Activer cgd}
message enable_lvm {Activer lvm}
message enable_raid {Activer raidframe}
message add_a_user {Add a user} message add_a_user {Add a user}
message configmenu {Configurer les items suivants si nécéssaire.} message configmenu {Configurer les items suivants si nécéssaire.}
message doneconfig {Configuration terminée} message doneconfig {Configuration terminée}
@ -1152,9 +1152,159 @@ message get_pkgsrc
{Obtenir et extraire pkgsrc afin de compiler des paquetages à partir des sources} {Obtenir et extraire pkgsrc afin de compiler des paquetages à partir des sources}
message retry_pkgsrc_network {La configuration du réseau a échoué. Réessayer ?} message retry_pkgsrc_network {La configuration du réseau a échoué. Réessayer ?}
message quit_pkgsrc {Quitter sans installer pkgsrc} message quit_pkgsrc {Quitter sans installer pkgsrc}
message quit_pkgs_install {Quitter sans installer bin pkg}
message pkgin_failed message pkgin_failed
{L'installation de pkgin a échoué, peut-être parce que son paquetage binaire {L'installation de pkgin a échoué, peut-être parce que son paquetage binaire
n'existe pas. Vérifiez le chemin et essayez à nouveau.} n'existe pas. Vérifiez le chemin et essayez à nouveau.}
message failed {Échoué} message failed {Échoué}
message notsupported {Le fonctionnement n'est pas pris en charge!}
message askfsmountadv {Point de montage ou de 'raid' ou 'cgd' ou 'lvm'?}
message partman {Partitionnement étendue}
message editbsdpart {Modifier les partitions BSD}
message editmbr {Modifiez et enregistrez MBR}
message switchgpt {Mettre à GPT}
message switchmbr {Basculer vers MBR}
message renamedisk {Définir le nom du disque}
message fmtasraid {Format en RAID}
message fmtaslvm {Format de LVM PV}
message encrypt {Crypter}
message setbootable {Drapeau d'amorçage}
message erase {Fonction d'effacement sécurisé}
message undo {Annuler les changements}
message unconfig {Annulation de la configuration}
message edit {Éditer}
message doumount {Groupe umount}
message fillzeros {Remplir de zéros}
message fillrandom {Remplissez par des données aléatoires}
message fillcrypto {Remplissez par crypto données}
message raid0 {0 - Pas de parité, l'entrelacement seulement simple.}
message raid1 {1 - Mirroring. La parité est le miroir.}
message raid4 {4 - Entrelacement avec parité stockées sur le dernier composant. component.}
message raid5 {5 - Entrelacement avec parité à tous les composants. components.}
message fremove {ENLEVER}
message remove {Supprimer}
message add {Ajouter}
message auto {auto}
message removepartswarn {Cette supprimer toutes les partitions sur le disque. Voulez-vous continuer? want to continue?}
message saveprompt {Enregistrer les modifications avant de terminer?}
message cantsave {Aucune modification ne peut être sauvé.}
message noroot {Aucune partition racine défini, ne peut pas continuer \n continue\n}
message wannaunblock {L'appareil est bloqué. Voulez-vous forcer le débloquer et continuer? unblock it and continue?}
message wannatry {Voulez-vous essayer?}
message create_cgd {Le volume cryptographique Créer (CGD)}
message create_cnd {Créer une image de disque virtuel (VND)}
message create_vg {Créer un groupe de volumes LVM (VG)}
message create_lv { Créer un volume logique}
message create_raid {Créer un RAID logiciel}
message updpmlist {Mettre à jour la liste des dispositifs}
message savepm {Enregistrer les modifications}
message pmblocked {BLOQUE}
message pmunchanged {INCHANGÉ}
message pmsetboot {BOOT}
message pmused {UTILISÉ}
message pmmounted {(monté)}
message pmunused {(non utilisé)}
message pmgptdisk {Disque avec GPT}
message finishpm {Terminer le partitionnement}
message limitcount {Limite pour le nombre de dispositifs a été atteint!}
message invaliddev {Blancs appareil!}
message avdisks {Disques disponibles:}
message nofreedev {Impossible d'allouer noeud de périphérique!}
message partman_header
{Gestionnaire de partition. Tous les disques, les partitions et etc affiché.
Dans un premier temps partitions MBR faire, puis faire étiquette BSD.
Si vous souhaitez utiliser RAID, LVM ou DMC, procédez comme suit:
1) Créer les partitions BSD de type de besoin; 2) Créer un système RAID /
LVM VG / DMC utilisation de ces partitions; 3) la sauver;
4) Créer des partitions pour les volumes RAID / DMC ou logique par LVM.}
message raid_menufmt { raid%d (niveau %1d) sur %-32s %11uM}
message raid_err_menufmt { RAID VIDE!}
message raid_disks_fmt {Disques: %31s}
message raid_spares_fmt {Pièces de rechange: %20s}
message raid_level_fmt {Niveau RAID: %22d}
message raid_numrow_fmt {numRow: %22d}
message raid_numcol_fmt {numCol: %22d}
message raid_numspare_fmt {numSpare: %22d}
message raid_sectpersu_fmt {sectPerSU: %22d}
message raid_superpar_fmt {SUsPerParityUnit: %22d}
message raid_superrec_fmt {SUsPerReconUnit: %22d}
message raid_nomultidim {Tableaux multi-dimensionnels sont pas pris en charge!}
message raid_numrow_ask {numRow?}
message raid_numcol_ask {numCol?}
message raid_numspare_ask {numSpare?}
message raid_sectpersu_ask {sectPerSU?}
message raid_superpar_ask {SUsPerParityUnit?}
message raid_superrec_ask {SUsPerReconUnit?}
message raid_disks {Disques en RAID:}
message vnd_err_menufmt { PATH NOT DEFINED!}
message vnd_assgn_menufmt { vnd%1d sur %-50s ASSIGN}
message vnd_menufmt { vnd%1d sur %-44s %11uM}
message vnd_path_fmt {Chemin du fichier: %20s}
message vnd_assgn_fmt {Attribuer existent image: %14s}
message vnd_size_fmt {Taille: %20sM}
message vnd_ro_fmt {Read-only: %20s}
message vnd_geom_fmt {Définir la géométrie à la main: %8s}
message vnd_bps_fmt {Octets par secteur: %20s}
message vnd_spt_fmt {Secteurs par piste: %20s}
message vnd_tpc_fmt {Pistes par cylindre: %19s}
message vnd_cyl_fmt {Cylindres: %20s}
message vnd_path_ask {Chemin du fichier?}
message vnd_size_ask {Taille (MB)?}
message vnd_bps_ask {Octets par secteur?}
message vnd_spt_ask {Secteurs par piste?}
message vnd_tpc_ask {Pistes par cylindre?}
message vnd_cyl_ask {Cylindres}
message cgd_err_menufmt { DISQUE NON DEFINI!}
message cgd_menufmt { cgd%1d %-48s %11uM}
message cgd_dev_fmt {Dispositif de base: %20s}
message cgd_enc_fmt {Chiffrage: %20s}
message cgd_key_fmt {Taille de la clé: %20d}
message cgd_iv_fmt {Algorithme IV: %20s}
message cgd_keygen_fmt {La génération des clés: %16s}
message cgd_verif_fmt {Méthode de vérification: %15s}
message lvm_disks {Disques à VG:}
message lvm_menufmt { %-44s %20sM}
message lvm_err_menufmt { VIDER VG!}
message lvm_disks_fmt {PV's: %34s}
message lvm_name_fmt {Nom: %35s}
message lvm_maxlv_fmt {MaxLogicalVolumes: %20s}
message lvm_maxpv_fmt {MaxPhysicalVolumes: %20s}
message lvm_extsiz_fmt {PhysicalExtentSize: %20s}
message lvm_name_ask {Nom?}
message lvm_maxlv_ask {MaxLogicalVolumes?}
message lvm_maxpv_ask {MaxPhysicalVolumes?}
message lvm_extsiz_ask {PhysicalExtentSize (MB)?}
message lvmlv_menufmt { Logique volume %-35s %11uM}
message lvmlv_name_fmt {Nom: %35s}
message lvmlv_size_fmt {Taille: %29dM}
message lvmlv_ro_fmt {Read-only: %29s}
message lvmlv_cont_fmt {Contiguë: %29s}
message lvmlv_extnum_fmt {LogicalExtentsNumber: %18s}
message lvmlv_minor_fmt {Nombre mineur: %25s}
message lvmlv_mirrors_fmt {Miroirs: %29d}
message lvmlv_regsiz_fmt {MirrorLogRegionSize: %18s}
message lvmlv_pers_fmt {Persistante numéro mineur: %13s}
message lvmlv_readahsect_fmt {ReadAheadSectors: %22s}
message lvmlv_stripes_fmt {Rayures: %28s}
message lvmlv_stripesiz_fmt {Stripesize: %28s}
message lvmlv_zero_fmt {Remise à zéro de la KB d'abord: %8s}
message lvmlv_name_ask {Nom?}
message lvmlv_size_ask {Taille (MB)?}
message lvmlv_extnum_ask {LogicalExtentsNumber?}
message lvmlv_minor_ask {Numéro mineur?}
message lvmlv_mirrors_ask {Miroirs?}
message lvmlv_regsiz_ask {MirrorLogRegionSize?}
message lvmlv_readahsect_ask {ReadAheadSectors?}
message lvmlv_stripes_ask {Stripes?}
message addusername {8 character username to add:} message addusername {8 character username to add:}
message addusertowheel {Do you wish to add this user to group wheel?} message addusertowheel {Do you wish to add this user to group wheel?}
message Delete_partition
{Supprimer la partition}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mi.pl,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: msg.mi.pl,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* Based on english version: */ /* Based on english version: */
/* NetBSD: msg.mi.pl,v 1.36 2004/04/17 18:55:35 atatat Exp */ /* NetBSD: msg.mi.pl,v 1.36 2004/04/17 18:55:35 atatat Exp */
@ -37,7 +37,7 @@
/* MI Message catalog -- polish, machine independent */ /* MI Message catalog -- polish, machine independent */
message usage message usage
{uzycie: sysinst [-D] [-f plik_definicja] [-r wersja] {uzycie: sysinst [-D] [-f plik_definicja] [-r wersja] [-C bg:fg]
} }
/* /*
@ -498,13 +498,10 @@ message netup
Czy ktorys z nich jest podlaczony do serwera?} Czy ktorys z nich jest podlaczony do serwera?}
message asknetdev message asknetdev
{Znalazlem nastepujace interfejsy sieciowe : %s {Ktorego urzadzenia mam uzyc?}
\nKtorego urzadzenia mam uzyc?}
message badnet message netdevs
{Nie wybrales zadnego z podanych urzadzen sieciowych. Sprobuj jeszcze raz. {Dost?pne interfejsy}
Nastepujace urzadzenie sieciowe sa dostepne: %s
\nKtorego urzadzenia mam uzyc?}
message netinfo message netinfo
{Aby mozna bylo uzywac sieci, potrzebujemy odpowiedzi na ponizsze pytania: {Aby mozna bylo uzywac sieci, potrzebujemy odpowiedzi na ponizsze pytania:
@ -577,12 +574,6 @@ message slattach {
Podaja parametry dla polecenia 'slattach' Podaja parametry dla polecenia 'slattach'
} }
message netagain
{Wprowadz jeszcze raz informacje o twojej sieci. Twoje ostatnie odpowiedzi
beda domyslnymi wartosciami.
}
message wait_network message wait_network
{ {
Poczekaj, az interfejs sieciowy zostanie uaktywniony. Poczekaj, az interfejs sieciowy zostanie uaktywniony.
@ -899,6 +890,7 @@ message Re_install_sets_or_install_additional_sets {Przeinstaluj albo zainstaluj
message Reboot_the_computer {Zrestartuj komputer} message Reboot_the_computer {Zrestartuj komputer}
message Utility_menu {Menu Narzedziowe} message Utility_menu {Menu Narzedziowe}
message Config_menu {Menu konfiguracji} message Config_menu {Menu konfiguracji}
message exit_menu_generic {Nazad}
message exit_utility_menu {Exit} message exit_utility_menu {Exit}
message NetBSD_VERSION_Utilities {Narzedzia NetBSD-@@VERSION@@} message NetBSD_VERSION_Utilities {Narzedzia NetBSD-@@VERSION@@}
message Run_bin_sh {Uruchom /bin/sh} message Run_bin_sh {Uruchom /bin/sh}
@ -957,6 +949,11 @@ message other {inny }
message Perform_IPv6_autoconfiguration {Wykonac autokonfiguracje IPv6?} message Perform_IPv6_autoconfiguration {Wykonac autokonfiguracje IPv6?}
message Perform_DHCP_autoconfiguration {Wykonac autkonfiguracje DHCP?} message Perform_DHCP_autoconfiguration {Wykonac autkonfiguracje DHCP?}
message Root_shell {Powloka root'a} message Root_shell {Powloka root'a}
message Color_scheme {Kolorystyka}
message White_on_black {Bia³y na czarnym}
message Black_on_white {Czarno na bia³ym}
message White_on_blue {Bia³y na niebieskim}
message Green_on_black {Zielony na czarnym}
message User_shell {Powloka user'a} message User_shell {Powloka user'a}
.if AOUT2ELF .if AOUT2ELF
@ -1020,6 +1017,10 @@ message enable_sshd {Wlacz sshd}
message enable_ntpd {Wlacz ntpd} message enable_ntpd {Wlacz ntpd}
message run_ntpdate {uruchom ntpdate podczas startu systemu} message run_ntpdate {uruchom ntpdate podczas startu systemu}
message enable_mdnsd {Wlacz mdnsd} message enable_mdnsd {Wlacz mdnsd}
message enable_xdm {Enable xdm}
message enable_cgd {Enable cgd}
message enable_lvm {Enable lvm}
message enable_raid {Enable raidframe}
message add_a_user {Add a user} message add_a_user {Add a user}
message configmenu {Skonfiguruj dodatkowe elementy w razie potrzeby.} message configmenu {Skonfiguruj dodatkowe elementy w razie potrzeby.}
message doneconfig {Konfiguracja zakonczona} message doneconfig {Konfiguracja zakonczona}
@ -1046,10 +1047,159 @@ zrodel}
message retry_pkgsrc_network {Konfiguracja sieci nie powiodla sie. Sprobowac message retry_pkgsrc_network {Konfiguracja sieci nie powiodla sie. Sprobowac
ponownie?} ponownie?}
message quit_pkgsrc {Zakoncz bez zainstalowania pkgsrc} message quit_pkgsrc {Zakoncz bez zainstalowania pkgsrc}
message quit_pkgs_install {Zakoncz bez zainstalowania bin pkg}
message pkgin_failed message pkgin_failed
{Instalacja pkgin nie powiodla sie, prawdopodobnie dlatego ze nie znaleziono {Instalacja pkgin nie powiodla sie, prawdopodobnie dlatego ze nie znaleziono
pakietow binarnych. pakietow binarnych.
Sprawdz sciezke pakietow i sprobuj ponownie.} Sprawdz sciezke pakietow i sprobuj ponownie.}
message failed {Nie powiodlo sie} message failed {Nie powiodlo sie}
message notsupported {Operacja nie jest obs³ugiwana!}
message askfsmountadv {Montowania lub "raid" lub "cgd" lub "lvm"?}
message partman {Partycje rozszerzone}
message editbsdpart {Edytuj partycje BSD}
message editmbr {Edytowaæ i zapisywaæ MBR}
message switchgpt {Prze³±cz na GPT}
message switchmbr {Prze³±cz na MBR}
message renamedisk {Ustaw nazwê dysku}
message fmtasraid {Format jak RAID}
message fmtaslvm {Format jak LVM PV}
message encrypt {Szyfrowanie}
message setbootable {Bootable flaga}
message erase {Bezpieczne kasowanie}
message undo {Cofanie zmian}
message unconfig {Zdekonfigurowanie}
message edit {Edytuj}
message doumount {Si³a umount}
message fillzeros {Wype³nij zerami}
message fillrandom {Wype³nij losowymi danymi}
message fillcrypto {Wype³nij przez crypto danych}
message raid0 {0 - brak parzystoci, tylko proste rozk³adanie.}
message raid1 {1 - Mirroring. Parytet jest lustro.}
message raid4 {4 - Malowanie z parytetu przechowywanych w ostatniej czêci.}
message raid5 {5 - Malowanie z parytetu w tych wszystkich elementów.}
message fremove {USUÑ}
message remove {Usun±æ}
message add {Dodaæ}
message auto {auto}
message removepartswarn {To usun±æ wszystkie partycje na dysku. Czy chcesz kontynuowaæ?}
message saveprompt {Zapisz zmiany przed zakoñczeniem?}
message cantsave {Zmiany nie mog± byæ zbawieni.}
message noroot {No partycja zdefiniowana, nie mo¿e kontynuowaæ \n}
message wannaunblock {Urz±dzenie jest zablokowane. Czy chcesz, aby zmusiæ go odblokowaæ i kontynuowaæ?}
message wannatry {Czy chcesz spróbowaæ?}
message create_cgd {Utwórz wolumen kryptograficznych (CGD)}
message create_cnd {Utwórz wirtualnego obraz dysku (VND)}
message create_vg {Utwórz grupê woluminów (LVM VG)}
message create_lv { Utwórz wolumin logiczny}
message create_raid {Utwórz oprogramowania RAID}
message updpmlist {Aktualizuj listê urz±dzeñ}
message savepm {Zapisz zmiany}
message pmblocked {ZABLOK.}
message pmunchanged {BEZ ZMIAN}
message pmsetboot {BOOT}
message pmused {U¯YWANE}
message pmmounted {(zamontowany)}
message pmunused {(nieu¿ywany)}
message pmgptdisk {Dysku z GPT}
message finishpm {Zakoñcz partycjonowanie}
message limitcount {Limit liczby urz±dzeñ zosta³ osi±gniêty!}
message invaliddev {Nieprawid³owy urz±dzenie!}
message avdisks {Dostêpne dysków:}
message nofreedev {Nie mo¿na przydzieliæ wêze³!}
message partman_header
{Partition Manager. Wszystkie dyski, partycje oraz itp. tam wywietlane.
Pocz±tkowo sprawiaj± partycji MBR, a nastêpnie dokonaæ BSD etykietê.
Jeli chcesz korzystaæ z RAID, LVM lub CGD, wykonaj nastêpuj±ce kroki:
1) Tworzenie partycji BSD z potrzebnego typu;
2) Utwórz RAID / LVM VG / CGD korzystania z tych partycji; 3) Zapisz go;
4) Tworzenie partycji dla RAID / CGD lub Logical Volumes dla LVM.}
message raid_menufmt { raid%d (level %1d) on %-34s %11uM}
message raid_err_menufmt { EMPTY RAID!}
message raid_disks_fmt {Dyski: %33s}
message raid_spares_fmt {Czêci zamienne: %23s}
message raid_level_fmt {Poziom RAID: %23d}
message raid_numrow_fmt {numRow: %23d}
message raid_numcol_fmt {numCol: %23d}
message raid_numspare_fmt {numSpare: %23d}
message raid_sectpersu_fmt {sectPerSU: %22d}
message raid_superpar_fmt {SUsPerParityUnit: %22d}
message raid_superrec_fmt {SUsPerReconUnit: %22d}
message raid_nomultidim {Tablice wielowymiarowe nie s± obs³ugiwane!}
message raid_numrow_ask {numRow?}
message raid_numcol_ask {numCol?}
message raid_numspare_ask {numSpare?}
message raid_sectpersu_ask {sectPerSU?}
message raid_superpar_ask {SUsPerParityUnit?}
message raid_superrec_ask {SUsPerReconUnit?}
message raid_disks {Dyski w RAID:}
message vnd_err_menufmt { ¦CIE¯KA NIE ZDEFINIOWANE!}
message vnd_assgn_menufmt { vnd%1d na %-51s ASSIGN}
message vnd_menufmt { vnd%1d na %-45s %11uM}
message vnd_path_fmt {¦cie¿ka: %31s}
message vnd_assgn_fmt {Przypisywanie istnieæ obraz: %11s}
message vnd_size_fmt {Rozmiar: %30sM}
message vnd_ro_fmt {Tylko do odczytu: %20s}
message vnd_geom_fmt {Ustaw geometriê rêcznie: %15s}
message vnd_bps_fmt {Bajtów na sektorów: %20s}
message vnd_spt_fmt {Sektory na cie¿ki: %20s}
message vnd_tpc_fmt {Utwory na cylinder: %20s}
message vnd_cyl_fmt {Si³owniki: %20s}
message vnd_path_ask {File Path?}
message vnd_size_ask {Rozmiar (MB)?}
message vnd_bps_ask {Bajtów na sektor?}
message vnd_spt_ask {Sektory na cie¿?}
message vnd_tpc_ask {Utwory na cylinder?}
message vnd_cyl_ask {Cylindry}
message cgd_err_menufmt { DISK NIE ZDEFINIOWANE!}
message cgd_menufmt { cgd%1d %-48s %11uM}
message cgd_dev_fmt {Urz±dzenie podstawy: %19s}
message cgd_enc_fmt {Encyption: %19s}
message cgd_key_fmt {Rozmiar klucza: %19d}
message cgd_iv_fmt {Algorytm IV: %27s}
message cgd_keygen_fmt {Generowanie kluczy: %20s}
message cgd_verif_fmt {Metoda weryfikacji: %20s}
message lvm_disks {Dyski w VG:}
message lvm_menufmt { %-44s %20sM}
message lvm_err_menufmt { EMPTY VG!}
message lvm_disks_fmt {PV's: %34s}
message lvm_name_fmt {Nazwa: %33s}
message lvm_maxlv_fmt {MaxLogicalVolumes: %20s}
message lvm_maxpv_fmt {MaxPhysicalVolumes: %20s}
message lvm_extsiz_fmt {PhysicalExtentSize: %20s}
message lvm_name_ask {Nazwa?}
message lvm_maxlv_ask {MaxLogicalVolumes?}
message lvm_maxpv_ask {MaxPhysicalVolumes?}
message lvm_extsiz_ask {PhysicalExtentSize (MB)?}
message lvmlv_menufmt { Wolumin logiczny%-34s %11uM}
message lvmlv_name_fmt {Nazwa: %33s}
message lvmlv_size_fmt {Rozmiar: %30dM}
message lvmlv_ro_fmt {Read-only: %23s}
message lvmlv_cont_fmt {S±siaduj±cy: %23s}
message lvmlv_extnum_fmt {LogicalExtentsNumber: %18s}
message lvmlv_minor_fmt {Mniejsza liczba: %23s}
message lvmlv_mirrors_fmt {Mirrors: %27d}
message lvmlv_regsiz_fmt {MirrorLogRegionSize: %18s}
message lvmlv_pers_fmt {Trwa³e drobne numer: %18s}
message lvmlv_readahsect_fmt {ReadAheadSectors ceny: %17s}
message lvmlv_stripes_fmt {Stripes: %27s}
message lvmlv_stripesiz_fmt {StripeSize: %27s}
message lvmlv_zero_fmt {Zerowanie pierwszej KB: %16s}
message lvmlv_name_ask {Nazwa?}
message lvmlv_size_ask {Rozmiar (MB)?}
message lvmlv_extnum_ask {LogicalExtentsNumber?}
message lvmlv_minor_ask {Mniejsza liczba?}
message lvmlv_mirrors_ask {Mirrors?}
message lvmlv_regsiz_ask {MirrorLogRegionSize?}
message lvmlv_readahsect_ask {ReadAheadSectors?}
message lvmlv_stripes_ask {Stripes?}
message addusername {8 character username to add:} message addusername {8 character username to add:}
message addusertowheel {Do you wish to add this user to group wheel?} message addusertowheel {Do you wish to add this user to group wheel?}
message Delete_partition
{Usun partycje}

View File

@ -1,4 +1,4 @@
/* $NetBSD: net.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: net.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -64,8 +64,12 @@
int network_up = 0; int network_up = 0;
/* Access to network information */ /* Access to network information */
static char *net_devices; #define MAX_NETS 15
static char *net_up; struct net_desc {
char if_dev[STRSIZE];
char name[STRSIZE]; // TODO
};
static char net_dev[STRSIZE]; static char net_dev[STRSIZE];
static char net_domain[STRSIZE]; static char net_domain[STRSIZE];
static char net_host[STRSIZE]; static char net_host[STRSIZE];
@ -200,7 +204,6 @@ url_encode(char *dst, const char *src, const char *ep,
return dst; return dst;
} }
static const char *ignored_if_names[] = { static const char *ignored_if_names[] = {
"eon", /* netiso */ "eon", /* netiso */
"gre", /* net */ "gre", /* net */
@ -208,6 +211,7 @@ static const char *ignored_if_names[] = {
"gif", /* netinet6 */ "gif", /* netinet6 */
"faith", /* netinet6 */ "faith", /* netinet6 */
"lo", /* net */ "lo", /* net */
"lo0", /* net */
#if 0 #if 0
"mdecap", /* netinet -- never in IF list (?) XXX */ "mdecap", /* netinet -- never in IF list (?) XXX */
#endif #endif
@ -222,24 +226,19 @@ static const char *ignored_if_names[] = {
NULL, NULL,
}; };
static void static int
get_ifconfig_info(void) get_ifconfig_info(struct net_desc *devs)
{ {
char *textbuf; char *buf_in;
char *t, *nt; char *buf_tmp;
const char **ignore; const char **ignore;
char *buf;
char *tmp;
int textsize; int textsize;
ulong fl; int i;
char *cp;
free(net_devices);
net_devices = NULL;
free(net_up);
net_up = NULL;
/* Get ifconfig information */ /* Get ifconfig information */
textsize = collect(T_OUTPUT, &buf_in, "/sbin/ifconfig -l 2>/dev/null");
textsize = collect(T_OUTPUT, &textbuf, "/sbin/ifconfig -a 2>/dev/null");
if (textsize < 0) { if (textsize < 0) {
if (logfp) if (logfp)
(void)fprintf(logfp, (void)fprintf(logfp,
@ -248,52 +247,31 @@ get_ifconfig_info(void)
exit(1); exit(1);
} }
for (t = textbuf; t != NULL && *t != 0; t = nt) { buf = malloc (STRSIZE * sizeof(char));
/* find entry for next interface */ for (i = 0, buf_tmp = buf_in; strlen(buf_tmp) > 0 && buf_tmp < buf_in +
for (nt = t; (nt = strchr(nt, '\n')); ) { strlen(buf_in);) {
if (*++nt != '\t') tmp = stpncpy(buf, buf_tmp, strcspn(buf_tmp," \n"));
break; *tmp='\0';
} buf_tmp += (strcspn(buf_tmp, " \n") + 1) * sizeof(char);
if (memcmp(t, "lo0:", 4) == 0)
/* completely ignore loopback interface */
continue;
cp = strchr(t, '=');
if (cp == NULL)
break;
/* get interface flags */
fl = strtoul(cp + 1, &cp, 16);
if (*cp != '<')
break;
/* Skip ignored interfaces */
for (ignore = ignored_if_names; *ignore != NULL; ignore++) { for (ignore = ignored_if_names; *ignore != NULL; ignore++) {
size_t len = strlen(*ignore); size_t len = strlen(*ignore);
if (strncmp(t, *ignore, len) == 0 && if (strncmp(buf, *ignore, len) == 0 &&
isdigit((unsigned char)t[len])) isdigit((unsigned char)buf[len]))
break; break;
} }
if (*ignore != NULL) if (*ignore != NULL)
continue; continue;
if (fl & IFF_UP) { strncpy (devs[i].if_dev, buf, STRSIZE);
/* This interface might be connected to the server */ i++;
cp = strchr(t, ':');
if (cp == NULL)
break;
asprintf(&cp, "%s%.*s ",
net_up ? net_up : "", (int)(cp - t), t);
free(net_up);
net_up = cp;
}
cp = strchr(t, ':');
if (cp == NULL)
break;
asprintf(&cp, "%s%.*s ",
net_devices ? net_devices : "", (int)(cp - t), t);
free(net_devices);
net_devices = cp;
} }
free(textbuf); strcpy(devs[i].if_dev, "\0");
free(buf);
free(buf_in);
return i;
} }
static int static int
@ -539,9 +517,6 @@ handle_license(const char *dev)
int int
config_network(void) config_network(void)
{ {
char *tp;
char *defname;
const char *prompt;
char *textbuf; char *textbuf;
int octet0; int octet0;
int dhcp_config; int dhcp_config;
@ -551,8 +526,13 @@ config_network(void)
char **ap, *slcmd[10], *in_buf; char **ap, *slcmd[10], *in_buf;
char buffer[STRSIZE]; char buffer[STRSIZE];
struct statvfs sb; struct statvfs sb;
struct net_desc net_devs[MAX_NETS];
menu_ent net_menu[5];
int menu_no;
int num_devs;
int selected_net;
int l; int i;
char dhcp_host[STRSIZE]; char dhcp_host[STRSIZE];
#ifdef INET6 #ifdef INET6
int v6config = 1; int v6config = 1;
@ -564,43 +544,38 @@ config_network(void)
if (network_up) if (network_up)
return (1); return (1);
get_ifconfig_info(); num_devs = get_ifconfig_info(net_devs);
if (net_up != NULL) { if (num_devs < 1) {
/* XXX: some retry loops come here... */
/* active interfaces found */
msg_display(MSG_netup, net_up);
process_menu(MENU_yesno, NULL);
if (!yesno)
return 0;
}
if (net_devices == NULL) {
/* No network interfaces found! */ /* No network interfaces found! */
msg_display(MSG_nonet); msg_display(MSG_nonet);
process_menu(MENU_ok, NULL); process_menu(MENU_ok, NULL);
return (-1); return (-1);
} }
for (i = 0; i < num_devs; i++) {
net_menu[i].opt_name = net_devs[i].if_dev;
net_menu[i].opt_menu = OPT_NOMENU;
net_menu[i].opt_flags = OPT_EXIT;
net_menu[i].opt_action = set_menu_select;
}
again:
selected_net = -1;
menu_no = new_menu(MSG_netdevs,
net_menu, num_devs, -1, 4, 0, 0,
MC_SCROLL,
NULL, NULL, NULL, NULL, NULL);
msg_display(MSG_asknetdev, "");
process_menu(menu_no, &selected_net);
free_menu(menu_no);
if (selected_net == -1)
return 0;
network_up = 1; network_up = 1;
again: strncpy(net_dev, net_devs[selected_net].if_dev, STRSIZE);
tp = strchr(net_devices, ' ');
asprintf(&defname, "%.*s", (int)(tp - net_devices), net_devices);
for (prompt = MSG_asknetdev;; prompt = MSG_badnet) {
msg_prompt(prompt, defname, net_dev, sizeof net_dev - 1,
net_devices);
l = strlen(net_dev);
net_dev[l] = ' ';
net_dev[l + 1] = 0;
tp = strstr(net_devices, net_dev);
if (tp == NULL)
continue;
if (tp != net_devices && tp[-1] != ' ')
continue;
net_dev[l] = 0;
break;
}
free(defname);
if (!handle_license(net_dev)) if (!handle_license(net_dev))
goto done; goto done;
@ -802,8 +777,7 @@ again:
#endif #endif
done: done:
process_menu(MENU_yesno, deconst(MSG_netok_ok)); process_menu(MENU_yesno, deconst(MSG_netok_ok));
if (!yesno)
msg_display(MSG_netagain);
if (!yesno) if (!yesno)
goto again; goto again;
@ -1028,40 +1002,18 @@ do_ftp_fetch(const char *set_name, struct ftpinfo *f)
return rval ? SET_RETRY : SET_OK; return rval ? SET_RETRY : SET_OK;
} }
static int
do_config_network(void)
{
int ret;
while ((ret = config_network()) <= 0) { // XXX: check MSG_netnotup_continueanyway and MSG_netnotup
if (ret < 0)
return (-1);
msg_display(MSG_netnotup);
process_menu(MENU_yesno, NULL);
if (!yesno) {
msg_display(MSG_netnotup_continueanyway);
process_menu(MENU_yesno, NULL);
if (!yesno)
return -1;
network_up = 1;
break;
}
}
return 0;
}
int int
get_pkgsrc(void) get_pkgsrc(void)
{ {
if (!network_up) yesno = -1;
if (do_config_network() != 0)
return SET_RETRY;
yesno = 1;
process_menu(MENU_pkgsrc, NULL); process_menu(MENU_pkgsrc, NULL);
if (yesno == 0) if (yesno == SET_SKIP)
return SET_SKIP; return SET_SKIP;
fetch_fn = pkgsrc_fetch; fetch_fn = pkgsrc_fetch;
snprintf(ext_dir_pkgsrc, sizeof ext_dir_pkgsrc, "%s/%s", snprintf(ext_dir_pkgsrc, sizeof ext_dir_pkgsrc, "%s/%s",
target_prefix(), xfer_dir + (*xfer_dir == '/')); target_prefix(), xfer_dir + (*xfer_dir == '/'));
@ -1072,11 +1024,11 @@ get_pkgsrc(void)
int int
get_via_ftp(const char *xfer_type) get_via_ftp(const char *xfer_type)
{ {
yesno = -1;
if (do_config_network() != 0)
return SET_RETRY;
process_menu(MENU_ftpsource, deconst(xfer_type)); process_menu(MENU_ftpsource, deconst(xfer_type));
if (yesno == SET_RETRY)
return SET_RETRY;
/* We'll fetch each file just before installing it */ /* We'll fetch each file just before installing it */
fetch_fn = ftp_fetch; fetch_fn = ftp_fetch;
@ -1094,9 +1046,6 @@ get_via_nfs(void)
{ {
struct statvfs sb; struct statvfs sb;
if (do_config_network() != 0)
return SET_RETRY;
/* If root is on NFS and we have sets, skip this step. */ /* If root is on NFS and we have sets, skip this step. */
if (statvfs(set_dir_bin, &sb) == 0 && if (statvfs(set_dir_bin, &sb) == 0 &&
strcmp(sb.f_fstypename, "nfs") == 0) { strcmp(sb.f_fstypename, "nfs") == 0) {
@ -1106,7 +1055,11 @@ get_via_nfs(void)
} }
/* Get server and filepath */ /* Get server and filepath */
yesno = -1;
process_menu(MENU_nfssource, NULL); process_menu(MENU_nfssource, NULL);
if (yesno == SET_RETRY)
return SET_RETRY;
/* Mount it */ /* Mount it */
if (run_program(0, "/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",

2793
usr.sbin/sysinst/partman.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $NetBSD: run.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: run.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -124,7 +124,14 @@ log_flip(menudesc *m, void *arg)
"Log started at: %s\n", asctime(localtime(&tloc))); "Log started at: %s\n", asctime(localtime(&tloc)));
fflush(logfp); fflush(logfp);
} else { } else {
msg_display(MSG_openfail, "log file", strerror(errno)); if (mainwin) {
msg_display(MSG_openfail, "log file",
strerror(errno));
} else {
fprintf(stderr, "could not open /tmp/sysinst.log: %s\n",
strerror(errno));
exit(1);
}
} }
} }
return(0); return(0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: savenewlabel.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: savenewlabel.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Jonathan Stone * Copyright 1997 Jonathan Stone
@ -36,7 +36,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: savenewlabel.c,v 1.1 2014/07/26 19:30:44 dholland Exp $"); __RCSID("$NetBSD: savenewlabel.c,v 1.2 2014/08/03 16:09:38 martin Exp $");
#endif #endif
#include <sys/types.h> #include <sys/types.h>
@ -58,7 +58,22 @@ int
savenewlabel(partinfo *lp, int nparts) savenewlabel(partinfo *lp, int nparts)
{ {
FILE *f; FILE *f;
char *f_name = malloc(STRSIZE * sizeof(char));
int i; int i;
pm_devs_t *pm_i;
/* Check names collision */
if (partman_go)
SLIST_FOREACH(pm_i, &pm_head, l)
for (i = 'a'; pm_i != pm && i < 'z' &&
! strcmp(pm_i->bsddiskname, pm->bsddiskname); i++) {
if (strlen(pm_i->bsddiskname) > 0)
pm_i->bsddiskname[strlen(pm_i->bsddiskname)-1] = i;
else
snprintf(pm_i->bsddiskname, DISKNAME_SIZE, "disk %c", i);
}
snprintf(f_name, STRSIZE, "/tmp/disktab.%s", pm->bsddiskname);
/* /*
N.B. disklabels only support up to 2TB (32-bit field for sectors). N.B. disklabels only support up to 2TB (32-bit field for sectors).
@ -67,40 +82,41 @@ savenewlabel(partinfo *lp, int nparts)
*/ */
/* Create /etc/disktab */ /* Create /etc/disktab */
f = fopen("/tmp/disktab", "w");
f = fopen(f_name, "w");
if (logfp) if (logfp)
(void)fprintf(logfp, "Creating disklabel %s\n", bsddiskname); (void)fprintf(logfp, "Creating disklabel %s in %s\n", pm->bsddiskname,
f_name);
scripting_fprintf(NULL, "cat <<EOF >>/etc/disktab\n"); scripting_fprintf(NULL, "cat <<EOF >>/etc/disktab\n");
if (f == NULL) { if (f == NULL) {
endwin(); endwin();
(void)fprintf(stderr, "Could not open /etc/disktab"); (void)fprintf(stderr, "Could not open %s for writing\n", f_name);
if (logfp) if (logfp)
(void)fprintf(logfp, (void)fprintf(logfp, "Could not open %s for writing\n", f_name);
"Failed to open /etc/disktab for appending.\n");
exit (1); exit (1);
} }
scripting_fprintf(f, "%s|NetBSD installation generated:\\\n", bsddiskname); scripting_fprintf(f, "%s|NetBSD installation generated:\\\n", pm->bsddiskname);
scripting_fprintf(f, "\t:dt=%s:ty=winchester:\\\n", disktype); scripting_fprintf(f, "\t:dt=%s:ty=winchester:\\\n", pm->disktype);
scripting_fprintf(f, "\t:nc#%d:nt#%d:ns#%d:\\\n", dlcyl, dlhead, dlsec); scripting_fprintf(f, "\t:nc#%d:nt#%d:ns#%d:\\\n", pm->dlcyl, pm->dlhead, pm->dlsec);
scripting_fprintf(f, "\t:sc#%d:su#%" PRIu32 ":\\\n", dlhead*dlsec, scripting_fprintf(f, "\t:sc#%d:su#%" PRIu32 ":\\\n", pm->dlhead*pm->dlsec,
(uint32_t)dlsize); (uint32_t)pm->dlsize);
scripting_fprintf(f, "\t:se#%d:%s\\\n", sectorsize, doessf); scripting_fprintf(f, "\t:se#%d:%s\\\n", pm->sectorsize, pm->doessf);
if ((size_t)nparts > __arraycount(bsdlabel)) { if ((size_t)nparts > __arraycount(pm->bsdlabel)) {
nparts = __arraycount(bsdlabel); nparts = __arraycount(pm->bsdlabel);
if (logfp) if (logfp)
(void)fprintf(logfp, "nparts limited to %d.\n", nparts); (void)fprintf(logfp, "nparts limited to %d.\n", nparts);
} }
for (i = 0; i < nparts; i++) { for (i = 0; i < nparts; i++) {
scripting_fprintf(f, "\t:p%c#%" PRIu32 ":o%c#%" PRIu32 scripting_fprintf(f, "\t:p%c#%" PRIu32 ":o%c#%" PRIu32
":t%c=%s:", 'a'+i, (uint32_t)bsdlabel[i].pi_size, ":t%c=%s:", 'a'+i, (uint32_t)lp[i].pi_size,
'a'+i, (uint32_t)bsdlabel[i].pi_offset, 'a'+i, 'a'+i, (uint32_t)lp[i].pi_offset, 'a'+i,
getfslabelname(bsdlabel[i].pi_fstype)); getfslabelname(lp[i].pi_fstype));
if (PI_ISBSDFS(&bsdlabel[i])) if (PI_ISBSDFS(&lp[i]))
scripting_fprintf (f, "b%c#%" PRIu32 ":f%c#%" PRIu32 scripting_fprintf (f, "b%c#%" PRIu32 ":f%c#%" PRIu32
":", 'a'+i, ":", 'a'+i,
(uint32_t)(bsdlabel[i].pi_fsize * (uint32_t)(lp[i].pi_fsize *
bsdlabel[i].pi_frag), lp[i].pi_frag),
'a'+i, (uint32_t)bsdlabel[i].pi_fsize); 'a'+i, (uint32_t)lp[i].pi_fsize);
if (i < nparts - 1) if (i < nparts - 1)
scripting_fprintf(f, "\\\n"); scripting_fprintf(f, "\\\n");
@ -110,5 +126,6 @@ savenewlabel(partinfo *lp, int nparts)
fclose (f); fclose (f);
scripting_fprintf(NULL, "EOF\n"); scripting_fprintf(NULL, "EOF\n");
fflush(NULL); fflush(NULL);
run_program(0, "sh -c 'cat /tmp/disktab.* >/tmp/disktab'");
return(0); return(0);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: sizemultname.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: sizemultname.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -52,7 +52,7 @@ void
set_sizemultname_cyl(void) set_sizemultname_cyl(void)
{ {
sizemult = dlcylsize; sizemult = pm->dlcylsize;
multname = msg_string(MSG_cylname); multname = msg_string(MSG_cylname);
} }
@ -60,6 +60,6 @@ void
set_sizemultname_meg(void) set_sizemultname_meg(void)
{ {
sizemult = MEG / sectorsize; sizemult = MEG / pm->sectorsize;
multname = msg_string(MSG_megname); multname = msg_string(MSG_megname);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: target.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: target.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Jonathan Stone * Copyright 1997 Jonathan Stone
@ -71,7 +71,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: target.c,v 1.1 2014/07/26 19:30:44 dholland Exp $"); __RCSID("$NetBSD: target.c,v 1.2 2014/08/03 16:09:38 martin Exp $");
#endif #endif
/* /*
@ -146,20 +146,20 @@ backtowin(void)
/* /*
* Is the root partition we're running from the same as the root * Is the root partition we're running from the same as the root
* which the user has selected to install/upgrade? * which the user has selected to install/upgrade?
* Uses global variable "diskdev" to find the selected device for * Uses global variable "pm->diskdev" to find the selected device for
* install/upgrade. * install/upgrade.
*/ */
int int
target_already_root(void) target_already_root(void)
{ {
if (strcmp(diskdev, "") == 0) if (strcmp(pm->diskdev, "") == 0)
/* No root partition was ever selected. /* No root partition was ever selected.
* Assume that the currently mounted one should be used * Assume that the currently mounted one should be used
*/ */
return 1; return 1;
return is_active_rootpart(diskdev, rootpart); return is_active_rootpart(pm->diskdev, pm->rootpart);
} }
@ -280,7 +280,10 @@ do_target_chdir(const char *dir, int must_succeed)
error = 0; error = 0;
tgt_dir = target_expand(dir); tgt_dir = target_expand(dir);
#ifndef DEBUG #ifdef DEBUG
printf("target_chdir (%s)\n", tgt_dir);
//return (0);
#endif
/* chdir returns -1 on error and sets errno. */ /* chdir returns -1 on error and sets errno. */
if (chdir(tgt_dir) < 0) if (chdir(tgt_dir) < 0)
error = errno; error = errno;
@ -303,10 +306,6 @@ do_target_chdir(const char *dir, int must_succeed)
} }
errno = error; errno = error;
return (error); return (error);
#else
printf("target_chdir (%s)\n", tgt_dir);
return (0);
#endif
} }
void void
@ -396,7 +395,7 @@ target_fopen(const char *filename, const char *type)
* NB: does not prefix mount-from, which probably breaks nullfs mounts. * NB: does not prefix mount-from, which probably breaks nullfs mounts.
*/ */
int int
target_mount(const char *opts, const char *from, int ptn, const char *on) target_mount_do(const char *opts, const char *from, const char *on)
{ {
struct unwind_mount *m; struct unwind_mount *m;
int error; int error;
@ -415,8 +414,8 @@ target_mount(const char *opts, const char *from, int ptn, const char *on)
backtowin(); backtowin();
#endif #endif
error = run_program(0, "/sbin/mount %s /dev/%s%c %s%s", error = run_program(0, "/sbin/mount %s %s %s%s",
opts, from, 'a' + ptn, target_prefix(), on); opts, from, target_prefix(), on);
if (error) { if (error) {
free(m); free(m);
return error; return error;
@ -426,6 +425,19 @@ target_mount(const char *opts, const char *from, int ptn, const char *on)
return 0; return 0;
} }
int
target_mount(const char *opts, const char *from, int ptn, const char *on)
{
int error;
char *frompath;
asprintf (&frompath, "/dev/%s%c", from, (ptn < 0)? 0 : 'a' + ptn);
if (frompath == 0)
return (ENOMEM);
error = target_mount_do(opts, frompath, on);
free(frompath);
return error;
}
/* /*
* unwind the mount stack, unmounting mounted filesystems. * unwind the mount stack, unmounting mounted filesystems.
* For now, ignore any errors in unmount. * For now, ignore any errors in unmount.

View File

@ -1,4 +1,4 @@
/* $NetBSD: upgrade.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: upgrade.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -54,6 +54,8 @@ static int merge_X(const char *);
void void
do_upgrade(void) do_upgrade(void)
{ {
int retcode = 0;
partman_go = 0;
msg_display(MSG_upgradeusure); msg_display(MSG_upgradeusure);
process_menu(MENU_noyes, NULL); process_menu(MENU_noyes, NULL);
@ -68,8 +70,6 @@ do_upgrade(void)
if (md_pre_update() < 0) if (md_pre_update() < 0)
return; return;
process_menu(MENU_distset, NULL);
if (mount_disks() != 0) if (mount_disks() != 0)
return; return;
@ -96,6 +96,9 @@ do_upgrade(void)
wrefresh(stdscr); wrefresh(stdscr);
/* Done with disks. Ready to get and unpack tarballs. */ /* Done with disks. Ready to get and unpack tarballs. */
process_menu(MENU_distset, &retcode);
if (retcode == 0)
return;
if (get_and_unpack_sets(1, MSG_disksetupdoneupdate, if (get_and_unpack_sets(1, MSG_disksetupdoneupdate,
MSG_upgrcomplete, MSG_abortupgr) != 0) MSG_upgrcomplete, MSG_abortupgr) != 0)
return; return;
@ -172,6 +175,7 @@ merge_X(const char *xroot)
void void
do_reinstall_sets(void) do_reinstall_sets(void)
{ {
int retcode = 0;
unwind_mounts(); unwind_mounts();
msg_display(MSG_reinstallusure); msg_display(MSG_reinstallusure);
@ -182,12 +186,13 @@ do_reinstall_sets(void)
if (find_disks(msg_string(MSG_reinstall)) < 0) if (find_disks(msg_string(MSG_reinstall)) < 0)
return; return;
process_menu(MENU_distset, NULL);
if (mount_disks() != 0) if (mount_disks() != 0)
return; return;
/* Unpack the distribution. */ /* Unpack the distribution. */
process_menu(MENU_distset, &retcode);
if (retcode == 0)
return;
if (get_and_unpack_sets(0, NULL, MSG_unpackcomplete, MSG_abortunpack) != 0) if (get_and_unpack_sets(0, NULL, MSG_unpackcomplete, MSG_abortunpack) != 0)
return; return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: util.c,v 1.1 2014/07/26 19:30:44 dholland Exp $ */ /* $NetBSD: util.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */
/* /*
* Copyright 1997 Piermont Information Systems Inc. * Copyright 1997 Piermont Information Systems Inc.
@ -363,8 +363,10 @@ floppy_fetch(const char *set_name)
int int
get_via_floppy(void) get_via_floppy(void)
{ {
yesno = -1;
process_menu(MENU_floppysource, NULL); process_menu(MENU_floppysource, NULL);
if (yesno == SET_RETRY)
return SET_RETRY;
fetch_fn = floppy_fetch; fetch_fn = floppy_fetch;
@ -492,14 +494,6 @@ cd_has_sets(void)
return dir_exists_p(ext_dir_bin); return dir_exists_p(ext_dir_bin);
} }
static int
set_cd_select(menudesc *m, void *arg)
{
*(int *)arg = m->cursel;
return 1;
}
/* /*
* Check whether we can remove the boot media. * Check whether we can remove the boot media.
* If it is not a local filesystem, return -1. * If it is not a local filesystem, return -1.
@ -564,7 +558,7 @@ get_via_cdrom(void)
cd_menu[i].opt_name = cds[i].menu; cd_menu[i].opt_name = cds[i].menu;
cd_menu[i].opt_menu = OPT_NOMENU; cd_menu[i].opt_menu = OPT_NOMENU;
cd_menu[i].opt_flags = OPT_EXIT; cd_menu[i].opt_flags = OPT_EXIT;
cd_menu[i].opt_action = set_cd_select; cd_menu[i].opt_action = set_menu_select;
} }
/* create a menu offering available choices */ /* create a menu offering available choices */
menu_cd = new_menu(MSG_Available_cds, menu_cd = new_menu(MSG_Available_cds,
@ -590,7 +584,10 @@ get_via_cdrom(void)
} }
/* ask for paths on the CD */ /* ask for paths on the CD */
yesno = -1;
process_menu(MENU_cdromsource, NULL); process_menu(MENU_cdromsource, NULL);
if (yesno == SET_RETRY)
return SET_RETRY;
if (cd_has_sets()) if (cd_has_sets())
return SET_OK; return SET_OK;
@ -606,9 +603,11 @@ get_via_cdrom(void)
int int
get_via_localfs(void) get_via_localfs(void)
{ {
/* Get device, filesystem, and filepath */ /* Get device, filesystem, and filepath */
yesno = -1;
process_menu (MENU_localfssource, NULL); process_menu (MENU_localfssource, NULL);
if (yesno == SET_RETRY)
return SET_RETRY;
/* Mount it */ /* Mount it */
if (run_program(0, "/sbin/mount -rt %s /dev/%s /mnt2", if (run_program(0, "/sbin/mount -rt %s /dev/%s /mnt2",
@ -632,9 +631,11 @@ get_via_localfs(void)
int int
get_via_localdir(void) get_via_localdir(void)
{ {
/* Get filepath */ /* Get filepath */
yesno = -1;
process_menu(MENU_localdirsource, NULL); process_menu(MENU_localdirsource, NULL);
if (yesno == SET_RETRY)
return SET_RETRY;
/* /*
* We have to have an absolute path ('cos pax runs in a * We have to have an absolute path ('cos pax runs in a
@ -1588,9 +1589,8 @@ check_lfs_progs(void)
{ {
#ifndef NO_LFS #ifndef NO_LFS
return (access("/sbin/fsck_lfs", X_OK) == 0 && return binary_available("fsck_lfs") && binary_available("mount_lfs")
access("/sbin/mount_lfs", X_OK) == 0 && && binary_available("newfs_lfs");
access("/sbin/newfs_lfs", X_OK) == 0);
#else #else
return 0; return 0;
#endif #endif
@ -1616,3 +1616,62 @@ ext_dir_for_set(const char *set_name) {
return set_is_source(set_name) ? ext_dir_src : ext_dir_bin; return set_is_source(set_name) ? ext_dir_src : ext_dir_bin;
} }
void
do_coloring(unsigned int fg, unsigned int bg) {
if (bg > COLOR_WHITE)
bg = COLOR_BLUE;
if (fg > COLOR_WHITE)
fg = COLOR_WHITE;
if (fg != bg && has_colors()) {
init_pair(1, fg, bg);
wbkgd(stdscr, COLOR_PAIR(1));
wbkgd(mainwin, COLOR_PAIR(1));
wattrset(stdscr, COLOR_PAIR(1));
wattrset(mainwin, COLOR_PAIR(1));
}
/* redraw screen */
touchwin(stdscr);
touchwin(mainwin);
wrefresh(stdscr);
wrefresh(mainwin);
return;
}
int
set_menu_select(menudesc *m, void *arg)
{
*(int *)arg = m->cursel;
return 1;
}
/*
* check wether a binary is available somewhere in PATH,
* return 1 if found, 0 if not.
*/
int
binary_available(const char *prog)
{
char *p, tmp[MAXPATHLEN], *path = getenv("PATH");
if (path == NULL)
return access(prog, X_OK) == 0;
path = strdup(path);
if (path == NULL)
return 0;
while ((p = strsep(&path, ":")) != NULL) {
if (strlcpy(tmp, p, MAXPATHLEN) >= MAXPATHLEN)
continue;
if (strlcat(tmp, "/", MAXPATHLEN) >= MAXPATHLEN)
continue;
if (strlcat(tmp, prog, MAXPATHLEN) >= MAXPATHLEN)
continue;
if (access(tmp, X_OK) == 0) {
free(path);
return 1;
}
}
free(path);
return 0;
}