Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-2-0]: src/distrib/utils/sysinst Pull up revision 1.120 (requested...
details: https://anonhg.NetBSD.org/src/rev/0d42665190a1
branches: netbsd-2-0
changeset: 561326:0d42665190a1
user: tron <tron%NetBSD.org@localhost>
date: Mon Jun 07 10:20:39 2004 +0000
description:
Pull up revision 1.120 (requested by dsl in ticket #453):
A load of usability fixes mainly to network installs.
I've made the error retry loops go back as far as the input menus.
Split all the pathname inputs into 2 pieces (base directory and set directory).
Reduced the size of some fixed strings.
Stopped the install aborting if ftp can't find a set (eg the X ones).
The French and Polish transations don't differenciate between Base_dir and
Set_dir - but that can be fixed later.
diffstat:
distrib/utils/sysinst/util.c | 128 ++++++++++++++++--------------------------
1 files changed, 48 insertions(+), 80 deletions(-)
diffs (253 lines):
diff -r 07b15c0eec90 -r 0d42665190a1 distrib/utils/sysinst/util.c
--- a/distrib/utils/sysinst/util.c Mon Jun 07 10:20:32 2004 +0000
+++ b/distrib/utils/sysinst/util.c Mon Jun 07 10:20:39 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: util.c,v 1.117.2.2 2004/05/22 16:24:38 he Exp $ */
+/* $NetBSD: util.c,v 1.117.2.3 2004/06/07 10:20:39 tron Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -135,6 +135,9 @@
unsigned int sets_selected = (MD_SETS_SELECTED) & (MD_SETS_VALID);
unsigned int sets_installed = 0;
+/* Do we want a verbose extract? */
+static int verbose = 0;
+
int
dir_exists_p(const char *path)
@@ -171,7 +174,12 @@
snprintf(buf, sizeof buf, "%s/%s", path, "base.tgz");
result = result && file_exists_p(buf);
- return(result);
+ if (result == 0) {
+ msg_display(MSG_badsetdir, path);
+ process_menu(MENU_ok, NULL);
+ }
+
+ return result;
}
@@ -314,47 +322,30 @@
int
get_via_cdrom(void)
{
- char tmpdir[STRSIZE];
- int retries;
/* Get CD-rom device name and path within CD-rom */
process_menu(MENU_cdromsource, NULL);
-again:
umount_mnt2();
/* Mount it */
- for (retries = 5;; --retries) {
- if (run_program(retries > 0 ? RUN_SILENT : 0,
- "/sbin/mount -rt cd9660 /dev/%s /mnt2", cdrom_dev) == 0)
+ for (;;) {
+ if (run_program(0, "/sbin/mount -rt cd9660 /dev/%s /mnt2",
+ cdrom_dev) == 0)
break;
- if (retries > 0) {
- sleep(1);
- continue;
- }
- msg_display(MSG_badsetdir, cdrom_dev);
process_menu(MENU_cdrombadmount, NULL);
if (!yesno)
- return 0;
- if (ignorerror)
- break;
+ return -1;
}
mnt2_mounted = 1;
- snprintf(tmpdir, sizeof tmpdir, "%s/%s", "/mnt2", cdrom_dir);
+ snprintf(ext_dir, sizeof ext_dir, "%s/%s", "/mnt2", set_dir);
/* Verify distribution files exist. */
- if (distribution_sets_exist_p(tmpdir) == 0) {
- msg_display(MSG_badsetdir, tmpdir);
- process_menu(MENU_cdrombadmount, NULL);
- if (!yesno)
- return (0);
- if (!ignorerror)
- goto again;
- }
+ if (distribution_sets_exist_p(ext_dir) == 0)
+ return -1;
/* return location, don't clean... */
- strlcpy(ext_dir, tmpdir, STRSIZE);
clean_dist_dir = 0;
return 1;
}
@@ -367,7 +358,6 @@
int
get_via_localfs(void)
{
- char tmpdir[STRSIZE];
/* Get device, filesystem, and filepath */
process_menu (MENU_localfssource, NULL);
@@ -388,20 +378,14 @@
}
mnt2_mounted = 1;
- snprintf(tmpdir, sizeof tmpdir, "%s/%s", "/mnt2", localfs_dir);
+ snprintf(ext_dir, sizeof ext_dir, "%s/%s/%s",
+ "/mnt2", localfs_dir, set_dir);
/* Verify distribution files exist. */
- if (distribution_sets_exist_p(tmpdir) == 0) {
- msg_display(MSG_badsetdir, tmpdir);
- process_menu(MENU_localfsbadmount, NULL);
- if (!yesno)
- return 0;
- if (!ignorerror)
- goto again;
- }
+ if (distribution_sets_exist_p(ext_dir) == 0)
+ return -1;
/* return location, don't clean... */
- strlcpy(ext_dir, tmpdir, STRSIZE);
clean_dist_dir = 0;
return 1;
}
@@ -413,33 +397,20 @@
int
get_via_localdir(void)
{
- msg errmsg;
- /* Get device, filesystem, and filepath */
+ /* Get filepath */
process_menu(MENU_localdirsource, NULL);
- /* Complain if not a directory or distribution files absent */
- for (;;) {
- /*
- * We have to have an absolute path ('cos pax runs in a
- * different directory), make it so.
- */
- if (localfs_dir[0] != '/') {
- memmove(localfs_dir + 1, localfs_dir, sizeof localfs_dir - 1);
- localfs_dir[0] = '/';
- }
- if ((errmsg = MSG_badlocalsetdir, dir_exists_p(localfs_dir)) &&
- (errmsg = MSG_badsetdir, distribution_sets_exist_p(localfs_dir)))
- break;
- process_menu(MENU_localdirbad, &errmsg);
- if (!yesno)
- return (0);
- if (ignorerror)
- break;
- }
+ /*
+ * We have to have an absolute path ('cos pax runs in a
+ * different directory), make it so.
+ */
+ 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... */
- strlcpy(ext_dir, localfs_dir, sizeof ext_dir);
clean_dist_dir = 0;
return 1;
}
@@ -667,20 +638,18 @@
free_menu(menu_no);
}
-/* Do we want a verbose extract? */
-static int verbose = -1;
-
-void
-ask_verbose_dist(void)
+static void
+ask_verbose_dist(msg setup_done)
{
- if (verbose < 0) {
- msg_display(MSG_verboseextract);
- process_menu(MENU_extract, NULL);
- verbose = yesno;
- wclear(stdscr);
- wrefresh(stdscr);
- }
+ wclear(stdscr);
+ wrefresh(stdscr);
+ if (setup_done != NULL)
+ msg_display(setup_done);
+ msg_display_add(MSG_verboseextract);
+ process_menu(MENU_extract, &verbose);
+ wclear(stdscr);
+ wrefresh(stdscr);
}
static int
@@ -696,7 +665,7 @@
tarstats.nnotfound++;
msg_display(MSG_notarfile, path);
- process_menu(MENU_noyes, NULL);
+ process_menu(MENU_noyes, deconst(MSG_notarfile_ok));
return yesno;
}
@@ -709,10 +678,10 @@
target_chdir_or_die("/");
/* now extract set files files into "./". */
- if (verbose == 1)
+ if (verbose == 0)
tarexit = run_program(RUN_DISPLAY | RUN_PROGRESS,
"progress -zf %s tar -xepf -", path);
- else if (verbose == 2)
+ else if (verbose == 1)
tarexit = run_program(RUN_DISPLAY | RUN_PROGRESS,
"tar -zxvepf %s", path);
else
@@ -801,7 +770,7 @@
* success_msg and failure_msg must both be 0-adic messages.
*/
int
-get_and_unpack_sets(int update, msg success_msg, msg failure_msg)
+get_and_unpack_sets(int update, msg setupdone_msg, msg success_msg, msg failure_msg)
{
int got_dist;
@@ -811,12 +780,11 @@
(void)fprintf(script, "mkdir /mnt2\nchmod 755 /mnt2\n");
/* Find out which files to "get" if we get files. */
- wclear(stdscr);
- wrefresh(stdscr);
/* ask user whether to do normal or verbose extraction */
- ask_verbose_dist();
+ ask_verbose_dist(setupdone_msg);
+ again:
/* Get the distribution files */
do {
process_menu(MENU_distmedium, &got_dist);
@@ -831,9 +799,9 @@
return 1;
}
- /* Extract the distribution, abort on errors. */
+ /* Extract the distribution, retry from top on errors. */
if (extract_dist(update))
- return 1;
+ goto again;
/* Configure the system */
if (sets_installed & SET_ETC)
Home |
Main Index |
Thread Index |
Old Index