From 9fc0a7f72271968cc91c2e6d2cdfb8561a042e67 Mon Sep 17 00:00:00 2001 From: dsl Date: Thu, 12 Jan 2006 22:02:44 +0000 Subject: [PATCH] Rework the installation loop so that it is possible to change the source of the sets after an error. A side effect is that it now does fetch-install-fetch-install..., not fetch-...-fetch-install-...install. The set selection code now uses a byte per set (not a bit-pattern) removing the restriction of 32 sets, and allowing a per set status display (TBC). Also TBC is deleting sets from /usr/INSTALL. However I believe it works... --- distrib/utils/sysinst/Makefile.inc | 4 +- distrib/utils/sysinst/arch/evbarm/md.h | 4 +- distrib/utils/sysinst/arch/hp300/md.h | 4 +- distrib/utils/sysinst/arch/hp700/md.h | 4 +- distrib/utils/sysinst/arch/i386/md.c | 15 +- distrib/utils/sysinst/arch/i386/menus.md | 20 +- distrib/utils/sysinst/arch/mac68k/md.c | 6 +- distrib/utils/sysinst/arch/mipsco/md.h | 4 +- distrib/utils/sysinst/arch/mvme68k/md.h | 4 +- distrib/utils/sysinst/arch/news68k/md.h | 5 +- distrib/utils/sysinst/arch/newsmips/md.h | 5 +- distrib/utils/sysinst/arch/playstation2/md.h | 4 +- distrib/utils/sysinst/arch/prep/md.h | 5 +- distrib/utils/sysinst/arch/sgimips/md.c | 8 +- distrib/utils/sysinst/arch/sgimips/md.h | 4 +- distrib/utils/sysinst/bsddisklabel.c | 4 +- distrib/utils/sysinst/defs.h | 122 +-- distrib/utils/sysinst/disks.c | 15 +- distrib/utils/sysinst/main.c | 183 ++--- distrib/utils/sysinst/menus.mi | 81 +- distrib/utils/sysinst/msg.mi.de | 58 +- distrib/utils/sysinst/msg.mi.en | 53 +- distrib/utils/sysinst/msg.mi.es | 56 +- distrib/utils/sysinst/msg.mi.fr | 41 +- distrib/utils/sysinst/msg.mi.pl | 56 +- distrib/utils/sysinst/net.c | 247 +++--- distrib/utils/sysinst/run.c | 11 +- distrib/utils/sysinst/target.c | 9 +- distrib/utils/sysinst/txtwalk.c | 16 +- distrib/utils/sysinst/txtwalk.h | 4 +- distrib/utils/sysinst/util.c | 803 ++++++++++--------- 31 files changed, 888 insertions(+), 967 deletions(-) diff --git a/distrib/utils/sysinst/Makefile.inc b/distrib/utils/sysinst/Makefile.inc index 410d75a88bfe..c91929705751 100644 --- a/distrib/utils/sysinst/Makefile.inc +++ b/distrib/utils/sysinst/Makefile.inc @@ -1,7 +1,9 @@ -# $NetBSD: Makefile.inc,v 1.41 2005/09/10 21:38:40 dsl Exp $ +# $NetBSD: Makefile.inc,v 1.42 2006/01/12 22:02:44 dsl Exp $ # # Makefile for sysinst +COPTS += -Os + PROG= sysinst NOMAN= # defined diff --git a/distrib/utils/sysinst/arch/evbarm/md.h b/distrib/utils/sysinst/arch/evbarm/md.h index ffa623c900b3..9e1de5b05d6f 100644 --- a/distrib/utils/sysinst/arch/evbarm/md.h +++ b/distrib/utils/sysinst/arch/evbarm/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.13 2004/12/28 17:56:40 joff Exp $ */ +/* $NetBSD: md.h,v 1.14 2006/01/12 22:02:44 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -56,7 +56,7 @@ #define SET_KERNEL_5_NAME "kern-TEAMASA_NPWR" #define SET_KERNEL_6_NAME "kern-TS7200" -#define MD_SETS_SELECTED (SET_SYSTEM) +#define MD_SETS_SELECTED SET_SYSTEM /* * Machine-specific command to write a new label to a disk. diff --git a/distrib/utils/sysinst/arch/hp300/md.h b/distrib/utils/sysinst/arch/hp300/md.h index 1f623a3cf1db..199d318fefff 100644 --- a/distrib/utils/sysinst/arch/hp300/md.h +++ b/distrib/utils/sysinst/arch/hp300/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.11 2004/06/06 06:07:00 christos Exp $ */ +/* $NetBSD: md.h,v 1.12 2006/01/12 22:02:44 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -71,7 +71,7 @@ */ #define SET_KERNEL_1_NAME "kern-GENERIC" -#define MD_SETS_VALID (SET_KERNEL | SET_SYSTEM | (SET_X11 & ~SET_X11_SERVERS)) +#define MD_SETS_VALID SET_KERNEL, SET_SYSTEM, SET_X11_NOSERVERS /* * Disk names accepted as valid targets for a from-scratch installation. diff --git a/distrib/utils/sysinst/arch/hp700/md.h b/distrib/utils/sysinst/arch/hp700/md.h index 138df7f9a13e..96bd06275045 100644 --- a/distrib/utils/sysinst/arch/hp700/md.h +++ b/distrib/utils/sysinst/arch/hp700/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.1 2005/05/14 14:54:00 chs Exp $ */ +/* $NetBSD: md.h,v 1.2 2006/01/12 22:02:44 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -62,7 +62,7 @@ */ #define SET_KERNEL_1_NAME "kern-GENERIC" -#define MD_SETS_VALID (SET_KERNEL | SET_SYSTEM | (SET_X11 & ~SET_X11_SERVERS)) +#define MD_SETS_VALID SET_KERNEL, SET_SYSTEM, SET_X11_NOSERVERS /* * Machine-specific command to write a new label to a disk. diff --git a/distrib/utils/sysinst/arch/i386/md.c b/distrib/utils/sysinst/arch/i386/md.c index fabbbf29d8a0..e8d21ef5c62e 100644 --- a/distrib/utils/sysinst/arch/i386/md.c +++ b/distrib/utils/sysinst/arch/i386/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.108 2005/09/13 23:43:22 jdarrow Exp $ */ +/* $NetBSD: md.c,v 1.109 2006/01/12 22:02:45 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -320,12 +320,9 @@ md_post_newfs(void) && (condev & ~3) == 0x800) { /* Motherboard serial port */ boottype.bp_consdev = (condev & 3) + 1; - td = open("/dev/console", O_RDONLY, 0); - if (td != -1) { - if (tcgetattr(td, &t) != -1) - boottype.bp_conspeed = t.c_ispeed; - close(td); - } + /* Defaulting the baud rate to that of stdin should suffice */ + if (tcgetattr(0, &t) != -1) + boottype.bp_conspeed = t.c_ispeed; } process_menu(MENU_getboottype, &boottype); @@ -476,7 +473,7 @@ md_cleanup_install(void) * For GENERIC_TINY, do not enable any extra screens or wsmux. * Otherwise, run getty on 4 VTs. */ - if (sets_selected & SET_KERNEL_TINY) + if (get_kernel_set() == SET_KERNEL_TINY) run_program(0, "sed -an -e '/^screen/s/^/#/;/^mux/s/^/#/;" "H;$!d;g;w %s/etc/wscons.conf' %s/etc/wscons.conf", tp, tp); @@ -607,7 +604,7 @@ md_init(void) { /* Default to install same type of kernel as we are running */ - sets_selected = (sets_selected & ~SET_KERNEL) | get_bootmodel(); + set_kernel_set(get_bootmodel()); } static char * diff --git a/distrib/utils/sysinst/arch/i386/menus.md b/distrib/utils/sysinst/arch/i386/menus.md index 8d987265f6da..b5799280bc85 100644 --- a/distrib/utils/sysinst/arch/i386/menus.md +++ b/distrib/utils/sysinst/arch/i386/menus.md @@ -1,4 +1,4 @@ -/* $NetBSD: menus.md,v 1.10 2003/11/30 14:36:45 dsl Exp $ */ +/* $NetBSD: menus.md,v 1.11 2006/01/12 22:02:45 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -41,18 +41,20 @@ menu getboottype, title MSG_Bootblocks_selection, y=10, exit, no clear; display action { msg_display(MSG_getboottype); switch (((struct x86_boot_params *)arg)->bp_consdev) { - case ~0: - msg_display_add(MSG_console_unchanged); - break; + default: case 0: msg_display_add(MSG_console_PC); break; - default: + case 1: case 2: case 3: case 4: + menu->cursel = ((struct x86_boot_params *)arg)->bp_consdev; msg_display_add(MSG_console_com, - ((struct x86_boot_params *)arg)->bp_consdev - 1, - ((struct x86_boot_params *)arg)->bp_conspeed); - } - }; + ((struct x86_boot_params *)arg)->bp_consdev - 1, + ((struct x86_boot_params *)arg)->bp_conspeed); + break; + case ~0: + msg_display_add(MSG_console_unchanged); + break; + }}; option MSG_Use_normal_bootblocks, action {((struct x86_boot_params *)arg)->bp_consdev = 0; m->cursel = 7;}; option MSG_Use_serial_com0, action diff --git a/distrib/utils/sysinst/arch/mac68k/md.c b/distrib/utils/sysinst/arch/mac68k/md.c index d72ac92ca490..e969380b3f1d 100644 --- a/distrib/utils/sysinst/arch/mac68k/md.c +++ b/distrib/utils/sysinst/arch/mac68k/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.44 2004/11/14 13:34:53 he Exp $ */ +/* $NetBSD: md.c,v 1.45 2006/01/12 22:02:45 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -1150,10 +1150,10 @@ md_init() /* * Running the SBC Installation Kernel, so enable GENERICSBC */ - sets_selected = (sets_selected & ~SET_KERNEL) | SET_KERNEL_2; + set_kernel_set(SET_KERNEL_2); else /* * Running the GENERIC Installation Kernel, so enable GENERIC */ - sets_selected = (sets_selected & ~SET_KERNEL) | SET_KERNEL_1; + set_kernel_set(SET_KERNEL_1); } diff --git a/distrib/utils/sysinst/arch/mipsco/md.h b/distrib/utils/sysinst/arch/mipsco/md.h index 7e3a37bd2db6..89a55f68a3c2 100644 --- a/distrib/utils/sysinst/arch/mipsco/md.h +++ b/distrib/utils/sysinst/arch/mipsco/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.10 2004/06/06 06:07:01 christos Exp $ */ +/* $NetBSD: md.h,v 1.11 2006/01/12 22:02:45 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -64,7 +64,7 @@ * or upgrade. */ #define SET_KERNEL_1_NAME "kern-GENERIC" -#define MD_SETS_VALID (SET_KERNEL | SET_SYSTEM | (SET_X11 & ~SET_X11_SERVERS)) +#define MD_SETS_VALID SET_KERNEL, SET_SYSTEM, SET_X11_NOSERVERS /* * Machine-specific command to write a new label to a disk. diff --git a/distrib/utils/sysinst/arch/mvme68k/md.h b/distrib/utils/sysinst/arch/mvme68k/md.h index 22942cab65aa..61a299941f07 100644 --- a/distrib/utils/sysinst/arch/mvme68k/md.h +++ b/distrib/utils/sysinst/arch/mvme68k/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.11 2004/06/06 06:07:01 christos Exp $ */ +/* $NetBSD: md.h,v 1.12 2006/01/12 22:02:45 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -70,7 +70,7 @@ * base etc comp games man misc text xbase xcomp xetc xfont xserver */ #define SET_KERNEL_1_NAME "kern-GENERIC" -#define MD_SETS_VALID (SET_KERNEL | SET_SYSTEM | (SET_X11 & ~SET_X11_SERVERS)) +#define MD_SETS_VALID SET_KERNEL, SET_SYSTEM, SET_X11_NOSERVERS /* * Machine-specific command to write a new label to a disk. diff --git a/distrib/utils/sysinst/arch/news68k/md.h b/distrib/utils/sysinst/arch/news68k/md.h index 2c650f114fe9..914e2dc5fc1f 100644 --- a/distrib/utils/sysinst/arch/news68k/md.h +++ b/distrib/utils/sysinst/arch/news68k/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.20 2004/06/06 06:07:01 christos Exp $ */ +/* $NetBSD: md.h,v 1.21 2006/01/12 22:02:45 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -63,8 +63,7 @@ #define SET_KERNEL_1_NAME "kern-GENERIC" #define SET_KERNEL_2_NAME "kern-GENERIC_TINY" -#define MD_SETS_SELECTED (SET_KERNEL_1 | SET_SYSTEM | \ - (SET_X11 & ~SET_X11_SERVERS)) +#define MD_SETS_SELECTED SET_KERNEL_1, SET_SYSTEM, SET_X11_NOSERVERS /* * Machine-specific command to write a new label to a disk. diff --git a/distrib/utils/sysinst/arch/newsmips/md.h b/distrib/utils/sysinst/arch/newsmips/md.h index f4fbebe66a35..345ddc3f0e6a 100644 --- a/distrib/utils/sysinst/arch/newsmips/md.h +++ b/distrib/utils/sysinst/arch/newsmips/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.10 2004/06/06 06:07:01 christos Exp $ */ +/* $NetBSD: md.h,v 1.11 2006/01/12 22:02:45 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -61,8 +61,7 @@ * or upgrade. */ #define SET_KERNEL_1_NAME "kern-GENERIC" -#define MD_SETS_SELECTED (SET_KERNEL_1 | SET_SYSTEM | \ - (SET_X11 & ~SET_X11_SERVERS)) +#define MD_SETS_SELECTED SET_KERNEL_1, SET_SYSTEM, SET_X11_NOSERVERS /* * Machine-specific command to write a new label to a disk. diff --git a/distrib/utils/sysinst/arch/playstation2/md.h b/distrib/utils/sysinst/arch/playstation2/md.h index 9384bf9cdeaa..763b1ba00712 100644 --- a/distrib/utils/sysinst/arch/playstation2/md.h +++ b/distrib/utils/sysinst/arch/playstation2/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.12 2004/06/06 06:07:01 christos Exp $ */ +/* $NetBSD: md.h,v 1.13 2006/01/12 22:02:45 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -65,7 +65,7 @@ * base, etc, comp, games, man, misc, text */ #define SET_KERNEL_1_NAME "kern-GENERIC" -#define MD_SETS_VALID (SET_KERNEL | SET_SYSTEM) +#define MD_SETS_VALID SET_KERNEL, SET_SYSTEM /* * Machine-specific command to write a new label to a disk. diff --git a/distrib/utils/sysinst/arch/prep/md.h b/distrib/utils/sysinst/arch/prep/md.h index 8c74c7849754..5844b32677d5 100644 --- a/distrib/utils/sysinst/arch/prep/md.h +++ b/distrib/utils/sysinst/arch/prep/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.12 2004/06/06 06:07:01 christos Exp $ */ +/* $NetBSD: md.h,v 1.13 2006/01/12 22:02:45 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -74,8 +74,7 @@ * from floppy. */ #define SET_KERNEL_1_NAME "kern-GENERIC" -#define MD_SETS_SELECTED (SET_KERNEL_1 | SET_SYSTEM | \ - (SET_X11 & ~SET_X11_SERVERS)) +#define MD_SETS_SELECTED SET_KERNEL_1, SET_SYSTEM, SET_X11_NOSERVERS /* * Machine-specific command to write a new label to a disk. diff --git a/distrib/utils/sysinst/arch/sgimips/md.c b/distrib/utils/sysinst/arch/sgimips/md.c index 0e6811fce753..f2703f23fbb1 100644 --- a/distrib/utils/sysinst/arch/sgimips/md.c +++ b/distrib/utils/sysinst/arch/sgimips/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.18 2004/11/14 18:36:11 dsl Exp $ */ +/* $NetBSD: md.c,v 1.19 2006/01/12 22:02:45 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -203,9 +203,9 @@ md_init() */ uname(&instsys); if (strstr(instsys.version, "(INSTALL32_IP3x)")) - sets_selected = (sets_selected & ~SET_KERNEL) | SET_KERNEL_2; + set_kernel_set(SET_KERNEL_2); else if (strstr(instsys.version, "(INSTALL32_IP2x)")) - sets_selected = (sets_selected & ~SET_KERNEL) | SET_KERNEL_1; + set_kernel_set(SET_KERNEL_1); else if (strstr(instsys.version, "(GENERIC32_IP12)")) - sets_selected = (sets_selected & ~SET_KERNEL) | SET_KERNEL_3; + set_kernel_set(SET_KERNEL_3); } diff --git a/distrib/utils/sysinst/arch/sgimips/md.h b/distrib/utils/sysinst/arch/sgimips/md.h index 9f0accd7ef3c..00a9741f3a5d 100644 --- a/distrib/utils/sysinst/arch/sgimips/md.h +++ b/distrib/utils/sysinst/arch/sgimips/md.h @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.20 2004/11/13 11:49:08 sekiya Exp $ */ +/* $NetBSD: md.h,v 1.21 2006/01/12 22:02:45 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -78,7 +78,7 @@ #define SET_KERNEL_1_NAME "kern-GENERIC32_IP2x" #define SET_KERNEL_2_NAME "kern-GENERIC32_IP3x" #define SET_KERNEL_3_NAME "kern-GENERIC32_IP12" -#define MD_SETS_SELECTED (SET_KERNEL_1 | SET_SYSTEM) +#define MD_SETS_SELECTED SET_KERNEL_1, SET_SYSTEM /* * Default fileystem type for floppy disks. diff --git a/distrib/utils/sysinst/bsddisklabel.c b/distrib/utils/sysinst/bsddisklabel.c index 9b77545634b1..de4646264645 100644 --- a/distrib/utils/sysinst/bsddisklabel.c +++ b/distrib/utils/sysinst/bsddisklabel.c @@ -1,4 +1,4 @@ -/* $NetBSD: bsddisklabel.c,v 1.38 2006/01/09 15:25:20 tsutsui Exp $ */ +/* $NetBSD: bsddisklabel.c,v 1.39 2006/01/12 22:02:44 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -389,7 +389,7 @@ get_ptn_sizes(int part_start, int sectors, int no_swap) /* If there is a swap partition elsewhere, don't add one here.*/ if (no_swap) pi.ptn_sizes[PI_SWAP].size = 0; /* If installing X increase default size of /usr */ - if (sets_selected & SET_X11) + if (set_X11_selected()) pi.ptn_sizes[PI_USR].dflt_size += XNEEDMB; /* Start of planning to give free space to / */ diff --git a/distrib/utils/sysinst/defs.h b/distrib/utils/sysinst/defs.h index 6f3027895cc4..0d582a59e783 100644 --- a/distrib/utils/sysinst/defs.h +++ b/distrib/utils/sysinst/defs.h @@ -1,4 +1,4 @@ -/* $NetBSD: defs.h,v 1.123 2005/02/26 17:40:49 dsl Exp $ */ +/* $NetBSD: defs.h,v 1.124 2006/01/12 22:02:44 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -67,6 +67,14 @@ deconst(const void *p) #define T_FILE 0 #define T_OUTPUT 1 +/* Some install status/response values */ +#define SET_OK 0 /* Set extracted */ +#define SET_RETRY 1 /* Retry */ +#define SET_SKIP 2 /* Skip this set */ +#define SET_SKIP_GROUP 3 /* Skip this set and rest of group */ +#define SET_ABANDON 4 /* Abandon installation */ +#define SET_CONTINUE 5 /* Continue (copy from floppy loop) */ + /* run_prog flags */ #define RUN_DISPLAY 0x0001 /* Display program output */ #define RUN_FATAL 0x0002 /* errors are fatal */ @@ -76,39 +84,64 @@ deconst(const void *p) #define RUN_ERROR_OK 0x0040 /* Don't wait for error confirmation */ #define RUN_PROGRESS 0x0080 /* Output is just progess test */ #define RUN_NO_CLEAR 0x0100 /* Leave program output after error */ +#define RUN_XFER_DIR 0x0200 /* cd to xfer_dir in child */ /* Installation sets */ -#define SET_KERNEL 0x000000ffu /* allow 8 kernels */ -#define SET_KERNEL_1 0x00000001u /* Usually GENERIC */ -#define SET_KERNEL_2 0x00000002u /* MD kernel... */ -#define SET_KERNEL_3 0x00000004u /* MD kernel... */ -#define SET_KERNEL_4 0x00000008u /* MD kernel... */ -#define SET_KERNEL_5 0x00000010u /* MD kernel... */ -#define SET_KERNEL_6 0x00000020u /* MD kernel... */ -#define SET_KERNEL_7 0x00000040u /* MD kernel... */ -#define SET_KERNEL_8 0x00000080u /* MD kernel... */ +enum { + SET_NONE, + SET_KERNEL_FIRST, + SET_KERNEL_1, /* Usually GENERIC */ + SET_KERNEL_2, /* MD kernel... */ + SET_KERNEL_3, /* MD kernel... */ + SET_KERNEL_4, /* MD kernel... */ + SET_KERNEL_5, /* MD kernel... */ + SET_KERNEL_6, /* MD kernel... */ + SET_KERNEL_7, /* MD kernel... */ + SET_KERNEL_8, /* MD kernel... */ + SET_KERNEL_LAST, /* allow 8 kernels */ -#define SET_SYSTEM 0x000fff00u /* all system sets */ -#define SET_BASE 0x00000100u /* base */ -#define SET_ETC 0x00000200u /* /etc */ -#define SET_COMPILER 0x00000400u /* compiler tools */ -#define SET_GAMES 0x00000800u /* text games */ -#define SET_MAN_PAGES 0x00001000u /* online manual pages */ -#define SET_MISC 0x00002000u /* miscellaneuous */ -#define SET_TEXT_TOOLS 0x00004000u /* text processing tools */ + /* System sets */ + SET_BASE, /* base */ + SET_ETC, /* /etc */ + SET_COMPILER, /* compiler tools */ + SET_GAMES, /* text games */ + SET_MAN_PAGES, /* online manual pages */ + SET_MISC, /* miscellaneuous */ + SET_TEXT_TOOLS, /* text processing tools */ -#define SET_X11 0x0ff00000u /* All X11 sets */ -#define SET_X11_BASE 0x00100000u /* X11 base and clients */ -#define SET_X11_FONTS 0x00200000u /* X11 fonts */ -#define SET_X11_SERVERS 0x00400000u /* X11 servers */ -#define SET_X11_PROG 0x00800000u /* X11 programming */ -#define SET_X11_ETC 0x01000000u /* X11 config */ + /* X11 sets */ + SET_X11_FIRST, + SET_X11_BASE, /* X11 base and clients */ + SET_X11_FONTS, /* X11 fonts */ + SET_X11_SERVERS, /* X11 servers */ + SET_X11_PROG, /* X11 programming */ + SET_X11_ETC, /* X11 config */ + SET_X11_LAST, -#define SET_MD 0xf0000000u /* All machine dependant sets */ -#define SET_MD_1 0x10000000u /* Machine dependant set */ -#define SET_MD_2 0x20000000u /* Machine dependant set */ -#define SET_MD_3 0x40000000u /* Machine dependant set */ -#define SET_MD_4 0x80000000u /* Machine dependant set */ + /* Machine dependant sets */ + SET_MD_1, /* Machine dependant set */ + SET_MD_2, /* Machine dependant set */ + SET_MD_3, /* Machine dependant set */ + SET_MD_4, /* Machine dependant set */ + + SET_LAST, + SET_GROUP, /* Start of submenu */ + SET_GROUP_END, /* End of submenu */ +}; + +/* Initialisers to select sets */ +/* All kernels */ +#define SET_KERNEL SET_KERNEL_1, SET_KERNEL_2, SET_KERNEL_3, SET_KERNEL_4, \ + SET_KERNEL_5, SET_KERNEL_6, SET_KERNEL_7, SET_KERNEL_8 +/* All system sets */ +#define SET_SYSTEM SET_BASE, SET_ETC, SET_COMPILER, SET_GAMES, \ + SET_MAN_PAGES, SET_MISC, SET_TEXT_TOOLS +/* All X11 sets */ +#define SET_X11_NOSERVERS SET_X11_BASE, SET_X11_FONTS, SET_X11_PROG, SET_X11_ETC +#define SET_X11 SET_X11_NOSERVERS, SET_X11_SERVERS + +/* All machine dependant sets */ +#define SET_MD SET_MD_1, SET_MD_2, SET_MD_3, SET_MD_4 /* Macros */ #define nelem(x) (sizeof (x) / sizeof *(x)) @@ -209,8 +242,8 @@ char bsddiskname[DISKNAME_SIZE]; const char *doessf; /* Relative file name for storing a distribution. */ -char dist_dir[STRSIZE]; -int clean_dist_dir; +char xfer_dir[STRSIZE]; +int clean_xfer_dir; /* Absolute path name where the distribution should be extracted from. */ #if !defined(SYSINST_FTP_HOST) @@ -227,12 +260,16 @@ char ext_dir[STRSIZE]; /* Place we look in all fs types */ char set_dir[STRSIZE]; -char ftp_host[STRSIZE]; -char ftp_dir[STRSIZE] ; -char ftp_user[SSTRSIZE]; -char ftp_pass[STRSIZE]; -char ftp_proxy[STRSIZE]; +struct { + char host[STRSIZE]; + char dir[STRSIZE] ; + char user[SSTRSIZE]; + char pass[STRSIZE]; + char proxy[STRSIZE]; + const char *xfer_type; /* "ftp" or "http" */ +} ftp; +int (*fetch_fn)(const char *); char nfs_host[STRSIZE]; char nfs_dir[STRSIZE]; @@ -243,18 +280,11 @@ char localfs_fs[SSTRSIZE]; char localfs_dir[STRSIZE]; char targetroot_mnt[SSTRSIZE]; -char distfs_mnt[SSTRSIZE]; int mnt2_mounted; char dist_postfix[SSTRSIZE]; -/* selescted sets */ -extern distinfo dist_list[]; -extern unsigned int sets_valid; -extern unsigned int sets_selected; -extern unsigned int sets_installed; - /* needed prototypes */ void set_menu_numopts(int, int); @@ -337,7 +367,6 @@ void restore_etc(void); int dir_exists_p(const char *); int file_exists_p(const char *); int file_mode_match(const char *, unsigned int); -int distribution_sets_exist_p(const char *); uint get_ramsize(void); void ask_sizemult(int); void run_makedev(void); @@ -345,9 +374,12 @@ int get_via_floppy(void); int get_via_cdrom(void); int get_via_localfs(void); int get_via_localdir(void); -void cd_dist_dir(const char *); +void get_xfer_dir(const char *); void show_cur_distsets(void); void make_ramdisk_dir(const char *); +void set_kernel_set(unsigned int); +unsigned int get_kernel_set(void); +unsigned int set_X11_selected(void); int get_and_unpack_sets(int, msg, msg, msg); int sanity_check(void); int set_timezone(void); diff --git a/distrib/utils/sysinst/disks.c b/distrib/utils/sysinst/disks.c index ec3b38c29ab6..cd70dcc69eed 100644 --- a/distrib/utils/sysinst/disks.c +++ b/distrib/utils/sysinst/disks.c @@ -1,4 +1,4 @@ -/* $NetBSD: disks.c,v 1.91 2006/01/09 10:00:34 tsutsui Exp $ */ +/* $NetBSD: disks.c,v 1.92 2006/01/12 22:02:44 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -79,7 +79,6 @@ static int foundffs(struct data *, size_t); #ifdef USE_SYSVBFS static int foundsysvbfs(struct data *, size_t); #endif -static int mount_root(void); static int fsck_preen(const char *, int, const char *); static void fixsb(const char *, const char *, char); @@ -106,7 +105,7 @@ get_disks(struct disk_desc *dd) strlcpy(dd->dd_name, *xd, sizeof dd->dd_name - 2); cp = strchr(dd->dd_name, ':'); if (cp != NULL) - dd->dd_no_mbr = ~strcmp(cp, ":no_mbr"); + dd->dd_no_mbr = !strcmp(cp, ":no_mbr"); else { dd->dd_no_mbr = 0; cp = strchr(dd->dd_name, 0); @@ -191,6 +190,9 @@ find_disks(const char *doingwhat) disk = disks + selected_disk; strlcpy(diskdev, disk->dd_name, sizeof diskdev); + /* Use as a default disk if the user has the sets on a local disk */ + strlcpy(localfs_dev, disk->dd_name, sizeof localfs_dev); + sectorsize = disk->dd_secsize; dlcyl = disk->dd_cyl; dlhead = disk->dd_head; @@ -636,7 +638,7 @@ fixsb(const char *prog, const char *disk, char ptn) /* * fsck and mount the root partition. */ -int +static int mount_root(void) { int error; @@ -677,7 +679,10 @@ mount_disks(void) static size_t numfstabbuf = sizeof(fstabbuf) / sizeof(struct lookfor); /* First the root device. */ - if (!target_already_root()) { + if (target_already_root()) + /* avoid needing to call target_already_root() again */ + targetroot_mnt[0] = 0; + else { error = mount_root(); if (error != 0 && error != EBUSY) return 0; diff --git a/distrib/utils/sysinst/main.c b/distrib/utils/sysinst/main.c index cef49022a5fa..cd54a992045b 100644 --- a/distrib/utils/sysinst/main.c +++ b/distrib/utils/sysinst/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.48 2004/11/11 20:17:48 dsl Exp $ */ +/* $NetBSD: main.c,v 1.49 2006/01/12 22:02:44 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -55,7 +55,6 @@ #include "txtwalk.h" int main(int, char **); -static void init(void); static void select_language(void); static void usage(void); static void miscsighandler(int); @@ -73,36 +72,53 @@ FILE *script; /* script file */ extern int log_flip(void); #endif +/* String defaults and stuff for processing the -f file argument. */ + +struct f_arg { + const char *name; + const char *dflt; + char *var; + int size; +}; + +static const struct f_arg fflagopts[] = { + {"release", REL, rel, sizeof rel}, + {"machine", MACH, machine, sizeof machine}, + {"xfer dir", "/usr/INSTALL", xfer_dir, sizeof xfer_dir}, + {"ext dir", "", ext_dir, sizeof ext_dir}, + {"ftp host", SYSINST_FTP_HOST, ftp.host, sizeof ftp.host}, + {"ftp dir", SYSINST_FTP_DIR, ftp.dir, sizeof ftp.dir}, + {"ftp prefix", "/" MACH "/binary/sets", set_dir, sizeof set_dir}, + {"ftp user", "ftp", ftp.user, sizeof ftp.user}, + {"ftp pass", "", ftp.pass, sizeof ftp.pass}, + {"ftp proxy", "", ftp.proxy, sizeof ftp.proxy}, + {"nfs host", "", nfs_host, sizeof nfs_host}, + {"nfs dir", "/bsd/release", nfs_dir, sizeof nfs_dir}, + {"cd dev", "cd0a", cdrom_dev, sizeof cdrom_dev}, + {"local dev", "", localfs_dev, sizeof localfs_dev}, + {"local fs", "ffs", localfs_fs, sizeof localfs_fs}, + {"local dir", "release", localfs_dir, sizeof localfs_dir}, + {"targetroot mount", "/targetroot", targetroot_mnt, sizeof targetroot_mnt}, + {"dist postfix", ".tgz", dist_postfix, sizeof dist_postfix}, + {"diskname", "mydisk", bsddiskname, sizeof bsddiskname}, + + {NULL} +}; + static void init(void) { - (void)strlcpy(rel, REL, SSTRSIZE); - (void)strlcpy(machine, MACH, SSTRSIZE); + const struct f_arg *arg; + sizemult = 1; - (void)strlcpy(diskdev, "", SSTRSIZE); disktype = "unknown"; tmp_mfs_size = 0; - (void)strlcpy(bsddiskname, "mydisk", DISKNAME_SIZE); doessf = ""; - (void)strlcpy(dist_dir, "/usr/INSTALL", STRSIZE); - clean_dist_dir = 0; - (void)strlcpy(ext_dir, "", STRSIZE); - (void)strlcpy(set_dir, "/" MACH "/binary/sets", STRSIZE); - (void)strlcpy(ftp_host, SYSINST_FTP_HOST, STRSIZE); - (void)strlcpy(ftp_dir, SYSINST_FTP_DIR, STRSIZE); - (void)strlcpy(ftp_user, "ftp", SSTRSIZE); - (void)strlcpy(ftp_pass, "", STRSIZE); - (void)strlcpy(ftp_proxy, "", STRSIZE); - (void)strlcpy(nfs_host, "", STRSIZE); - (void)strlcpy(nfs_dir, "/bsd/release", STRSIZE); - (void)strlcpy(cdrom_dev, "cd0a", SSTRSIZE); - (void)strlcpy(localfs_dev, "sd0a", SSTRSIZE); - (void)strlcpy(localfs_fs, "ffs", SSTRSIZE); - (void)strlcpy(localfs_dir, "release", STRSIZE); - (void)strlcpy(targetroot_mnt, "/targetroot", SSTRSIZE); - (void)strlcpy(distfs_mnt, "/mnt2", SSTRSIZE); + clean_xfer_dir = 0; mnt2_mounted = 0; - (void)strlcpy(dist_postfix, ".tgz", SSTRSIZE); + + for (arg = fflagopts; arg->name != NULL; arg++) + strlcpy(arg->var, arg->dflt, arg->size); } int @@ -133,7 +149,7 @@ main(int argc, char **argv) break; case 'r': /* Release name other than compiled in release. */ - strncpy(rel, optarg, SSTRSIZE); + strncpy(rel, optarg, sizeof rel); break; case 'f': /* Definition file to read. */ @@ -153,8 +169,8 @@ main(int argc, char **argv) } /* - * XXX the following is bogus. if screen is too small, message - * XXX window will be overwritten by menus. + * Put 'messages' in a window that has a one-character border + * on the real screen. */ win = newwin(getmaxy(stdscr) - 2, getmaxx(stdscr) - 2, 1, 1); if (win == NULL) { @@ -396,104 +412,43 @@ cleanup(void) } -/* Stuff for processing the -f file argument. */ - -/* Data definitions ... */ - -static char *rel_ptr = rel; -static char *machine_ptr = machine; -static char *dist_dir_ptr = dist_dir; -static char *ext_dir_ptr = ext_dir; -static char *ftp_host_ptr = ftp_host; -static char *ftp_dir_ptr = ftp_dir; -static char *set_dir_ptr = set_dir; -static char *ftp_user_ptr = ftp_user; -static char *ftp_pass_ptr = ftp_pass; -static char *ftp_proxy_ptr = ftp_proxy; -static char *nfs_host_ptr = nfs_host; -static char *nfs_dir_ptr = nfs_dir; -static char *cdrom_dev_ptr = cdrom_dev; -static char *localfs_dev_ptr = localfs_dev; -static char *localfs_fs_ptr = localfs_fs; -static char *localfs_dir_ptr = localfs_dir; -static char *targetroot_mnt_ptr = targetroot_mnt; -static char *distfs_mnt_ptr = distfs_mnt; -static char *dist_postfix_ptr = dist_postfix; - -struct lookfor fflagopts[] = { - {"release", "release = %s", "a $0", &rel_ptr, 1, SSTRSIZE, NULL}, - {"machine", "machine = %s", "a $0", &machine_ptr, 1, SSTRSIZE, NULL}, - {"dist dir", "dist dir = %s", "a $0", &dist_dir_ptr, 1, STRSIZE, NULL}, - {"ext dir", "ext dir = %s", "a $0", &ext_dir_ptr, 1, STRSIZE, NULL}, - {"ftp host", "ftp host = %s", "a $0", &ftp_host_ptr, 1, STRSIZE, NULL}, - {"ftp dir", "ftp dir = %s", "a $0", &ftp_dir_ptr, 1, STRSIZE, NULL}, - {"ftp prefix", "set dir = %s", "a $0", &set_dir_ptr, 1, STRSIZE, NULL}, - {"ftp user", "ftp user = %s", "a $0", &ftp_user_ptr, 1, STRSIZE, NULL}, - {"ftp pass", "ftp pass = %s", "a $0", &ftp_pass_ptr, 1, STRSIZE, NULL}, - {"ftp proxy", "ftp proxy = %s", "a $0", &ftp_proxy_ptr, 1, STRSIZE, - NULL}, - {"nfs host", "nfs host = %s", "a $0", &nfs_host_ptr, 1, STRSIZE, NULL}, - {"nfs dir", "ftp dir = %s", "a $0", &nfs_dir_ptr, 1, STRSIZE, NULL}, - {"cd dev", "cd dev = %s", "a $0", &cdrom_dev_ptr, 1, STRSIZE, NULL}, - {"local dev", "local dev = %s", "a $0", &localfs_dev_ptr, 1, STRSIZE, - NULL}, - {"local fs", "local fs = %s", "a $0", &localfs_fs_ptr, 1, STRSIZE, - NULL}, - {"local dir", "local dir = %s", "a $0", &localfs_dir_ptr, 1, STRSIZE, - NULL}, - {"targetroot mount", "targetroot mount = %s", "a $0", - &targetroot_mnt_ptr, 1, STRSIZE, NULL}, - {"distfs mount", "distfs mount = %s", "a $0", &distfs_mnt_ptr, 1, - STRSIZE, NULL}, - {"dist postfix", "dist postfix = %s", "a $0", &dist_postfix_ptr, 1, - STRSIZE, NULL}, -}; - /* process function ... */ void process_f_flag(char *f_name) { - char *buffer; - int fd; - int fsize; + char buffer[STRSIZE]; + int len; + const struct f_arg *arg; + FILE *fp; + char *cp, *cp1; /* open the file */ - fd = open(f_name, O_RDONLY, 0); - if (fd < 0) { + fp = fopen(f_name, "r"); + if (fp == NULL) { fprintf(stderr, msg_string(MSG_config_open_error), f_name); exit(1); } - /* get file size */ - fsize = lseek(fd, 0, SEEK_END); - lseek(fd, 0, SEEK_SET); - if (fsize == -1) { - fprintf(stderr, msg_string(MSG_not_regular_file), f_name); - exit(1); + while (fgets(buffer, sizeof buffer, fp) != NULL) { + cp = buffer + strspn(buffer, " \t"); + if (strchr("#\r\n", *cp) != NULL) + continue; + for (arg = fflagopts; arg->name != NULL; arg++) { + len = strlen(arg->name); + if (memcmp(cp, arg->name, len) != 0) + continue; + cp1 = cp + len; + cp1 += strspn(cp1, " \t"); + if (*cp1++ != '=') + continue; + cp1 += strspn(cp1, " \t"); + len = strcspn(cp1, " \n\r\t"); + cp1[len] = 0; + strlcpy(arg->var, cp1, arg->size); + break; + } } - /* allocate buffer (error reported) */ - buffer = malloc(fsize + 1); - if (buffer == NULL) { - fprintf(stderr, msg_string(MSG_out_of_memory)); - exit(1); - } - - /* read the file */ - if (read(fd,buffer, fsize) != fsize) { - fprintf(stderr, msg_string(MSG_config_read_error), f_name); - exit(1); - } - buffer[fsize] = 0; - - /* close the file */ - close(fd); - - /* Walk the buffer */ - walk(buffer, fsize, fflagopts, - sizeof(fflagopts)/sizeof(struct lookfor)); - - /* free the buffer */ - free(buffer); + fclose(fp); } diff --git a/distrib/utils/sysinst/menus.mi b/distrib/utils/sysinst/menus.mi index 5f250e6f0101..74e76615139e 100644 --- a/distrib/utils/sysinst/menus.mi +++ b/distrib/utils/sysinst/menus.mi @@ -1,4 +1,4 @@ -/* $NetBSD: menus.mi,v 1.22 2005/08/27 16:34:15 xtraeme Exp $ */ +/* $NetBSD: menus.mi,v 1.23 2006/01/12 22:02:44 dsl Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -210,7 +210,7 @@ menu sizechoice, sub menu, y=0, title MSG_Choose_your_size_specifier; multname = msg_string(MSG_secname); }; -menu distmedium, title MSG_Select_medium; +menu distmedium, title MSG_Select_medium, y=-1; display action { umount_mnt2(); msg_display(MSG_distmedium); }; option MSG_cdrom, exit, action { *(int *)arg = get_via_cdrom(); }; option MSG_ftp, exit, action { *(int *)arg = get_via_ftp("ftp"); }; @@ -219,7 +219,9 @@ menu distmedium, title MSG_Select_medium; option MSG_floppy, exit, action { *(int *)arg = get_via_floppy(); }; option MSG_local_fs, exit, action { *(int *)arg = get_via_localfs(); }; option MSG_local_dir, exit, action { *(int *)arg = get_via_localdir();}; - option MSG_none, exit, action { *(int *)arg = -2; }; + option MSG_Skip_set, exit, action { *(int *)arg = SET_SKIP; }; + option MSG_Skip_group,exit, action { *(int *)arg = SET_SKIP_GROUP; }; + option MSG_Abandon, exit, action { *(int *)arg = SET_ABANDON; }; menu distset, title MSG_Select_your_distribution; display action { msg_display (MSG_distset); }; @@ -229,45 +231,48 @@ menu distset, title MSG_Select_your_distribution; menu ftpsource, title MSG_Change; display action { msg_clear(); - msg_table_add(MSG_ftpsource, arg, ftp_host, ftp_dir, set_dir, - ftp_user, strcmp(ftp_user, "ftp") == 0 || ftp_pass[0] == 0 - ? ftp_pass : msg_string(MSG_hidden), - ftp_proxy); + msg_table_add(MSG_ftpsource, arg, ftp.host, ftp.dir, set_dir, + ftp.user, strcmp(ftp.user, "ftp") == 0 || ftp.pass[0] == 0 + ? ftp.pass : msg_string(MSG_hidden), + ftp.proxy, xfer_dir); }; option MSG_Host, action { msg_prompt_win(MSG_Host, -1, 12, 0, 0, - ftp_host, ftp_host, sizeof ftp_host); }; + ftp.host, ftp.host, sizeof ftp.host); }; option MSG_Base_dir, action { msg_prompt_win(MSG_Base_dir, -1, 12, 0, 0, - ftp_dir, ftp_dir, sizeof ftp_dir); }; + ftp.dir, ftp.dir, sizeof ftp.dir); }; option MSG_Set_dir, action { msg_prompt_win(MSG_Set_dir, -1, 12, 0, 0, set_dir, set_dir, sizeof set_dir); }; option MSG_User, action { msg_prompt_win(MSG_User, -1, 12, 0, 0, - ftp_user, ftp_user, sizeof ftp_user); - ftp_pass[0] = 0; + ftp.user, ftp.user, sizeof ftp.user); + ftp.pass[0] = 0; }; option MSG_Password, action - { if (strcmp(ftp_user, "ftp") == 0) + { if (strcmp(ftp.user, "ftp") == 0) msg_prompt_win(MSG_email, -1, 12, 0, 0, - ftp_pass, ftp_pass, sizeof ftp_pass); + ftp.pass, ftp.pass, sizeof ftp.pass); else { msg_prompt_noecho(MSG_Password, "", - ftp_pass, sizeof ftp_pass); + ftp.pass, sizeof ftp.pass); } }; option MSG_Proxy, action { msg_prompt_win(MSG_Proxy, -1, 12, 0, 0, - ftp_proxy, ftp_proxy, sizeof ftp_proxy); - if (strcmp(ftp_proxy, "") == 0) { + ftp.proxy, ftp.proxy, sizeof ftp.proxy); + if (strcmp(ftp.proxy, "") == 0) { unsetenv("ftp_proxy"); unsetenv("http_proxy"); } else { - setenv("ftp_proxy", ftp_proxy, 1); - setenv("http_proxy", ftp_proxy, 1); + setenv("ftp_proxy", ftp.proxy, 1); + setenv("http_proxy", ftp.proxy, 1); } }; + option MSG_Xfer_dir, action + { msg_prompt_win(MSG_Xfer_dir, -1, 12, 0, 0, + xfer_dir, xfer_dir, sizeof xfer_dir); }; option MSG_Get_Distribution, exit; menu nfssource, title MSG_Change; @@ -284,24 +289,15 @@ menu nfssource, title MSG_Change; set_dir, set_dir, sizeof set_dir); }; option MSG_Continue, exit; -menu nfsbadmount, title MSG_What_do_you_want_to_do; - option MSG_Try_again, exit, sub menu nfssource, action - { yesno = 1; ignorerror = 0; }; - option MSG_Give_up, exit, action - { yesno = 0; ignorerror = 0; }; - option MSG_Ignore_continue_anyway, exit, action - { yesno = 1; ignorerror = 1; }; - - menu fdremount, title MSG_What_do_you_want_to_do; - option MSG_Try_again, exit, action { yesno = 1; }; - option MSG_Set_finished, exit, action { yesno = 2; }; - option MSG_Abort_install, exit, action { yesno = 0; }; + option MSG_Try_again, exit, action { *(int *)arg = SET_CONTINUE; }; + option MSG_Set_finished, exit, action { *(int *)arg = SET_OK; }; + option MSG_Abort_install, exit, action { *(int *)arg = SET_RETRY; }; -menu fdok, title MSG_Hit_enter_to_continue; - option MSG_OK, exit, action { yesno = 1; }; - option MSG_Set_finished, exit, action { yesno = 2; }; - option MSG_Abort_install, exit, action { yesno = 0; }; +menu fdok, title MSG_What_do_you_want_to_do; + option MSG_OK, exit, action { *(int *)arg = SET_CONTINUE; }; + option MSG_Set_finished, exit, action { *(int *)arg = SET_OK; }; + option MSG_Abort_install, exit, action { *(int *)arg = SET_RETRY; }; menu crypttype, title MSG_Password_cipher, y=16; option MSG_DES, exit, action { yesno = 1; }; @@ -320,15 +316,6 @@ menu cdromsource, title MSG_Change; set_dir, set_dir, sizeof set_dir); }; option MSG_Continue, exit; -menu cdrombadmount, title MSG_What_do_you_want_to_do; - display action - { msg_display(MSG_cdrombadmount, cdrom_dev); }; - option MSG_Try_again, exit, action - { yesno = 1; }; - option MSG_Give_up, exit, action - { yesno = 0; }; - - menu localfssource, title MSG_Change; display action { msg_display(MSG_localfssource, localfs_dev, localfs_fs, @@ -347,14 +334,6 @@ menu localfssource, title MSG_Change; set_dir, set_dir, sizeof set_dir); }; option MSG_Continue, exit; -menu localfsbadmount, title MSG_What_do_you_want_to_do; - option MSG_Try_again, exit, sub menu localfssource, action - { yesno = 1; ignorerror = 0; }; - option MSG_Give_up, exit, action - { yesno = 0; ignorerror = 0; }; - option MSG_Ignore_continue_anyway, exit, action - { yesno = 1; ignorerror = 1; }; - menu localdirsource, title MSG_Change; display action { msg_display(MSG_localdir, localfs_dir, set_dir); }; diff --git a/distrib/utils/sysinst/msg.mi.de b/distrib/utils/sysinst/msg.mi.de index c8735cbd8f28..6cb059fd8b68 100644 --- a/distrib/utils/sysinst/msg.mi.de +++ b/distrib/utils/sysinst/msg.mi.de @@ -1,4 +1,4 @@ -/* $NetBSD: msg.mi.de,v 1.24 2005/09/09 23:20:33 dsl Exp $ */ +/* $NetBSD: msg.mi.de,v 1.25 2006/01/12 22:02:44 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -471,12 +471,8 @@ message distmedium {Ihre Festplatte ist nun bereit für die Installation der Kernel- und Distributionspakete. Wie im INSTALL Dokument beschrieben, haben Sie nun mehrere Optionen. -Für FTP oder NFS müssen Sie mit einem Netzwerk verbunden sein und Zugriff auf -die entsprechenden Server haben. Wenn Sie zu diesem Zeitpunkt noch nicht -bereit sind diese Installation zu vollenden, können Sie 'kein' auswählen, -wodurch Sie zum Hauptmenü zurückkehren. Sie können dann zu einem späteren -Zeitpunkt die Installation erneut starten und im Hauptmenü "Aktualisierung" -wählen. +Für FTP oder NFS müssen Sie mit einem Netzwerk verbunden sein und +Zugriff auf die entsprechenden Server haben. } message distset @@ -493,13 +489,14 @@ message ftpsource Dies sind die Daten zum Aufbau einer %s Verbindung. Falls der Benutzer "ftp" ist, benötigen Sie kein Passwort. -Server: %s -Basispfad: %s -Verzeichnis: %s -Benutzer: %s -Passwort: %s -Proxy: %s -} +Server: %s +Basispfad: %s +Verzeichnis: %s +Benutzer: %s +Passwort: %s +Proxy: %s +Zwischenspeicher %s +} /* fix XLAT */ message email {E-Mail Adresse} @@ -517,9 +514,6 @@ Basispfad: %s Verzeichnis: %s } -message nfsbadmount -{Das Verzeichnis %s:%s konnte nicht gemountet werden.} - message cdromsource {Geben Sie das CD-Laufwerk und das entsprechende Verzeichnis an, in dem die Distribution zu finden ist. @@ -552,12 +546,6 @@ Verzeichnis: %s message filesys {Dateisystem} -message cdrombadmount -{Die CD in %s konnte nicht gemountet werden.} - -message localfsbadmount -{%s konnte auf dem Laufwerk %s nicht gemountet werden.} - message badlocalsetdir {%s ist kein Verzeichnis.} @@ -598,7 +586,7 @@ message net_host message net_ip {IPv4 Adresse} -message net_ip_2nd +message net_srv_ip {IPv4 Adressse des Servers} message net_mask @@ -679,10 +667,10 @@ message ftperror {"ftp" konnte eine Datei nicht herunterladen. Wollen Sie es erneut versuchen?} -message distdir +message xferdir {Welches Verzeichnis möchten Sie für %s nutzen?} -message delete_dist_files +message delete_xfer_files {Wollen Sie die NetBSD Pakete von %s löschen? (Sie können diese auch dazu beibehalten ein weiteres System zu installieren oder zu erneuern.)} @@ -807,10 +795,10 @@ message fddev {Welches Diskettenlaufwerk wollen Sie nutzen? } message fdmount -{Bitte legen Sie die Diskette ein, auf der sich die Datei "%s" befindet. } +{Bitte legen Sie die Diskette ein, auf der sich die Datei "%s.%s" befindet. } message fdnotfound -{Ich konnte die Datei "%s" nicht finden. Bitte legen Sie die entsprechende +{Ich konnte die Datei "%s.%s" nicht finden. Bitte legen Sie die entsprechende Diskette ein. Wenn dies die letzte Diskette des Paketes war, wählen Sie "Paket fertig", um zum nächsten Paket überzugehen - falls ein weiteres Paket folgt.} @@ -820,7 +808,7 @@ message fdremount Sie sollten: -Erneut probieren, die Diskette mit der Datei "%s" einzulegen. +Erneut probieren, die Diskette mit der Datei "%s.%s" einzulegen. Keine weiteren Disketten für dieses Paket laden, und stattdessen mit dem nächsten Paket fortfahren - falls ein weiteres existiert. @@ -879,17 +867,11 @@ message set_X11_fonts message set_X11_servers {X11 Server} -message set_X_contrib -{X zusätzliche Clientsoftware} - message set_X11_prog {X11 Programmierung} -message set_X11_misc -{X11 Diverses} - message cur_distsets_row -{%-27s %3s\n} +{%-27s %3s} message select_all {Alle oben angezeigten Pakete auswählen} @@ -1058,6 +1040,7 @@ message hidden {** versteckt **} message Host {Host} message Base_dir {Basispfad} message Set_dir {Verzeichnis} +message Xfer_dir {Zwischenspeicher} message Directory {Verzeichnis} message User {Benutzer} message Password {Passwort} @@ -1069,6 +1052,9 @@ message Try_again {Versuchen Sie es erneut} message Give_up {Aufgeben} message Ignore_continue_anyway {Ignorieren und dennoch fortsetzen} message Set_finished {Paket fertig} +message Skip_set {Paket skip} /* XXX */ +message Skip_group {Paket skip group} /* XXX */ +message Abandon {Abandon installation} /* XXX */ message Abort_install {Installation abbrechen} message Password_cipher {Passwort Verschlüsselungsverfahren} message DES {DES} diff --git a/distrib/utils/sysinst/msg.mi.en b/distrib/utils/sysinst/msg.mi.en index c32cffce3ac4..c30833b92fbd 100644 --- a/distrib/utils/sysinst/msg.mi.en +++ b/distrib/utils/sysinst/msg.mi.en @@ -1,4 +1,4 @@ -/* $NetBSD: msg.mi.en,v 1.138 2005/09/09 23:20:33 dsl Exp $ */ +/* $NetBSD: msg.mi.en,v 1.139 2006/01/12 22:02:44 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -456,10 +456,7 @@ message distmedium {Your disk is now ready for installing the kernel and the distribution sets. As noted in your INSTALL notes, you have several options. For ftp or nfs, you must be connected to a network with access to the proper -machines. If you are not ready to complete the installation at this time, -you may select "none" and you will be returned to the main menu. When -you are ready at a later time, you may select "upgrade" from the main -menu to complete the installation. +machines. } message distset @@ -474,12 +471,13 @@ message ftpsource {The following are the %s site, directory, user, and password that will be used. If "user" is "ftp", then the password is not needed. -host: %s -base directory: %s -set directory: %s -user: %s -password: %s -proxy: %s +host: %s +base directory: %s +set directory: %s +user: %s +password: %s +proxy: %s +transfer directory: %s } message email @@ -498,9 +496,6 @@ base directory: %s set directory: %s } -message nfsbadmount -{The directory %s:%s could not be nfs mounted.} - message cdromsource {Enter the CDROM device to be used and directory on the CDROM where the distribution is located. @@ -532,12 +527,6 @@ set directory: %s message filesys {file system} -message cdrombadmount -{The CDROM /dev/%s could not be mounted.} - -message localfsbadmount -{%s could not be mounted on local device %s.} - message badlocalsetdir {%s is not a directory} @@ -577,7 +566,7 @@ message net_host message net_ip {Your IPv4 number} -message net_ip_2nd +message net_srv_ip {Server IPv4 number} message net_mask @@ -653,10 +642,10 @@ message ftperror {Ftp could not retrieve a file. Do you want to try again?} -message distdir +message xferdir {What directory shall I use for %s? } -message delete_dist_files +message delete_xfer_files {Do you want to delete the NetBSD sets from %s? (You can keep them to install/upgrade a second system.)} @@ -772,10 +761,10 @@ message fddev {What floppy device do you want to use? } message fdmount -{Please load the floppy containing the file named "%s". } +{Please load the floppy containing the file named "%s.%s". } message fdnotfound -{Could not find the file named "%s" on the disk. Please load the +{Could not find the file named "%s.%s" on the disk. Please load the floppy with that file on it. If this was the last set's disk, hit "Set finished" to continue on @@ -784,7 +773,7 @@ the next set, if any.} message fdremount {The floppy was not mounted successfully. You may: -Try again and put in the floppy containing the file named "%s". +Try again and put in the floppy containing the file named "%s.%s". Not load any more files from this set and continue on the next one, if any. @@ -841,17 +830,11 @@ message set_X11_fonts message set_X11_servers {X11 servers} -message set_X_contrib -{X contrib clients} - message set_X11_prog {X11 programming} -message set_X11_misc -{X11 Misc.} - message cur_distsets_row -{%-27s %3s\n} +{%-27s %3s} message select_all {Select all the above sets} @@ -1020,6 +1003,7 @@ message hidden {** hidden **} message Host {Host} message Base_dir {Base directory} message Set_dir {Set directory} +message Xfer_dir {Transfer directory} message Directory {Directory} message User {User} message Password {Password} @@ -1031,6 +1015,9 @@ message Try_again {Try again} message Give_up {Give up} message Ignore_continue_anyway {Ignore, continue anyway} message Set_finished {Set finished} +message Skip_set {Skip set} +message Skip_group {Skip set group} +message Abandon {Abandon installation} message Abort_install {Abort install} message Password_cipher {Password cipher} message DES {DES} diff --git a/distrib/utils/sysinst/msg.mi.es b/distrib/utils/sysinst/msg.mi.es index 462721329e02..ba05848ae71b 100644 --- a/distrib/utils/sysinst/msg.mi.es +++ b/distrib/utils/sysinst/msg.mi.es @@ -1,4 +1,4 @@ -/* $NetBSD: msg.mi.es,v 1.8 2005/12/13 14:23:06 xtraeme Exp $ */ +/* $NetBSD: msg.mi.es,v 1.9 2006/01/12 22:02:44 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -465,10 +465,7 @@ message distmedium {Su disco está ahora preparado para la instalación el nucleo y los conjuntos de la distribución. Como se apunta en las notas INSTALL, tiene diversas opciones. Para ftp o nfs, tiene que estar conectado a una red con acceso -a las maquinas apropiadas. Si no está preparado para completar la -instalación en este momento, puede seleccionar «ninguno» y será retornado -al menú principal. Cuando más adelante esté preparado, deberá seleccionar -«actualizar» desde el menú principal para completar la instalación. +a las maquinas apropiadas. } message distset @@ -489,6 +486,7 @@ dir. de conjuntos: %s usuario: %s contraseña: %s proxy: %s +dir de xfer: %s } message email @@ -507,9 +505,6 @@ directorio base: %s dir de conjuntos: %s } -message nfsbadmount -{El directorio %s:%s no pudo ser montado por nfs.} - message cdromsource {Introduzca el dispositivo de CDROM a usar y el directorio del CDROM donde se encuentre la distribución. @@ -541,12 +536,6 @@ dir de conjuntos: %s message filesys {sistema de ficheros} -message cdrombadmount -{No se ha podido montar el CDROM /dev/%s.} - -message localfsbadmount -{No se ha podido montar %s en el dispositivo local %s.} - message badlocalsetdir {%s no es un directorio} @@ -588,7 +577,7 @@ message net_host message net_ip {Su número IPv4} -message net_ip_2nd +message net_srv_ip {Número servidor IPv4} message net_mask @@ -665,10 +654,10 @@ message ftperror {Ftp no ha podido descargar un fichero. ¿Desea intentarlo de nuevo?} -message distdir +message xferdir {¿Qué directorio debería usar para %s? } -message delete_dist_files +message delete_xfer_files {¿Quiere borrar los conjuntos de NetBSD de %s? (Puede dejarlos para instalar/actualizar un segundo sistema.)} @@ -793,10 +782,10 @@ message fddev {¿Qué dispositivo de disquete quiere usar? } message fdmount -{Por favor, inserte el disquete que contiene el fichero «%s». } +{Por favor, inserte el disquete que contiene el fichero «%s.%s». } message fdnotfound -{No se ha encontrado el fichero «%s» en el disco. Por favor, inserte +{No se ha encontrado el fichero «%s.%s» en el disco. Por favor, inserte el disquete que lo contenga. Si éste era el último disco del conjunto, pulse «Conjunto acabado» para @@ -805,7 +794,7 @@ continuar con el siguiente conjunto, si lo hay.} message fdremount {El disquete no ha sido montado correctamente. Puede: -Intentarlo de nuevo e insertar el disquete que contenga el fichero «%s». +Intentarlo de nuevo e insertar el disquete que contenga el fichero «%s.%s». No cargar ningún otro fichero de este conjunto y continuar con el siguiente, si lo hay. @@ -863,17 +852,11 @@ message set_X11_fonts message set_X11_servers {Servidores X11} -message set_X_contrib -{Clientes de X contrib} - message set_X11_prog {Programación de X11} -message set_X11_misc -{X11 Misc.} - message cur_distsets_row -{%-27s %3s\n} +{%-27s %3s} message select_all {Seleccionar todos los conjuntos anteriores} @@ -1046,6 +1029,7 @@ message hidden {** oculto **} message Host {Máquina} message Base_dir {Directorio base} message Set_dir {Directorio de conjuntos} +message Xfer_dir {Directorio a transferir a} /* XXX translation */ message Directory {Directorio} message User {Usuario} message Password {Contraseña} @@ -1057,6 +1041,9 @@ message Try_again {Reintentar} message Give_up {Abandonar} message Ignore_continue_anyway {Ignorar, continuar de todos modos} message Set_finished {Conjunto finalizado} +message Skip_set {Skip set} /* XXX translation */ +message Skip_group {Skip set group} /* XXX translation */ +message Abandon {Abandon installation} /* XXX */ message Abort_install {Interrumpir la instalación} message Password_cipher {Cifrado de las contraseñas} message DES {DES} @@ -1087,4 +1074,17 @@ apuntaba a un sistema de ficheros desmontado. Se le ha dado la extension '.old'. Cuando vuelva a arrancar su sistema actualizado, puede que necesite preocuparse de fundir el directorio /emul/aout nuevamente creado con el viejo. } -.endif \ No newline at end of file +.endif + +.if xxxx +Si no está preparado para completar la +instalación en este momento, puede seleccionar «ninguno» y será retornado +al menú principal. Cuando más adelante esté preparado, deberá seleccionar +«actualizar» desde el menú principal para completar la instalación. + +message cdrombadmount +{No se ha podido montar el CDROM /dev/%s.} + +message localfsbadmount +{No se ha podido montar %s en el dispositivo local %s.} +.endif diff --git a/distrib/utils/sysinst/msg.mi.fr b/distrib/utils/sysinst/msg.mi.fr index 7e285efe2bf9..b7292020114e 100644 --- a/distrib/utils/sysinst/msg.mi.fr +++ b/distrib/utils/sysinst/msg.mi.fr @@ -1,4 +1,4 @@ -/* $NetBSD: msg.mi.fr,v 1.87 2005/09/10 21:51:12 dsl Exp $ */ +/* $NetBSD: msg.mi.fr,v 1.88 2006/01/12 22:02:44 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -460,9 +460,6 @@ Comme indiqu plusieurs possibilités. Pour une installation via nfs ou ftp, vous devez être connecté au réseau et avoir accès au bon serveur. -Si vous n'êtes pas prêt pour terminer l'installation maintenant, -choisissez "aucun" puis retournerez au menu principal. -Vous pourrez choisir l'option "mise à jour" pour terminer l'installation. } message distset @@ -486,7 +483,8 @@ r utilisateur: %s mot de passe: %s proxy: %s -} +répertoire de transfer: %s +} /* fix XLAT */ message email {adresse e-mail} @@ -506,9 +504,6 @@ r répertoire des composants: %s } -message nfsbadmount -{Le répertoire %s:%s n'est pas montable par nfs.} - message cdromsource {Donnez le nom de périphérique du CD-Rom à utiliser ainsi que le répertoire qui contient les composants. @@ -543,12 +538,6 @@ R message filesys {système de fichiers} -message cdrombadmount -{Le CDROM ne peut pas être monté depuis le device %s.} - -message localfsbadmount -{%s ne peut pas être monté depuis le device %s.} - message badlocalsetdir {%s n'est pas un répertoire} @@ -592,7 +581,7 @@ message net_host message net_ip {Votre adresse IPv4} -message net_ip_2nd +message net_srv_ip {Server IPv4 number} message net_mask @@ -672,10 +661,10 @@ message ftperror {Impossible de télécharger un fichier par ftp. Voulez vous réessayer ?} -message distdir +message xferdir {Quel répertoire dois je utiliser pour %s ?} -message delete_dist_files +message delete_xfer_files {Voulez-vous supprimer les fichiers de distribution de NetBSD de %s ? Vous pouvez les conserver pour installer ou mettre a jour d'autre systèmes.} @@ -803,16 +792,16 @@ message fddev {Quel lecteur de disquette voulez vous utiliser? } message fdmount -{Veuillez insérer la disquette contenant le fichier "%s". } +{Veuillez insérer la disquette contenant le fichier "%s.%s". } message fdnotfound -{Impossible de trouver le fichier "%s" sur la disquette. +{Impossible de trouver le fichier "%s.%s" sur la disquette. } message fdremount {La disquette n'a pas été montée correctement. Vous devez : -Insérer une disquette contenant le fichier %s. +Insérer une disquette contenant le fichier %s.%s. Ne plus charger d'autre fichiers depuis la disquette et interrompre le processus @@ -868,17 +857,11 @@ message set_X11_fonts message set_X11_servers {X11 serveurs} -message set_X_contrib -{X11 clients contribués} - message set_X11_prog {X11 développement} -message set_X11_misc -{X11 Misc.} - message cur_distsets_row -{%-33s %3s\n} +{%-33s %3s} message select_all {Sélectionner tout les composants} @@ -1044,6 +1027,7 @@ message hidden {** cach message Host {Serveur ftp} message Base_dir {Répertoire de base} message Set_dir {Répertoire des composants} +message Xfer_dir {Répertoire de transfer} /* fix XLAT */ message Directory {Répertoire} message User {Utilisateur} message Password {Mot de passe} @@ -1055,6 +1039,9 @@ message Try_again {R message Give_up {Abandonner} message Ignore_continue_anyway {Ignorer les erreurs, continuer quand même} message Set_finished {Extraction terminée} +message Skip_set {Skip set} /* XXX translate */ +message Skip_group {Skip set group} /* XXX translate */ +message Abandon {Abandon installation} /* XXX */ message Abort_install {Annuler l'installation} message Password_cipher {Password cipher} message DES {DES} diff --git a/distrib/utils/sysinst/msg.mi.pl b/distrib/utils/sysinst/msg.mi.pl index 12f9d4be7f04..9705fd63fde1 100644 --- a/distrib/utils/sysinst/msg.mi.pl +++ b/distrib/utils/sysinst/msg.mi.pl @@ -1,4 +1,4 @@ -/* $NetBSD: msg.mi.pl,v 1.48 2005/09/10 21:51:12 dsl Exp $ */ +/* $NetBSD: msg.mi.pl,v 1.49 2006/01/12 22:02:44 dsl Exp $ */ /* Based on english version: */ /* NetBSD: msg.mi.pl,v 1.36 2004/04/17 18:55:35 atatat Exp */ @@ -446,11 +446,7 @@ zatrzyma sie na trybie jednego-uzytkownika. message distmedium {Twoj dysk jest teraz gotowy na zainstalowanie jadra oraz pakietow dystrybucyjnych. Jak napisano w pliku INSTALL masz terz kilka opcji. Dla -ftp lub nfs, musisz byc podlaczony do sieci z dostepem do odpowidnich -maszyn. Jesli nie jestes gotowy aby zakonczyc instalacje teraz, mozesz -wybrac "none" i zostaniesz przeniesiony do glownego menu. Kiedy bedziesz -juz pozniej gotowy, mozesz wybrac "aktualizuj" z glownego menu, aby -zakonczyc instalacje. +ftp lub nfs, musisz byc podlaczony do sieci z dostepem do odpowidnich maszyn. } message distset @@ -464,13 +460,14 @@ message ftpsource {Ponizej masz site %s, katalog, uzytkownika, oraz haslo gotowe do uzycia. Jesli "uzytkownik" to "ftp", wtedy haslo nie jest wymagane. -host: %s -katalog: %s -katalog: %s -uzytkownik: %s -haslo: %s -proxy: %s -} +host: %s +katalog: %s +katalog: %s +uzytkownik: %s +haslo: %s +proxy: %s +transfer katalog: %s +} /* fix XLAT */ message email {adres e-mail} @@ -488,9 +485,6 @@ katalog: %s katalog: %s } -message nfsbadmount -{Katalog %s:%s jest niedostepny dla nfs.} - message cdromsource {Podaj urzadzenie CDROM oraz katalog na CDROMie, w ktorym znajduje sie dystrybucja. @@ -522,12 +516,6 @@ katalog: %s message filesys {system plikow} -message cdrombadmount -{CDROM nie moze zostac zamountowany na %s.} - -message localfsbadmount -{%s nie mogl byc zamountowany na lokalnym urzadzeniu %s.} - message badlocalsetdir {%s nie jest katalogiem} @@ -567,7 +555,7 @@ message net_host message net_ip {Twoj adres IPv4} -message net_ip_2nd +message net_srv_ip {Server IPv4 number} message net_mask @@ -646,10 +634,10 @@ message ftperror {Ftp nie moze sciagnac pliku. Czy chcesz sprobowac jeszcze raz?} -message distdir +message xferdir {Jakiego katalogu powinienem uzyc dla %s? } -message delete_dist_files +message delete_xfer_files {Czy chcesz usunac pakiety NetBSD z %s? (Mozesz je zachowac aby zainstalowac/zaktualizowac kolejny system.)} @@ -763,16 +751,16 @@ message fddev {Ktorego urzadzenia dyskietek chcesz uzyc ? } message fdmount -{Wloz dyskietke zawierajaca plik "%s". } +{Wloz dyskietke zawierajaca plik "%s.%s". } message fdnotfound -{Nie moglem znalezc pliku "%s" na dysku. Wloz dyskietke +{Nie moglem znalezc pliku "%s.%s" na dysku. Wloz dyskietke zawierajaca ten plik.} message fdremount {Dyskietka nie zostala pomyslnie zamountowana. Mozesz: -Sprobowac jeszcze raz i wlozyc dyskietke z plikiem "%s". +Sprobowac jeszcze raz i wlozyc dyskietke z plikiem "%s.%s". Nie wgrywac wiecej plikow z dyskietek i przerwac proces. } @@ -827,17 +815,11 @@ message set_X11_fonts message set_X11_servers {Serwery X11} -message set_X_contrib -{Klienci dodatkowi X} - message set_X11_prog {Programowanie X11} -message set_X11_misc -{Inne X11} - message cur_distsets_row -{%-30s %3s\n} +{%-30s %3s} message select_all {Wybierz wszystkie powyzsze pakiety} @@ -1002,6 +984,7 @@ message hidden {** ukryte **} message Host {Host} message Base_dir {Katalog} message Set_dir {Katalog} +message Xfer_dir {Transfer Katalog} /* fix XLAT */ message Directory {Katalog} message User {Uzytkownik} message Password {Haslo} @@ -1013,6 +996,9 @@ message Try_again {Sprobowac jeszcze raz} message Give_up {Poddac sie} message Ignore_continue_anyway {Zignorowac, kontynuowac} message Set_finished {Ustawianie zakonczone} +message Skip_set {Skip set} /* XXX translate */ +message Skip_group {Skip set group} /* XXX translate */ +message Abandon {Abandon installation} /* XXX */ message Abort_install {Przerwac instalacje} message Password_cipher {Kodowanie hasel} message DES {DES} diff --git a/distrib/utils/sysinst/net.c b/distrib/utils/sysinst/net.c index 53943f1ebadd..325b4ec40672 100644 --- a/distrib/utils/sysinst/net.c +++ b/distrib/utils/sysinst/net.c @@ -1,4 +1,4 @@ -/* $NetBSD: net.c,v 1.106 2005/05/08 19:46:33 christos Exp $ */ +/* $NetBSD: net.c,v 1.107 2006/01/12 22:02:44 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -71,9 +71,9 @@ static char *net_up; static char net_dev[STRSIZE]; static char net_domain[STRSIZE]; static char net_host[STRSIZE]; -static char net_ip[STRSIZE]; -static char net_ip_2nd[STRSIZE]; -static char net_mask[STRSIZE]; +static char net_ip[SSTRSIZE]; +static char net_srv_ip[SSTRSIZE]; +static char net_mask[SSTRSIZE]; static char net_namesvr[STRSIZE]; static char net_defroute[STRSIZE]; static char net_media[STRSIZE]; @@ -490,7 +490,7 @@ config_network(void) const char *prompt; char *textbuf; int octet0; - int pass, dhcp_config; + int dhcp_config; int slip; int pid, status; @@ -512,6 +512,7 @@ config_network(void) get_ifconfig_info(); if (net_up != NULL) { + /* XXX: some retry loops come here... */ /* active interfaces found */ msg_display(MSG_netup, net_up); process_menu(MENU_yesno, NULL); @@ -546,14 +547,16 @@ again: } free(defname); - slip = strncmp(net_dev, "sl", 2) == 0; + slip = net_dev[0] == 's' && net_dev[1] == 'l' && + isdigit((unsigned char)net_dev[2]); - if (!slip) { + if (slip) + dhcp_config = 0; + else { /* Preload any defaults we can find */ get_ifinterface_info(); get_if6interface_info(); get_host_info(); - pass = net_mask[0] == '\0' ? 0 : 1; /* domain and host */ msg_display(MSG_netinfo); @@ -653,8 +656,7 @@ again: strlcpy(net_host, dhcp_host, sizeof net_host); } } - } else - dhcp_config = 0; + } msg_prompt_add(MSG_net_domain, net_domain, net_domain, sizeof net_domain); @@ -663,9 +665,13 @@ again: if (!dhcp_config) { /* Manually configure IPv4 */ msg_prompt_add(MSG_net_ip, net_ip, net_ip, sizeof net_ip); - if (!slip) { + if (slip) + msg_prompt_add(MSG_net_srv_ip, net_srv_ip, net_srv_ip, + sizeof net_srv_ip); + else { + /* We don't want netmasks for SLIP */ octet0 = atoi(net_ip); - if (!pass) { + if (!net_mask[0]) { if (0 <= octet0 && octet0 <= 127) strlcpy(net_mask, "0xff000000", sizeof(net_mask)); @@ -676,16 +682,13 @@ again: strlcpy(net_mask, "0xffffff00", sizeof(net_mask)); } - } else - msg_prompt_add(MSG_net_ip_2nd, net_ip_2nd, net_ip_2nd, STRSIZE); - /* We don't want netmasks for SLIP, - just in case of ... */ - if (!slip) msg_prompt_add(MSG_net_mask, net_mask, net_mask, - sizeof net_mask); + sizeof net_mask); + } msg_prompt_add(MSG_net_defroute, net_defroute, net_defroute, sizeof net_defroute); } + if (!dhcp_config || net_namesvr[0] == 0) msg_prompt_add(MSG_net_namesrv, net_namesvr, net_namesvr, sizeof net_namesvr); @@ -712,7 +715,7 @@ again: if (slip) msg_display(MSG_netok_slip, net_domain, net_host, net_dev, *net_ip == '\0' ? "" : net_ip, - *net_ip_2nd == '\0' ? "" : net_ip_2nd, + *net_srv_ip == '\0' ? "" : net_srv_ip, *net_mask == '\0' ? "" : net_mask, *net_namesvr == '\0' ? "" : net_namesvr, *net_defroute == '\0' ? "" : net_defroute, @@ -733,7 +736,6 @@ again: process_menu(MENU_yesno, deconst(MSG_netok_ok)); if (!yesno) msg_display(MSG_netagain); - pass++; if (!yesno) goto again; @@ -788,11 +790,15 @@ again: if (net_ip[0] != '\0') { if (slip) { + /* XXX: needs 'ifconfig sl0 create' much earlier */ /* Set SLIP interface UP */ - run_program(0, "/sbin/ifconfig %s inet %s %s up", net_dev, net_ip, net_ip_2nd); + run_program(0, "/sbin/ifconfig %s inet %s %s up", + net_dev, net_ip, net_srv_ip); strcpy(sl_flags, "-s 115200 -l /dev/tty00"); - msg_prompt_add(MSG_slattach, sl_flags, sl_flags, 255); + msg_prompt_win(MSG_slattach, -1, 12, 70, 0, + sl_flags, sl_flags, 255); + /* XXX: wtf isn't run_program() used here? */ pid = fork(); if (pid == 0) { strcpy(buffer, "/sbin/slattach "); @@ -863,17 +869,63 @@ again: return network_up; } -int -get_via_ftp(const char *xfer_type) +static int +ftp_fetch(const char *set_name) { - distinfo *list; + const char *ftp_opt; char ftp_user_encoded[STRSIZE]; char ftp_dir_encoded[STRSIZE]; - int ret; - int got_one = 0; char *cp; - const char *ftp_opt; - int cwd; + int rval; + + /* + * Invoke ftp to fetch the file. + * + * ftp.pass is quite likely to contain unsafe characters + * that need to be encoded in the URL (for example, + * "@", ":" and "/" need quoting). Let's be + * paranoid and also encode ftp.user and ftp.dir. (For + * example, ftp.dir could easily contain '~', which is + * unsafe by a strict reading of RFC 1738). + */ + if (strcmp("ftp", ftp.user) == 0 && ftp.pass[0] == 0) { + /* do anon ftp */ + ftp_opt = "-a "; + ftp_user_encoded[0] = 0; + } else { + ftp_opt = ""; + cp = url_encode(ftp_user_encoded, ftp.user, + ftp_user_encoded + sizeof ftp_user_encoded - 1, + RFC1738_SAFE_LESS_SHELL, 0); + *cp++ = ':'; + cp = url_encode(cp, ftp.pass, + ftp_user_encoded + sizeof ftp_user_encoded - 1, + NULL, 0); + *cp++ = '@'; + *cp = 0; + } + + cp = url_encode(ftp_dir_encoded, ftp.dir, + ftp_dir_encoded + sizeof ftp_dir_encoded - 1, + RFC1738_SAFE_LESS_SHELL_PLUS_SLASH, 1); + if (set_dir[0] != '/') + *cp++ = '/'; + url_encode(cp, set_dir, + ftp_dir_encoded + sizeof ftp_dir_encoded, + RFC1738_SAFE_LESS_SHELL_PLUS_SLASH, 0); + + rval = run_program(RUN_DISPLAY | RUN_PROGRESS | RUN_XFER_DIR, + "/usr/bin/ftp %s%s://%s%s/%s/%s%s", + ftp_opt, ftp.xfer_type, ftp_user_encoded, ftp.host, + ftp_dir_encoded, set_name, dist_postfix); + + return rval ? SET_RETRY : SET_OK; +} + +static int +do_config_network(void) +{ + int ret; while ((ret = config_network()) <= 0) { if (ret < 0) @@ -884,145 +936,54 @@ get_via_ftp(const char *xfer_type) msg_display(MSG_netnotup_continueanyway); process_menu(MENU_yesno, NULL); if (!yesno) - return 0; + return -1; network_up = 1; + break; } } + return 0; +} - cwd = open(".", O_RDONLY); - cd_dist_dir("ftp"); +int +get_via_ftp(const char *xfer_type) +{ + + if (do_config_network() != 0) + return SET_RETRY; process_menu(MENU_ftpsource, deconst(xfer_type)); - list = dist_list; - while (list->desc) { - if (list->name == NULL || (sets_selected & list->set) == 0) { - list++; - continue; - } - /* - * Invoke ftp to fetch the file. - * - * ftp_pass is quite likely to contain unsafe characters - * that need to be encoded in the URL (for example, - * "@", ":" and "/" need quoting). Let's be - * paranoid and also encode ftp_user and ftp_dir. (For - * example, ftp_dir could easily contain '~', which is - * unsafe by a strict reading of RFC 1738). - */ - if (strcmp("ftp", ftp_user) == 0 && ftp_pass[0] == 0) { - /* do anon ftp */ - ftp_opt = "-a "; - ftp_user_encoded[0] = 0; - } else { - ftp_opt = ""; - cp = url_encode(ftp_user_encoded, ftp_user, - ftp_user_encoded + sizeof ftp_user_encoded - 1, - RFC1738_SAFE_LESS_SHELL, 0); - *cp++ = ':'; - cp = url_encode(cp, ftp_pass, - ftp_user_encoded + sizeof ftp_user_encoded - 1, - NULL, 0); - *cp++ = '@'; - *cp = 0; - } + /* We'll fetch each file just before installing it */ + fetch_fn = ftp_fetch; + ftp.xfer_type = xfer_type; + clean_xfer_dir = 1; + snprintf(ext_dir, sizeof ext_dir, "%s/%s", target_prefix(), xfer_dir); - cp = url_encode(ftp_dir_encoded, ftp_dir, - ftp_dir_encoded + sizeof ftp_dir_encoded - 1, - RFC1738_SAFE_LESS_SHELL_PLUS_SLASH, 1); - if (set_dir[0] != '/') - *cp++ = '/'; - url_encode(cp, set_dir, - ftp_dir_encoded + sizeof ftp_dir_encoded, - RFC1738_SAFE_LESS_SHELL_PLUS_SLASH, 0); - - ret = run_program(RUN_DISPLAY | RUN_PROGRESS, - "/usr/bin/ftp %s%s://%s%s/%s/%s%s", - ftp_opt, xfer_type, ftp_user_encoded, ftp_host, - ftp_dir_encoded, list->name, dist_postfix); - - if (ret == 0) { - got_one = 1; - } else { - /* Error getting the file. Bad host name ... ? */ - process_menu(MENU_yesno, deconst(MSG_ftperror)); - if (yesno) { - process_menu(MENU_ftpsource, NULL); - continue; - } - if (got_one == 0) { - fchdir(cwd); /* back to current real root */ - close(cwd); - return 0; - } - /* Continue without this set... */ - } - list++; - - } - wrefresh(curscr); - wmove(stdscr, 0, 0); - touchwin(stdscr); - wclear(stdscr); - wrefresh(stdscr); - - fchdir(cwd); /* back to current real root */ - close(cwd); - return (1); + return SET_OK; } int get_via_nfs(void) { - int ret; - while ((ret = config_network()) <= 0) { - 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 0; - network_up = 1; - } - } + if (do_config_network() != 0) + return SET_RETRY; -again: /* Get server and filepath */ process_menu(MENU_nfssource, NULL); - umount_mnt2(); - /* Mount it */ if (run_program(0, "/sbin/mount -r -o -2,-i,-r=1024 -t nfs %s:%s /mnt2", - nfs_host, nfs_dir)) { - msg_display(MSG_nfsbadmount, nfs_host, nfs_dir); - process_menu(MENU_nfsbadmount, NULL); - if (!yesno) - return (0); - if (!ignorerror) - goto again; - } + nfs_host, nfs_dir)) + return SET_RETRY; + mnt2_mounted = 1; snprintf(ext_dir, sizeof ext_dir, "/mnt2/%s", set_dir); - /* Verify distribution files exist. */ - if (distribution_sets_exist_p(ext_dir) == 0) { - msg_display(MSG_badsetdir, ext_dir); - process_menu (MENU_nfsbadmount, NULL); - if (!yesno) - return (0); - if (!ignorerror) - goto again; - } - /* return location, don't clean... */ - clean_dist_dir = 0; - return 1; + clean_xfer_dir = 0; + return SET_OK; } /* diff --git a/distrib/utils/sysinst/run.c b/distrib/utils/sysinst/run.c index 42be2e2cba55..2e25d59e5e0d 100644 --- a/distrib/utils/sysinst/run.c +++ b/distrib/utils/sysinst/run.c @@ -1,4 +1,4 @@ -/* $NetBSD: run.c,v 1.59 2005/02/26 17:40:49 dsl Exp $ */ +/* $NetBSD: run.c,v 1.60 2006/01/12 22:02:44 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -174,7 +174,7 @@ collect(int kind, char **buffer, const char *name, ...) char *cp; va_start(ap, name); - vsnprintf(fileorcmd, STRSIZE, name, ap); + vsnprintf(fileorcmd, sizeof fileorcmd, name, ap); va_end(ap); if (kind == T_FILE) { @@ -446,18 +446,21 @@ launch_subwin(WINDOW **actionwin, char **args, struct winsize *win, int flags, fprintf(script, "%s\n", scmd); fclose(script); } + if (flags & RUN_XFER_DIR) + target_chdir_or_die(xfer_dir); /* * If target_prefix == "", the chroot will fail, but * that's ok, since we don't need it then. */ - if ((flags & RUN_CHROOT) != 0 && chroot(target_prefix()) != 0) + if (flags & RUN_CHROOT && *target_prefix() + && chroot(target_prefix()) != 0) warn("chroot(%s) for %s", target_prefix(), *args); else { execvp(*args, args); warn("execvp %s", *args); } _exit(EXIT_FAILURE); - break; /* end of child */ + // break; /* end of child */ default: /* * parent: we've set up the subprocess. diff --git a/distrib/utils/sysinst/target.c b/distrib/utils/sysinst/target.c index d78b9482594d..782b01a77389 100644 --- a/distrib/utils/sysinst/target.c +++ b/distrib/utils/sysinst/target.c @@ -1,4 +1,4 @@ -/* $NetBSD: target.c,v 1.47 2004/06/06 06:06:59 christos Exp $ */ +/* $NetBSD: target.c,v 1.48 2006/01/12 22:02:44 dsl Exp $ */ /* * Copyright 1997 Jonathan Stone @@ -71,7 +71,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: target.c,v 1.47 2004/06/06 06:06:59 christos Exp $"); +__RCSID("$NetBSD: target.c,v 1.48 2006/01/12 22:02:44 dsl Exp $"); #endif /* @@ -303,6 +303,7 @@ do_target_chdir(const char *dir, int must_succeed) target_prefix(), strerror(error)); exit(1); } + errno = error; return (error); #else printf("target_chdir (%s)\n", tgt_dir); @@ -362,8 +363,8 @@ mv_within_target_or_die(const char *frompath, const char *topath) char realfrom[STRSIZE]; char realto[STRSIZE]; - strncpy(realfrom, target_expand(frompath), STRSIZE); - strncpy(realto, target_expand(topath), STRSIZE); + strlcpy(realfrom, target_expand(frompath), sizeof realfrom); + strlcpy(realto, target_expand(topath), sizeof realto); run_program(RUN_FATAL, "mv %s %s", realfrom, realto); } diff --git a/distrib/utils/sysinst/txtwalk.c b/distrib/utils/sysinst/txtwalk.c index 3af64cac20b5..922ba2709033 100644 --- a/distrib/utils/sysinst/txtwalk.c +++ b/distrib/utils/sysinst/txtwalk.c @@ -1,4 +1,4 @@ -/* $NetBSD: txtwalk.c,v 1.11 2004/11/11 20:14:02 dsl Exp $ */ +/* $NetBSD: txtwalk.c,v 1.12 2006/01/12 22:02:44 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -56,15 +56,15 @@ /* prototypes */ -static int process(struct lookfor *, char *); -static int match(char *, struct lookfor *, size_t); -static int finddata(struct lookfor *, char *, struct data *, size_t *); +static int process(const struct lookfor *, char *); +static int match(char *, const struct lookfor *, size_t); +static int finddata(const struct lookfor *, char *, struct data *, size_t *); /* * Walk the buffer, call match for each line. */ int -walk(char *buffer, size_t size, struct lookfor *these, size_t numthese) +walk(char *buffer, size_t size, const struct lookfor *these, size_t numthese) { size_t i = 0; size_t len; @@ -101,7 +101,7 @@ walk(char *buffer, size_t size, struct lookfor *these, size_t numthese) * For each match in these, process the match. */ static int -match(char *line, struct lookfor *these, size_t numthese) +match(char *line, const struct lookfor *these, size_t numthese) { size_t linelen; /* Line length */ size_t patlen; /* Pattern length */ @@ -126,7 +126,7 @@ match(char *line, struct lookfor *these, size_t numthese) /* process the matched line. */ static int -process(struct lookfor *item, char *line) +process(const struct lookfor *item, char *line) { struct data found[MAXDATA]; size_t numfound = 0; @@ -202,7 +202,7 @@ process(struct lookfor *item, char *line) * Side Effect -- sets numfound and found. */ static int -finddata(struct lookfor *item, char *line, struct data *found, size_t *numfound) +finddata(const struct lookfor *item, char *line, struct data *found, size_t *numfound) { const char *fmt; size_t len; diff --git a/distrib/utils/sysinst/txtwalk.h b/distrib/utils/sysinst/txtwalk.h index d1464af9a66b..e722881c9e3b 100644 --- a/distrib/utils/sysinst/txtwalk.h +++ b/distrib/utils/sysinst/txtwalk.h @@ -1,4 +1,4 @@ -/* $NetBSD: txtwalk.h,v 1.9 2003/11/30 14:36:44 dsl Exp $ */ +/* $NetBSD: txtwalk.h,v 1.10 2006/01/12 22:02:44 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -79,7 +79,7 @@ struct lookfor { /* prototypes */ -int walk(char *, size_t, struct lookfor *, size_t); +int walk(char *, size_t, const struct lookfor *, size_t); /* Maximum number of matched data elements per line! */ diff --git a/distrib/utils/sysinst/util.c b/distrib/utils/sysinst/util.c index e234a47f4900..1bf06166dbc4 100644 --- a/distrib/utils/sysinst/util.c +++ b/distrib/utils/sysinst/util.c @@ -1,4 +1,4 @@ -/* $NetBSD: util.c,v 1.137 2005/10/22 09:31:50 dsl Exp $ */ +/* $NetBSD: util.c,v 1.138 2006/01/12 22:02:44 dsl Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -54,6 +54,34 @@ #include "msg_defs.h" #include "menu_defs.h" +#ifndef MD_SETS_SELECTED +#define MD_SETS_SELECTED SET_KERNEL_1, SET_SYSTEM, SET_X11, SET_MD +#endif +#ifndef MD_SETS_VALID +#define MD_SETS_VALID SET_KERNEL, SET_SYSTEM, SET_X11, SET_MD +#endif + +static const char *msg_yes, *msg_no, *msg_all, *msg_some, *msg_none; +static const char *msg_cur_distsets_row; +static int select_menu_width; + +static uint8_t set_status[SET_GROUP_END]; +#define SET_VALID 0x01 +#define SET_SELECTED 0x02 +#define SET_SKIPPED 0x04 +#define SET_INSTALLED 0x08 + +static char fddev[STRSIZE]; + +struct tarstats { + int nselected; + int nfound; + int nnotfound; + int nerror; + int nsuccess; + int nskipped; +} tarstats; + distinfo dist_list[] = { #ifdef SET_KERNEL_1_NAME {SET_KERNEL_1_NAME, SET_KERNEL_1, MSG_set_kernel_1}, @@ -79,6 +107,7 @@ distinfo dist_list[] = { #ifdef SET_KERNEL_8_NAME {SET_KERNEL_8_NAME, SET_KERNEL_8, MSG_set_kernel_8}, #endif + {"base", SET_BASE, MSG_set_base}, {"etc", SET_ETC, MSG_set_system}, {"comp", SET_COMPILER, MSG_set_compiler}, @@ -86,12 +115,15 @@ distinfo dist_list[] = { {"man", SET_MAN_PAGES, MSG_set_man_pages}, {"misc", SET_MISC, MSG_set_misc}, {"text", SET_TEXT_TOOLS, MSG_set_text_tools}, - {NULL, SET_X11, MSG_set_X11}, + + {NULL, SET_GROUP, MSG_set_X11}, {"xbase", SET_X11_BASE, MSG_set_X11_base}, {"xcomp", SET_X11_PROG, MSG_set_X11_prog}, {"xetc", SET_X11_ETC, MSG_set_X11_etc}, {"xfont", SET_X11_FONTS, MSG_set_X11_fonts}, {"xserver", SET_X11_SERVERS, MSG_set_X11_servers}, + {NULL, SET_GROUP_END, NULL}, + #ifdef SET_MD_1_NAME {SET_MD_1_NAME, SET_MD_1, MSG_set_md_1}, #endif @@ -104,36 +136,47 @@ distinfo dist_list[] = { #ifdef SET_MD_4_NAME {SET_MD_4_NAME, SET_MD_4, MSG_set_md_4}, #endif - {NULL, 0, NULL}, + + {NULL, SET_LAST, NULL}, }; /* * local prototypes */ -struct tarstats { - int nselected; - int nfound; - int nnotfound; - int nerror; - int nsuccess; - int nskipped; -} tarstats; -static int extract_file(int, int, int, char *path); -static int extract_dist(int, int); -int distribution_sets_exist_p(const char *path); static int check_for(unsigned int mode, const char *pathname); -#ifndef MD_SETS_SELECTED -#define MD_SETS_SELECTED (SET_KERNEL_1 | SET_SYSTEM | SET_X11 | SET_MD) -#endif -#ifndef MD_SETS_VALID -#define MD_SETS_VALID (SET_KERNEL | SET_SYSTEM | SET_X11 | SET_MD) -#endif +static void +init_set_status(void) +{ + const static uint8_t sets_valid[] = {MD_SETS_VALID}; + const static uint8_t sets_selected[] = {MD_SETS_SELECTED}; + unsigned int i, len; + const char *longest; -unsigned int sets_valid = MD_SETS_VALID; -unsigned int sets_selected = (MD_SETS_SELECTED) & (MD_SETS_VALID); -unsigned int sets_installed = 0; + for (i = 0; i < nelem(sets_valid); i++) + set_status[sets_valid[i]] = SET_VALID; + for (i = 0; i < nelem(sets_selected); i++) + set_status[sets_selected[i]] |= SET_SELECTED; + + set_status[SET_GROUP] = SET_VALID; + + /* Lookup some strings we need lots of times */ + msg_yes = msg_string(MSG_Yes); + msg_no = msg_string(MSG_No); + msg_all = msg_string(MSG_All); + msg_some = msg_string(MSG_Some); + msg_none = msg_string(MSG_None); + msg_cur_distsets_row = msg_string(MSG_cur_distsets_row); + + /* Find longest and use it to determine width of selection menu */ + len = strlen(msg_no); longest = msg_no; + i = strlen(msg_yes); if (i > len) {len = i; longest = msg_yes; } + i = strlen(msg_all); if (i > len) {len = i; longest = msg_all; } + i = strlen(msg_some); if (i > len) {len = i; longest = msg_some; } + i = strlen(msg_none); if (i > len) {len = i; longest = msg_none; } + select_menu_width = snprintf(NULL, 0, msg_cur_distsets_row, "",longest); +} int dir_exists_p(const char *path) @@ -154,31 +197,9 @@ file_mode_match(const char *path, unsigned int mode) { struct stat st; - return (stat(path, &st) == 0 && (st.st_mode & mode) != 0); + return (stat(path, &st) == 0 && (st.st_mode & S_IFMT) == mode); } -int -distribution_sets_exist_p(const char *path) -{ - char buf[STRSIZE]; - int result; - - result = 1; - snprintf(buf, sizeof buf, "%s/%s", path, "etc.tgz"); - result = result && file_exists_p(buf); - - snprintf(buf, sizeof buf, "%s/%s", path, "base.tgz"); - result = result && file_exists_p(buf); - - if (result == 0) { - msg_display(MSG_badsetdir, path); - process_menu(MENU_ok, NULL); - } - - return result; -} - - uint get_ramsize(void) { @@ -211,6 +232,50 @@ run_makedev(void) free(owd); } +static int +floppy_fetch(const char *set_name) +{ + char post[4]; + msg prompt; + int menu; + int status; + + strcpy(post, "aa"); + + prompt = MSG_fdmount; + menu = MENU_fdok; + for (;;) { + umount_mnt2(); + msg_display(prompt, set_name, post); + process_menu(menu, &status); + if (status != SET_CONTINUE) + return status; + menu = MENU_fdremount; + prompt = MSG_fdremount; + if (run_program(0, "/sbin/mount -r -t %s %s /mnt2", + fdtype, fddev)) + continue; + mnt2_mounted = 1; + prompt = MSG_fdnotfound; + + /* Display this because it might take a while.... */ + if (run_program(RUN_DISPLAY, + "sh -c '/bin/cat /mnt2/%s.%s %s %s/%s/%s%s'", + set_name, post, + post[0] == 'a' && post[1] == 'a' ? ">" : ">>", + target_prefix(), xfer_dir, set_name, dist_postfix)) + /* XXX: a read error will give a corrupt file! */ + continue; + + /* We got that file, advance to next fragment */ + if (post[1] < 'z') + post[1]++; + else + post[1] = 'a', post[0]++; + prompt = MSG_fdmount; + menu = MENU_fdok; + } +} /* * Load files from floppy. Requires a /mnt2 directory for mounting them. @@ -218,75 +283,15 @@ run_makedev(void) int get_via_floppy(void) { - char fddev[STRSIZE]; - char fname[STRSIZE]; - char full_name[STRSIZE]; - char catcmd[STRSIZE]; - distinfo *list; - char post[4]; - int first; - struct stat sb; - (void)strlcpy(fddev, "/dev/fd0a", STRSIZE); - cd_dist_dir("unloading from floppy"); + (void)strlcpy(fddev, "/dev/fd0a", sizeof fddev); + get_xfer_dir("unloading from floppy"); - msg_prompt_add(MSG_fddev, fddev, fddev, STRSIZE); + msg_prompt_add(MSG_fddev, fddev, fddev, sizeof fddev); + fetch_fn = floppy_fetch; + clean_xfer_dir = 1; - list = dist_list; - while (list->desc) { - if (list->name == NULL) { - list++; - continue; - } - strcpy(post, ".aa"); - while (sets_selected & list->set) { - snprintf(fname, sizeof fname, "%s%s", list->name, post); - snprintf(full_name, sizeof full_name, "/mnt2/%s", - fname); - first = 1; - while (!mnt2_mounted || stat(full_name, &sb)) { - umount_mnt2(); - if (first) - msg_display(MSG_fdmount, fname); - else - msg_display(MSG_fdnotfound, fname); - process_menu(MENU_fdok, NULL); - if (!yesno) - return 0; - else if (yesno == 2) - return 1; - while (run_program(0, - "/sbin/mount -r -t %s %s /mnt2", - fdtype, fddev)) { - msg_display(MSG_fdremount, fname); - process_menu(MENU_fdremount, NULL); - if (!yesno) - return 0; - if (yesno == 2) - return 1; - } - mnt2_mounted = 1; - first = 0; - } - snprintf(catcmd, sizeof(catcmd), "/bin/cat %s >> %s%s", - full_name, list->name, dist_postfix); - if (logging) - (void)fprintf(logfp, "%s\n", catcmd); - if (scripting) - (void)fprintf(script, "%s\n", catcmd); - do_system(catcmd); - if (post[2] < 'z') - post[2]++; - else - post[2] = 'a', post[1]++; - } - umount_mnt2(); - list++; - } -#ifndef DEBUG - chdir("/"); /* back to current real root */ -#endif - return 1; + return SET_OK; } /* @@ -299,28 +304,18 @@ get_via_cdrom(void) /* Get CD-rom device name and path within CD-rom */ process_menu(MENU_cdromsource, NULL); - umount_mnt2(); - /* Mount it */ - for (;;) { - if (run_program(0, "/sbin/mount -rt cd9660 /dev/%s /mnt2", - cdrom_dev) == 0) - break; - process_menu(MENU_cdrombadmount, NULL); - if (!yesno) - return -1; - } + if (run_program(0, "/sbin/mount -rt cd9660 /dev/%s /mnt2", + cdrom_dev) != 0) + return SET_RETRY; + mnt2_mounted = 1; snprintf(ext_dir, sizeof ext_dir, "%s/%s", "/mnt2", set_dir); - /* Verify distribution files exist. */ - if (distribution_sets_exist_p(ext_dir) == 0) - return -1; - /* return location, don't clean... */ - clean_dist_dir = 0; - return 1; + clean_xfer_dir = 0; + return SET_OK; } @@ -335,32 +330,19 @@ get_via_localfs(void) /* Get device, filesystem, and filepath */ process_menu (MENU_localfssource, NULL); -again: - umount_mnt2(); - /* Mount it */ if (run_program(0, "/sbin/mount -rt %s /dev/%s /mnt2", - localfs_fs, localfs_dev)) { + localfs_fs, localfs_dev)) + return SET_RETRY; - msg_display(MSG_localfsbadmount, localfs_dir, localfs_dev); - process_menu(MENU_localfsbadmount, NULL); - if (!yesno) - return 0; - if (!ignorerror) - goto again; - } mnt2_mounted = 1; snprintf(ext_dir, sizeof ext_dir, "%s/%s/%s", "/mnt2", localfs_dir, set_dir); - /* Verify distribution files exist. */ - if (distribution_sets_exist_p(ext_dir) == 0) - return -1; - /* return location, don't clean... */ - clean_dist_dir = 0; - return 1; + clean_xfer_dir = 0; + return SET_OK; } /* @@ -380,30 +362,24 @@ get_via_localdir(void) */ snprintf(ext_dir, sizeof ext_dir, "/%s/%s", localfs_dir, set_dir); - if (distribution_sets_exist_p(ext_dir) == 0) - return -1; - /* return location, don't clean... */ - clean_dist_dir = 0; - return 1; + clean_xfer_dir = 0; + return SET_OK; } void -cd_dist_dir(const char *forwhat) +get_xfer_dir(const char *forwhat) { /* ask user for the mountpoint. */ - msg_prompt(MSG_distdir, dist_dir, dist_dir, STRSIZE, forwhat); + msg_prompt(MSG_xferdir, xfer_dir, xfer_dir, + sizeof xfer_dir, forwhat); - /* make sure the directory exists. */ - make_target_dir(dist_dir); - - clean_dist_dir = 1; - target_chdir_or_die(dist_dir); + clean_xfer_dir = 1; /* Set ext_dir for absolute path. */ - getcwd(ext_dir, sizeof ext_dir); + snprintf(ext_dir, sizeof ext_dir, "%s/%s", target_prefix(), xfer_dir); } @@ -411,150 +387,193 @@ cd_dist_dir(const char *forwhat) * Support for custom distribution fetches / unpacks. */ -typedef struct { - distinfo *dist; - unsigned int sets; - struct info { - unsigned int set; - char label[44]; - } i[32]; -} set_menu_info_t; +unsigned int +set_X11_selected(void) +{ + int i; + + for (i = SET_X11_FIRST; ++i < SET_X11_LAST;) + if (set_status[i] & SET_SELECTED) + return 1; + return 0; +} + +unsigned int +get_kernel_set(void) +{ + int i; + + for (i = SET_KERNEL_FIRST; ++i < SET_KERNEL_LAST;) + if (set_status[i] & SET_SELECTED) + return i; + return SET_NONE; +} + +void +set_kernel_set(unsigned int kernel_set) +{ + int i; + + /* only one kernel set is allowed */ + for (i = SET_KERNEL_FIRST; ++i < SET_KERNEL_LAST;) + set_status[i] &= ~SET_SELECTED; + set_status[kernel_set] |= SET_SELECTED; +} static int set_toggle(menudesc *menu, void *arg) { - set_menu_info_t *i = arg; - int set = i->i[menu->cursel].set; + distinfo **distp = arg; + int set = distp[menu->cursel]->set; - if (set & SET_KERNEL) - /* only one kernel set is allowed */ - sets_selected &= ~SET_KERNEL | set; - sets_selected ^= set; + if (set > SET_KERNEL_FIRST && set < SET_KERNEL_LAST && + !(set_status[set] & SET_SELECTED)) + set_kernel_set(set); + else + set_status[set] ^= SET_SELECTED; + return 0; +} + +static int +set_all_none(menudesc *menu, void *arg, int set, int clr) +{ + distinfo **distp = arg; + distinfo *dist = *distp; + int nested; + + for (nested = 0; dist->set != SET_GROUP_END || nested--; dist++) { + if (dist->set == SET_GROUP) { + nested++; + continue; + } + set_status[dist->set] = (set_status[dist->set] & ~clr) | set; + } return 0; } static int set_all(menudesc *menu, void *arg) { - set_menu_info_t *i = arg; - - sets_selected |= i->sets; - return 1; + return set_all_none(menu, arg, SET_SELECTED, 0); } static int set_none(menudesc *menu, void *arg) { - set_menu_info_t *i = arg; + return set_all_none(menu, arg, 0, SET_SELECTED); +} - sets_selected &= ~i->sets; - return 1; +static void +set_label(menudesc *menu, int opt, void *arg) +{ + distinfo **distp = arg; + distinfo *dist = distp[opt]; + const char *selected; + const char *desc; + int nested; + + desc = dist->desc; + + if (dist->set != SET_GROUP) + selected = set_status[dist->set] & SET_SELECTED ? msg_yes : msg_no; + else { + /* sub menu - display None/Some/All */ + nested = 0; + selected = "unknown"; + while ((++dist)->set != SET_GROUP_END || nested--) { + if (dist->set == SET_GROUP) { + nested++; + continue; + } + if (!(set_status[dist->set] & SET_VALID)) + continue; + if (set_status[dist->set] & SET_SELECTED) { + if (selected == msg_none) { + selected = msg_some; + break; + } + selected = msg_all; + } else { + if (selected == msg_all) { + selected = msg_some; + break; + } + selected = msg_none; + } + } + } + + wprintw(menu->mw, msg_cur_distsets_row, msg_string(desc), selected); } static int set_sublist(menudesc *menu, void *arg); -static void -set_selected_sets(menudesc *menu, void *arg) +static int +initialise_set_menu(distinfo *dist, menu_ent *me, distinfo **de, int all_none) { - distinfo *list; - static const char *yes, *no, *all, *some, *none; - const char *selected; - menu_ent *m; - set_menu_info_t *menu_info = arg; - struct info *i = menu_info->i; - unsigned int set; + int set; + int sets; + int nested; - if (yes == NULL) { - yes = msg_string(MSG_Yes); - no = msg_string(MSG_No); - all = msg_string(MSG_All); - some = msg_string(MSG_Some); - none = msg_string(MSG_None); - } - - m = menu->opts; - for (list = menu_info->dist; list->desc; list++) { - if (!(menu_info->sets & list->set)) + for (sets = 0; ; dist++) { + set = dist->set; + if (set == SET_LAST || set == SET_GROUP_END) break; - if (!(sets_valid & list->set)) + if (!(set_status[set] & SET_VALID)) continue; - i->set = list->set; - m->opt_menu = OPT_NOMENU; - m->opt_flags = 0; - m->opt_name = i->label; - m->opt_action = set_toggle; - if (list->set & (list->set - 1)) { - /* multiple bits possible */ - set = list->set & sets_valid; - selected = (set & sets_selected) == 0 ? none : - (set & sets_selected) == set ? all : some; - } else { - selected = list->set & sets_selected ? yes : no;; + *de = dist; + me->opt_menu = OPT_NOMENU; + me->opt_flags = 0; + me->opt_name = NULL; + if (set != SET_GROUP) + me->opt_action = set_toggle; + else { + /* Collapse sublist */ + nested = 0; + while ((++dist)->set != SET_GROUP_END || nested--) { + if (dist->set == SET_GROUP) + nested++; + } + me->opt_action = set_sublist; } - snprintf(i->label, sizeof i->label, - msg_string(MSG_cur_distsets_row), - msg_string(list->desc), selected); - m++; - i++; - if (list->name != NULL) - continue; - m[-1].opt_action = set_sublist; - /* collapsed sublist */ - set = list->set; - while (list[1].set & set) - list++; + sets++; + de++; + me++; } - if (menu_info->sets == ~0u) - return; + if (all_none) { + me->opt_menu = OPT_NOMENU; + me->opt_flags = 0; + me->opt_name = MSG_select_all; + me->opt_action = set_all; + me++; + me->opt_menu = OPT_NOMENU; + me->opt_flags = 0; + me->opt_name = MSG_select_none; + me->opt_action = set_none; + sets += 2; + } - m->opt_menu = OPT_NOMENU; - m->opt_flags = 0; - m->opt_name = MSG_select_all; - m->opt_action = set_all; - m++; - m->opt_menu = OPT_NOMENU; - m->opt_flags = 0; - m->opt_name = MSG_select_none; - m->opt_action = set_none; + return sets; } static int set_sublist(menudesc *menu, void *arg) { - distinfo *list; - menu_ent me[32]; - set_menu_info_t set_menu_info; - int sets; + distinfo *de[SET_LAST]; + menu_ent me[SET_LAST]; + distinfo **dist = arg; int menu_no; - unsigned int set; - set_menu_info_t *i = arg; + int sets; - set = i->i[menu->cursel].set; - set_menu_info.sets = set; + sets = initialise_set_menu(dist[menu->cursel] + 1, me, de, 1); - /* Count number of entries we require */ - for (list = dist_list; list->set != set; list++) - if (list->desc == NULL) - return 0; - set_menu_info.dist = ++list; - for (sets = 2; list->set & set; list++) - if (sets_valid & list->set) - sets++; - - if (sets > nelem(me)) { - /* panic badly */ - return 0; - } - - menu_no = new_menu(NULL, me, sets, 20, 10, 0, 44, + menu_no = new_menu(NULL, me, sets, 20, 10, 0, select_menu_width, MC_SUBMENU | MC_SCROLL | MC_DFLTEXIT, - set_selected_sets, NULL, NULL, NULL, MSG_install_selected_sets); + NULL, set_label, NULL, NULL, + MSG_install_selected_sets); - if (menu_no == -1) - return 0; - - process_menu(menu_no, &set_menu_info); + process_menu(menu_no, de); free_menu(menu_no); return 0; @@ -563,51 +582,25 @@ set_sublist(menudesc *menu, void *arg) void customise_sets(void) { - distinfo *list; - menu_ent me[32]; - set_menu_info_t set_menu_info; + distinfo *de[SET_LAST]; + menu_ent me[SET_LAST]; int sets; int menu_no; - unsigned int set, valid = 0; - - /* Count number of entries we require */ - for (sets = 0, list = dist_list; list->desc != NULL; list++) { - if (!(sets_valid & list->set)) - continue; - sets++; - if (list->name != NULL) { - valid |= list->set; - continue; - } - /* collapsed sublist */ - set = list->set; - while (list[1].set & set) { - valid |= list[1].set; - list++; - } - } - if (sets > nelem(me)) { - /* panic badly */ - return; - } /* Static initialisation is lazy, fix it now */ - sets_valid &= valid; - sets_selected &= valid; - - menu_no = new_menu(NULL, me, sets, 0, 5, 0, 44, - MC_SCROLL | MC_NOBOX | MC_DFLTEXIT | MC_NOCLEAR, - set_selected_sets, NULL, NULL, NULL, MSG_install_selected_sets); - - if (menu_no == -1) - return; + init_set_status(); msg_display(MSG_cur_distsets); msg_table_add(MSG_cur_distsets_header); - set_menu_info.dist = dist_list; - set_menu_info.sets = ~0u; - process_menu(menu_no, &set_menu_info); + sets = initialise_set_menu(dist_list, me, de, 0); + + menu_no = new_menu(NULL, me, sets, 0, 5, 0, select_menu_width, + MC_SCROLL | MC_NOBOX | MC_DFLTEXIT | MC_NOCLEAR, + NULL, set_label, NULL, NULL, + MSG_install_selected_sets); + + process_menu(menu_no, de); free_menu(menu_no); } @@ -629,25 +622,33 @@ ask_verbose_dist(msg setup_done) } static int -extract_file(int set, int update, int verbose, char *path) +extract_file(distinfo *dist, int update, int verbose, char *path) { char *owd; - int tarexit; + int rval; owd = getcwd(NULL, 0); + /* Do we need to fetch the file now? */ + if (fetch_fn != NULL) { + rval = fetch_fn(dist->name); + if (rval != SET_OK) + return rval; + } + /* check tarfile exists */ if (!file_exists_p(path)) { tarstats.nnotfound++; msg_display(MSG_notarfile, path); - process_menu(MENU_noyes, deconst(MSG_notarfile_ok)); - return yesno; + /* process_menu(MENU_noyes, deconst(MSG_notarfile_ok)); */ + process_menu(MENU_ok, NULL); + return SET_RETRY; } tarstats.nfound++; /* cd to the target root. */ - if (update && set == SET_ETC) { + if (update && dist->set == SET_ETC) { make_target_dir("/.sysinst"); target_chdir_or_die("/.sysinst"); } else @@ -655,90 +656,82 @@ extract_file(int set, int update, int verbose, char *path) /* now extract set files into "./". */ if (verbose == 0) - tarexit = run_program(RUN_DISPLAY | RUN_PROGRESS, + rval = run_program(RUN_DISPLAY | RUN_PROGRESS, "progress -zf %s tar --chroot -xhepf -", path); else if (verbose == 1) - tarexit = run_program(RUN_DISPLAY, + rval = run_program(RUN_DISPLAY, "tar --chroot -zxhepf %s", path); else - tarexit = run_program(RUN_DISPLAY | RUN_PROGRESS, + rval = run_program(RUN_DISPLAY | RUN_PROGRESS, "tar --chroot -zxhvepf %s", path); chdir(owd); free(owd); - /* Check tarexit for errors and give warning. */ - if (tarexit) { + /* Check rval for errors and give warning. */ + if (rval != 0) { tarstats.nerror++; msg_display(MSG_tarerror, path); - process_menu(MENU_noyes, NULL); - return yesno; + /* process_menu(MENU_noyes, NULL); */ + process_menu(MENU_ok, NULL); + return SET_RETRY; } - if (update && set == SET_ETC) { + if (update && dist->set == SET_ETC) { run_program(RUN_DISPLAY | RUN_CHROOT, "/usr/sbin/postinstall -s /.sysinst -d / fix"); } + set_status[dist->set] |= SET_INSTALLED; tarstats.nsuccess++; - return 2; + return SET_OK; } /* * Extract_dist **REQUIRES** an absolute path in ext_dir. Any code - * that sets up dist_dir for use by extract_dist needs to put in the + * that sets up xfer_dir for use by extract_dist needs to put in the * full path name to the directory. */ static int -extract_dist(int update, int verbose) +extract_dist(distinfo *dist, int update, int verbose) { char fname[STRSIZE]; - distinfo *list; - int extracted; + int set; - /* reset failure/success counters */ - memset(&tarstats, 0, sizeof(tarstats)); + /* If we might need to tidy up, ensure directory exists */ + if (fetch_fn != NULL && clean_xfer_dir) + make_target_dir(xfer_dir); - /*endwin();*/ - for (extracted = 2, list = dist_list; list->desc != NULL; list++) { - if (list->name == NULL) - continue; - if (!(sets_selected & list->set)) - continue; - tarstats.nselected++; - if (extracted == 0) { - tarstats.nskipped++; + set = dist->set; + (void)snprintf(fname, sizeof fname, "%s/%s%s", + ext_dir, dist->name + (*dist->name == '/'), dist_postfix); + + /* if extraction failed and user aborted, punt. */ + return extract_file(dist, update, verbose, fname); + +} + +static void +skip_set(distinfo *dist, int skip_type) +{ + int nested; + int set; + + nested = 0; + while ((++dist)->set != SET_GROUP_END || nested--) { + set = dist->set; + if (set == SET_GROUP) { + nested++; continue; } - (void)snprintf(fname, sizeof fname, "%s/%s%s", - ext_dir, list->name, dist_postfix); - - /* if extraction failed and user aborted, punt. */ - extracted = extract_file(list->set, update, verbose, fname); - if (extracted == 2) - sets_installed |= list->set; + if (set == SET_LAST) + break; + if (set_status[set] == (SET_SELECTED | SET_VALID)) + set_status[set] |= SET_SKIPPED; + tarstats.nskipped++; } - - wrefresh(curscr); - wmove(stdscr, 0, 0); - wclear(stdscr); - wrefresh(stdscr); - - if (tarstats.nerror == 0 && tarstats.nsuccess == tarstats.nselected) { - msg_display(MSG_endtarok); - /* Give user a chance to see the success message */ - sleep(1); - return 0; - } - /* We encountered errors. Let the user know. */ - msg_display(MSG_endtar, - tarstats.nselected, tarstats.nnotfound, tarstats.nskipped, - tarstats.nfound, tarstats.nsuccess, tarstats.nerror); - process_menu(MENU_ok, NULL); - msg_clear(); - return extracted == 0; } /* @@ -750,41 +743,87 @@ extract_dist(int update, int verbose) int get_and_unpack_sets(int update, msg setupdone_msg, msg success_msg, msg failure_msg) { - int got_dist; + distinfo *dist; + int status; int verbose; - distinfo *list; + int set; /* Ensure mountpoint for distribution files exists in current root. */ (void)mkdir("/mnt2", S_IRWXU| S_IRGRP|S_IXGRP | S_IROTH|S_IXOTH); if (scripting) - (void)fprintf(script, "mkdir /mnt2\nchmod 755 /mnt2\n"); + (void)fprintf(script, "mkdir -m 755 /mnt2\n"); + + /* reset failure/success counters */ + memset(&tarstats, 0, sizeof(tarstats)); /* Find out which files to "get" if we get files. */ /* ask user whether to do normal or verbose extraction */ verbose = ask_verbose_dist(setupdone_msg); - again: - /* Get the distribution files */ - do { - process_menu(MENU_distmedium, &got_dist); - } while (got_dist == -1); + status = SET_RETRY; + for (dist = dist_list; ; status != SET_OK || dist++) { + set = dist->set; + if (set == SET_LAST) + break; + if (dist->name == NULL) + continue; + if (set_status[set] != (SET_VALID | SET_SELECTED)) + continue; - if (got_dist == -2) - return 1; + if (status != SET_OK) { + /* This might force a redraw.... */ + clearok(curscr, 1); + touchwin(stdscr); + wrefresh(stdscr); + /* Sort out the location of the set files */ + do { + fetch_fn = NULL; + process_menu(MENU_distmedium, &status); + } while (status == SET_RETRY); - if (got_dist != 1) { - msg_display(failure_msg); - process_menu(MENU_ok, NULL); - return 1; + if (status == SET_SKIP) { + set_status[set] |= SET_SKIPPED; + tarstats.nskipped++; + continue; + } + if (status == SET_SKIP_GROUP) { + skip_set(dist, status); + continue; + } + if (status != SET_OK) { + msg_display(failure_msg); + process_menu(MENU_ok, NULL); + return 1; + } + } + + /* Extract the distribution, retry from top on errors. */ + status = extract_dist(dist, update, verbose); } - /* Extract the distribution, retry from top on errors. */ - if (extract_dist(update, verbose)) - goto again; + /* Accurately count selected sets, nsuccess is correct already. */ + for (dist = dist_list; (set = dist->set) != SET_LAST; dist++) { + if ((set_status[set] & (SET_VALID | SET_SELECTED)) + == (SET_VALID | SET_SELECTED)) + tarstats.nselected++; + } + + if (tarstats.nerror == 0 && tarstats.nsuccess == tarstats.nselected) { + msg_display(MSG_endtarok); + /* Give user a chance to see the success message */ + sleep(1); + } else { + /* We encountered errors. Let the user know. */ + msg_display(MSG_endtar, + tarstats.nselected, tarstats.nnotfound, tarstats.nskipped, + tarstats.nfound, tarstats.nsuccess, tarstats.nerror); + process_menu(MENU_ok, NULL); + msg_clear(); + } /* Configure the system */ - if (sets_installed & SET_BASE) + if (set_status[SET_BASE] & SET_INSTALLED) run_makedev(); /* Save keybard type */ @@ -792,25 +831,27 @@ get_and_unpack_sets(int update, msg setupdone_msg, msg success_msg, msg failure_ /* Other configuration. */ mnt_net_config(); - + +#if 0 /* Clean up dist dir (use absolute path name) */ - if (clean_dist_dir) { - msg_display(MSG_delete_dist_files, dist_dir); + if (clean_xfer_dir) { + msg_display(MSG_delete_xfer_files, xfer_dir); process_menu(MENU_yesno, deconst(MSG_Delete)); if (yesno) { - for (list = dist_list; list->desc != NULL; list++) { - if (list->name == NULL) + for (dist = dist_list; dist->desc != NULL; dist++) { + if (dist->name == NULL) /* menu entry for a group of sets */ continue; run_program(0, "/bin/rm -f %s/%s/%s%s", - target_prefix(), dist_dir, - list->name, dist_postfix); + target_prefix(), xfer_dir, + dist->name, dist_postfix); } /* chroot 'cos no rmdir in install fs */ run_program(RUN_CHROOT | RUN_SILENT | RUN_ERROR_OK, - "/bin/rmdir %s", dist_dir); + "/bin/rmdir %s", xfer_dir); } } +#endif /* Mounted dist dir? */ umount_mnt2();