* Change the interface of run_prog: use a flags argument instead of

seperate booleans. Add flags to run as a plain 'system()' command,
  fullscreen (but on a pty), and chrooted, and implement their
  functionality. Add a bit of TIOCPKT handling code to handle
  programs messing with term settings better.
* Ask to set the root password at the end of an install.
* Remove a few unneeded comments.
* Sprinkle some touchwin() calls here and there to make the output cleaner.
  They shouldn't really be needed, but even normal usage (no syslog
  messages) even left the screen messy sometimes.
* Change some messages around that were apparently swapped by accident and
  thus caused confusion.
This commit is contained in:
fvdl 2000-10-11 23:47:55 +00:00
parent 3fd1dc7ed3
commit 30b8888d4a
27 changed files with 260 additions and 180 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.21 2000/10/02 12:05:10 fvdl Exp $ */
/* $NetBSD: md.c,v 1.22 2000/10/11 23:47:57 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -135,7 +135,7 @@ int md_post_newfs (void)
{
printf (msg_string(MSG_dobootblks), diskdev);
cp_to_target("/usr/mdec/boot", "/boot");
run_prog(0, 1, "Warning: disk is probably not bootable",
run_prog(RUN_DISPLAY, "Warning: disk is probably not bootable",
"/usr/mdec/installboot /dev/r%sc /usr/mdec/bootxx_ffs", diskdev);
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.3 2000/10/02 12:05:11 fvdl Exp $ */
/* $NetBSD: md.c,v 1.4 2000/10/11 23:47:58 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -81,7 +81,7 @@ md_post_newfs(void)
{
/* boot blocks ... */
msg_display(MSG_dobootblks, diskdev);
return run_prog(0, 1, NULL,
return run_prog(RUN_DISPLAY, NULL,
"/usr/mdec/installboot -v /usr/mdec/xxboot /dev/r%sa",
diskdev);
}
@ -132,10 +132,10 @@ md_cleanup_install(void)
(void)fprintf(script, "%s\n", sedcmd);
do_system(sedcmd);
run_prog(1, 0, NULL, "mv -f %s %s", realto, realfrom);
run_prog(0, 0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.profile"));
run_prog(RUN_FATAL, NULL, "mv -f %s %s", realto, realfrom);
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.25 2000/10/02 12:05:11 fvdl Exp $ */
/* $NetBSD: md.c,v 1.26 2000/10/11 23:47:58 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -283,7 +283,7 @@ int md_post_newfs (void)
#if 0
/* XXX boot blocks ... */
printf(msg_string(MSG_dobootblks), diskdev);
run_prog(0, 1, NULL, "/sbin/disklabel -B %s /dev/r%sc",
run_prog(RUN_DISPLAY, NULL, "/sbin/disklabel -B %s /dev/r%sc",
"-b /usr/mdec/rzboot -s /usr/mdec/bootrz", diskdev);
#endif
return 0;
@ -509,10 +509,10 @@ md_cleanup_install(void)
if (scripting)
(void)fprintf(script, "%s\n", sedcmd);
do_system(sedcmd);
run_prog(1, 0, NULL, "mv -f %s %s", realto, realfrom);
run_prog(0, 0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.profile"));
run_prog(RUN_FATAL, NULL, "mv -f %s %s", realto, realfrom);
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
#endif
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.17 2000/10/02 12:05:11 fvdl Exp $ */
/* $NetBSD: md.c,v 1.18 2000/10/11 23:47:58 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -80,7 +80,8 @@ int md_post_disklabel(void)
/* Sector forwarding / badblocks ... */
if (*doessf) {
printf ("%s", msg_string (MSG_dobad144));
return run_prog(0, 1, NULL, "/usr/sbin/bad144 %s 0", diskdev);
return run_prog(RUN_DISPLAY, NULL, "/usr/sbin/bad144 %s 0",
diskdev);
}
return 0;
}
@ -89,7 +90,8 @@ int md_post_newfs(void)
{
/* boot blocks ... */
printf (msg_string(MSG_dobootblks), diskdev);
run_prog (0, 1, NULL, "/usr/mdec/installboot -v /usr/mdec/biosboot.sym "
run_prog (RUN_DISPLAY, NULL,
"/usr/mdec/installboot -v /usr/mdec/biosboot.sym "
"/dev/r%sa", diskdev);
return 0;
}
@ -102,7 +104,7 @@ int md_copy_filesystem (void)
/* Copy the instbin(s) to the disk */
printf ("%s", msg_string(MSG_dotar));
if (run_prog (0, 1, NULL, "pax -X -r -w -pe / /mnt") != 0)
if (run_prog (RUN_DISPLAY, NULL, "pax -X -r -w -pe / /mnt") != 0)
return 1;
/* Copy next-stage install profile into target /.profile. */
@ -288,7 +290,7 @@ editlab:
msg_prompt (MSG_packname, "mydisk", bsddiskname, DISKNAME_SIZE);
/* Create the disktab.preinstall */
run_prog (0, 0, NULL, "cp /etc/disktab.preinstall /etc/disktab");
run_prog (0, NULL, "cp /etc/disktab.preinstall /etc/disktab");
#ifdef DEBUG
f = fopen ("/tmp/disktab", "a");
#else
@ -355,10 +357,10 @@ md_cleanup_install(void)
(void)fprintf(script, "%s\n", sedcmd);
do_system(sedcmd);
run_prog(1, 0, NULL, "mv -f %s %s", realto, realfrom);
run_prog(0, 0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.profile"));
run_prog(RUN_FATAL, NULL, "mv -f %s %s", realto, realfrom);
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.6 2000/10/02 12:05:11 fvdl Exp $ */
/* $NetBSD: md.c,v 1.7 2000/10/11 23:47:58 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -203,7 +203,8 @@ md_post_disklabel(void)
/* Sector forwarding / badblocks ... */
if (*doessf) {
msg_display(MSG_dobad144);
return run_prog(0, 1, NULL, "/usr/sbin/bad144 %s 0", diskdev);
return run_prog(RUN_DISPLAY, NULL, "/usr/sbin/bad144 %s 0",
diskdev);
}
return 0;
}
@ -216,7 +217,7 @@ md_post_newfs(void)
#else
/* boot blocks ... */
msg_display(MSG_dobootblks, diskdev);
return run_prog(0, 1, NULL,
return run_prog(RUN_DISPLAY, NULL,
"/usr/mdec/installboot -v /usr/mdec/biosboot.sym /dev/r%sa",
diskdev);
#endif
@ -416,7 +417,7 @@ custom: ask_sizemult(dlcylsize);
msg_prompt (MSG_packname, "mydisk", bsddiskname, DISKNAME_SIZE);
/* Create the disktab.preinstall */
run_prog (0, 0, NULL, "cp /etc/disktab.preinstall /etc/disktab");
run_prog (0, NULL, "cp /etc/disktab.preinstall /etc/disktab");
#ifdef DEBUG
f = fopen ("/tmp/disktab", "a");
#else
@ -512,10 +513,10 @@ md_cleanup_install(void)
(void)fprintf(script, "%s\n", sedcmd);
do_system(sedcmd);
run_prog(1, 0, NULL, "mv -f %s %s", realto, realfrom);
run_prog(0, 0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.profile"));
run_prog(RUN_FATAL, NULL, "mv -f %s %s", realto, realfrom);
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.42 2000/10/11 22:58:17 fvdl Exp $ */
/* $NetBSD: md.c,v 1.43 2000/10/11 23:47:59 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -199,7 +199,8 @@ md_post_disklabel(void)
/* Sector forwarding / badblocks ... */
if (*doessf) {
msg_display(MSG_dobad144);
return run_prog(0, 1, NULL, "/usr/sbin/bad144 %s 0", diskdev);
return run_prog(RUN_DISPLAY, NULL, "/usr/sbin/bad144 %s 0",
diskdev);
}
return 0;
}
@ -209,7 +210,7 @@ md_post_newfs(void)
{
/* boot blocks ... */
msg_display(MSG_dobootblks, diskdev);
return run_prog(0, 1, NULL,
return run_prog(RUN_DISPLAY, NULL,
"/usr/mdec/installboot -v /usr/mdec/biosboot.sym /dev/r%sa",
diskdev);
}
@ -403,6 +404,7 @@ custom: ask_sizemult(dlcylsize);
/* Disk name */
msg_prompt (MSG_packname, "mydisk", bsddiskname, DISKNAME_SIZE);
/* Create the disktab.preinstall */
#ifdef DEBUG
f = fopen ("/tmp/disktab", "a");
#else
@ -519,7 +521,7 @@ md_cleanup_install(void)
(void)fprintf(script, "%s\n", cmd);
do_system(cmd);
run_prog(1, 0, NULL, "mv -f %s %s", realto, realfrom);
run_prog(RUN_FATAL, NULL, "mv -f %s %s", realto, realfrom);
/*
* For GENERIC_TINY, do not enable any extra screens or wsmux.
@ -546,11 +548,11 @@ md_cleanup_install(void)
if (scripting)
(void)fprintf(script, "%s\n", cmd);
do_system(cmd);
run_prog(1, 0, NULL, "mv -f %s %s", realto, realfrom);
run_prog(RUN_FATAL, NULL, "mv -f %s %s", realto, realfrom);
run_prog(0, 0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.profile"));
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
}
int
@ -784,7 +786,7 @@ handle_aout_libs(const char *dir, int op, const void *arg)
n++;
break;
case LIB_MOVE:
run_prog(0, 0, NULL, "mv -f %s %s/%s",
run_prog(0, NULL, "mv -f %s %s/%s",
fullname, destdir, dp->d_name);
break;
}
@ -835,7 +837,7 @@ move_aout_libs()
* move it out of the way.
*/
strcpy(src, concat_paths(prefix, "aout"));
run_prog(0, 0, NULL, "mv -f %s %s", src,
run_prog(0, NULL, "mv -f %s %s", src,
concat_paths(prefix, "aout.old"));
/*
@ -844,8 +846,8 @@ move_aout_libs()
* avoid overflowing the root partition.
*/
strcpy(prefix, target_expand("/usr/aout"));
run_prog(1, 0, MSG_aoutfail, "mkdir -p %s", prefix);
run_prog(1, 0, MSG_aoutfail, "ln -s %s %s",
run_prog(RUN_FATAL, MSG_aoutfail, "mkdir -p %s", prefix);
run_prog(RUN_FATAL, MSG_aoutfail, "ln -s %s %s",
"/usr/aout", src);
domove:
@ -859,18 +861,18 @@ domove:
* and ld.so respectively will find them.
*/
strcpy(src, concat_paths(prefix, "usr/lib"));
run_prog(0, 0, NULL, "mv -f %s %s", src,
run_prog(0, NULL, "mv -f %s %s", src,
concat_paths(prefix, "usr/lib.old"));
strcpy(src, concat_paths(prefix, "etc/ld.so.conf"));
run_prog(0, 0, NULL, "mv -f %s %s", src,
run_prog(0, NULL, "mv -f %s %s", src,
concat_paths(prefix, "etc/ld.so.conf.old"));
run_prog(1, 0, MSG_aoutfail, "mkdir -p %s ",
run_prog(RUN_FATAL, MSG_aoutfail, "mkdir -p %s ",
concat_paths(prefix, "usr/lib"));
run_prog(1, 0, MSG_aoutfail, "mkdir -p %s ",
run_prog(RUN_FATAL, MSG_aoutfail, "mkdir -p %s ",
concat_paths(prefix, "etc"));
strcpy(src, target_expand("/etc/ld.so.conf"));
run_prog(1, 0, MSG_aoutfail, "mv -f %s %s", src,
run_prog(RUN_FATAL, MSG_aoutfail, "mv -f %s %s", src,
concat_paths(prefix, "etc/ld.so.conf"));
strcpy(src, target_expand("/usr/lib"));

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.14 2000/10/02 12:05:11 fvdl Exp $ */
/* $NetBSD: md.c,v 1.15 2000/10/11 23:47:59 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -709,7 +709,7 @@ md_copy_filesystem(void)
/* Copy the instbin(s) to the disk */
msg_display(MSG_dotar);
if (run_prog (0, 0, NULL, "pax -X -r -w -pe / /mnt") != 0)
if (run_prog (0, NULL, "pax -X -r -w -pe / /mnt") != 0)
return 1;
/* Copy next-stage install profile into target /.profile. */
@ -806,7 +806,7 @@ md_make_bsd_partitions(void)
strcpy (bsddiskname, diskdev);
/* Create the disktab.preinstall */
run_prog (0, 0, NULL, "cp /etc/disktab.preinstall /etc/disktab");
run_prog (0, NULL, "cp /etc/disktab.preinstall /etc/disktab");
#ifdef DEBUG
f = fopen ("/tmp/disktab", "a");
#else
@ -881,10 +881,10 @@ md_cleanup_install(void)
(void)fprintf(script, "%s\n", sedcmd);
do_system(sedcmd);
run_prog(1, 0, NULL, "mv -f %s %s", realto, realfrom);
run_prog(0, 0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.profile"));
run_prog(RUN_FATAL, NULL, "mv -f %s %s", realto, realfrom);
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.16 2000/10/02 12:05:11 fvdl Exp $ */
/* $NetBSD: md.c,v 1.17 2000/10/11 23:47:59 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -141,7 +141,7 @@ md_post_newfs()
printf (msg_string(MSG_dobootblks), diskdev);
cp_to_target("/usr/mdec/ofwboot", "/boot");
sync();
run_prog(0, 1, NULL, "/usr/mdec/installboot %s %s /dev/r%sa",
run_prog(RUN_DISPLAY, NULL, "/usr/mdec/installboot %s %s /dev/r%sa",
bootfile, "/usr/mdec/bootxx", diskdev);
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.4 2000/10/02 12:05:11 fvdl Exp $ */
/* $NetBSD: md.c,v 1.5 2000/10/11 23:47:59 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -141,7 +141,7 @@ md_post_newfs()
printf (msg_string(MSG_dobootblks), diskdev);
cp_to_target("/usr/mdec/boot", "/boot");
sync();
run_prog(0, 1, NULL, "/usr/mdec/installboot %s %s /dev/r%sc",
run_prog(RUN_DISPLAY, NULL, "/usr/mdec/installboot %s %s /dev/r%sc",
bootfile, "/usr/mdec/bootxx", diskdev);
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.40 2000/10/02 12:05:12 fvdl Exp $ */
/* $NetBSD: md.c,v 1.41 2000/10/11 23:48:00 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -153,7 +153,7 @@ md_post_newfs(void)
printf(msg_string(MSG_dobootblks), diskdev);
cp_to_target("/usr/mdec/boot.pmax", "/boot.pmax");
run_prog(0, 1, "Warning: disk is probably not bootable",
run_prog(RUN_DISPLAY, "Warning: disk is probably not bootable",
"/usr/mdec/installboot /dev/r%sc /usr/mdec/bootxx_ffs", diskdev);
return 0;
}
@ -216,11 +216,11 @@ md_cleanup_install(void)
(void)fprintf(script, "%s\n", sedcmd);
do_system(sedcmd);
run_prog(1, 0, NULL, "mv -f %s %s", realto, realfrom);
run_prog(RUN_FATAL, NULL, "mv -f %s %s", realto, realfrom);
run_prog(0, 0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.profile"));
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.20 2000/10/02 12:05:12 fvdl Exp $ */
/* $NetBSD: md.c,v 1.21 2000/10/11 23:48:00 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -147,8 +147,8 @@ md_post_newfs(void)
/* boot blocks ... */
msg_display(MSG_dobootblks, diskdev);
return (run_prog(0, 1, NULL, "/sbin/disklabel -W %s", diskdev) ||
run_prog(0, 1, NULL, "/usr/mdec/binstall ffs /mnt"));
return (run_prog(RUN_DISPLAY, NULL, "/sbin/disklabel -W %s", diskdev) ||
run_prog(RUN_DISPLAY, NULL, "/usr/mdec/binstall ffs /mnt"));
}
/*
@ -209,11 +209,11 @@ md_cleanup_install(void)
(void)fprintf(script, "%s\n", sedcmd);
do_system(sedcmd);
run_prog(1, 0, NULL, "mv -f %s %s", realto, realfrom);
run_prog(RUN_FATAL, NULL, "mv -f %s %s", realto, realfrom);
run_prog(0, 0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.profile"));
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.3 2000/10/02 12:05:12 fvdl Exp $ */
/* $NetBSD: md.c,v 1.4 2000/10/11 23:48:00 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -140,8 +140,8 @@ md_post_newfs(void)
/* boot blocks ... */
msg_display(MSG_dobootblks, diskdev);
return (run_prog(0, 1, NULL, "/sbin/disklabel -W %s", diskdev) ||
run_prog(0, 1, NULL, "/usr/mdec/binstall ffs /mnt"));
return (run_prog(RUN_DISPLAY, NULL, "/sbin/disklabel -W %s", diskdev) ||
run_prog(RUN_DISPLAY, NULL, "/usr/mdec/binstall ffs /mnt"));
}
/*
@ -202,11 +202,11 @@ md_cleanup_install(void)
(void)fprintf(script, "%s\n", sedcmd);
do_system(sedcmd);
run_prog(1, 0, NULL, "mv -f %s %s", realto, realfrom);
run_prog(RUN_FATAL, NULL, "mv -f %s %s", realto, realfrom);
run_prog(0, 0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.profile"));
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.12 2000/10/02 12:05:12 fvdl Exp $ */
/* $NetBSD: md.c,v 1.13 2000/10/11 23:48:01 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -139,7 +139,7 @@ md_post_newfs(void)
{
printf(msg_string(MSG_dobootblks), diskdev);
run_prog(0, 0, NULL, "/sbin/disklabel -B %s", diskdev);
run_prog(0, NULL, "/sbin/disklabel -B %s", diskdev);
return 0;
}
@ -201,11 +201,11 @@ md_cleanup_install(void)
(void)fprintf(script, "%s\n", sedcmd);
do_system(sedcmd);
run_prog(1, 0, NULL, "mv -f %s %s", realto, realfrom);
run_prog(RUN_FATAL, NULL, "mv -f %s %s", realto, realfrom);
run_prog(0, 0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.profile"));
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.9 2000/10/02 12:05:12 fvdl Exp $ */
/* $NetBSD: md.c,v 1.10 2000/10/11 23:48:01 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -203,7 +203,8 @@ md_newdisk(void)
{
msg_display(MSG_newdisk, diskdev, diskdev);
return run_prog(1, 1, MSG_NONE, "/usr/mdec/newdisk -v %s", diskdev);
return run_prog(RUN_FATAL|RUN_DISPLAY, MSG_NONE,
"/usr/mdec/newdisk -v %s", diskdev);
}
/*
@ -240,7 +241,7 @@ md_post_newfs(void)
{
/* boot blocks ... */
msg_display(MSG_dobootblks, diskdev);
return run_prog(0, 1, NULL,
return run_prog(RUN_DISPLAY, NULL,
"/usr/mdec/installboot /usr/mdec/sdboot /dev/r%sa",
diskdev);
}
@ -329,11 +330,11 @@ md_cleanup_install(void)
(void)fprintf(script, "%s\n", sedcmd);
do_system(sedcmd);
run_prog(1, 0, NULL, "mv -f %s %s", realto, realfrom);
run_prog(RUN_FATAL, NULL, "mv -f %s %s", realto, realfrom);
#endif
run_prog(0, 0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, 0, NULL, "rm -f %s", target_expand("/.profile"));
run_prog(0, NULL, "rm -f %s", target_expand("/sysinst"));
run_prog(0, NULL, "rm -f %s", target_expand("/.termcap"));
run_prog(0, NULL, "rm -f %s", target_expand("/.profile"));
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: defs.h,v 1.62 2000/10/11 11:06:03 fvdl Exp $ */
/* $NetBSD: defs.h,v 1.63 2000/10/11 23:47:55 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -66,6 +66,13 @@
#define T_FILE 0
#define T_OUTPUT 1
/* run_prog flags */
#define RUN_DISPLAY 0x0001 /* run in subwindow */
#define RUN_FATAL 0x0002 /* errors are fatal */
#define RUN_CHROOT 0x0004 /* chroot to target disk */
#define RUN_FULLSCREEN 0x0008 /* fullscreen (use with RUN_DISPLAY) */
#define RUN_SYSTEM 0x0010 /* just use system(3) */
/* Macros */
/* Round up to the next full cylinder size */
@ -304,7 +311,7 @@ void mnt_net_config __P((void));
/* From run.c */
int collect __P((int kind, char **buffer, const char *name, ...));
int run_prog __P((int, int, msg, const char *, ...));
int run_prog __P((int, msg, const char *, ...));
void do_logging __P((void));
int do_system __P((const char *));
@ -334,6 +341,7 @@ void ask_verbose_dist __P((void));
int get_and_unpack_sets(msg success_msg, msg failure_msg);
int sanity_check __P((void));
int set_timezone __P((void));
int set_root_password __P((void));
/* from target.c */
int must_mount_root __P((void));

View File

@ -1,4 +1,4 @@
/* $NetBSD: disks.c,v 1.32 2000/09/27 12:42:04 fvdl Exp $ */
/* $NetBSD: disks.c,v 1.33 2000/10/11 23:47:55 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -232,7 +232,7 @@ int write_disklabel (void)
#ifdef DISKLABEL_CMD
/* disklabel the disk */
return run_prog(0, 1, MSG_cmdfail,
return run_prog(RUN_DISPLAY, MSG_cmdfail,
"%s %s %s", DISKLABEL_CMD, diskdev, bsddiskname);
#endif
return 0;
@ -271,7 +271,7 @@ do_ffs_newfs(const char *partname, int partno, const char *mountpoint)
char devname[STRSIZE];
int error;
error = run_prog(0, 1, MSG_cmdfail,
error = run_prog(RUN_DISPLAY, MSG_cmdfail,
"/sbin/newfs /dev/r%s", partname);
if (*mountpoint && error == 0) {
snprintf(devname, STRSIZE, "/dev/%s", partname);
@ -441,9 +441,9 @@ do_fsck(const char *diskpart)
/*endwin();*/
#ifndef DEBUG_SETS
err = run_prog(0, 1, NULL, "/sbin/fsck_ffs %s%s", upgr, raw);
err = run_prog(RUN_DISPLAY, NULL, "/sbin/fsck_ffs %s%s", upgr, raw);
#else
err = run_prog(0, 1, NULL, "/sbin/fsck_ffs -f %s%s", upgr, raw);
err = run_prog(RUN_DISPLAY, NULL, "/sbin/fsck_ffs -f %s%s", upgr, raw);
#endif
wrefresh(stdscr);
return err;
@ -609,7 +609,7 @@ set_swap(dev, pp, enable)
for (i = 0; i < maxpart; i++) {
if (pp[i].pi_fstype == FS_SWAP) {
if (run_prog(0, 0, NULL,
if (run_prog(0, NULL,
"/sbin/swapctl -%c /dev/%s%c",
enable ? 'a' : 'd', dev, 'a' + i) != 0)
return -1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: install.c,v 1.22 2000/09/27 12:42:04 fvdl Exp $ */
/* $NetBSD: install.c,v 1.23 2000/10/11 23:47:55 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -132,10 +132,12 @@ do_install()
wrefresh(stdscr);
/* Unpack the distribution. */
if (get_and_unpack_sets(MSG_instcomplete, MSG_abortinst) != 0)
if (get_and_unpack_sets(MSG_extractcomplete, MSG_abortinst) != 0)
return;
set_timezone();
set_root_password();
sanity_check();

View File

@ -1,4 +1,4 @@
/* $NetBSD: label.c,v 1.15 2000/10/11 22:58:17 fvdl Exp $ */
/* $NetBSD: label.c,v 1.16 2000/10/11 23:47:56 fvdl Exp $ */
/*
* Copyright 1997 Jonathan Stone
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: label.c,v 1.15 2000/10/11 22:58:17 fvdl Exp $");
__RCSID("$NetBSD: label.c,v 1.16 2000/10/11 23:47:56 fvdl Exp $");
#endif
#include <sys/types.h>
@ -209,6 +209,7 @@ savenewlabel(lp, nparts)
#ifdef DEBUG
f = fopen("/tmp/disktab", "a");
#else
/* Create the disktab.preinstall */
f = fopen("/etc/disktab", "w");
#endif
if (logging)

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.21 2000/10/02 09:26:26 fvdl Exp $ */
/* $NetBSD: main.c,v 1.22 2000/10/11 23:47:56 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -223,7 +223,7 @@ cleanup()
(void)time(&tloc);
unwind_mounts();
run_prog(0, 0, NULL, "/sbin/umount /mnt2");
run_prog(0, NULL, "/sbin/umount /mnt2");
endwin();
if (logging) {
fprintf(log, "Log ended at: %s\n", asctime(localtime(&tloc)));

View File

@ -1,4 +1,4 @@
/* $NetBSD: menus.mi.en,v 1.43 2000/08/15 01:08:00 hubertf Exp $ */
/* $NetBSD: menus.mi.en,v 1.44 2000/10/11 23:47:56 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -70,13 +70,13 @@ menu netbsd, title "NetBSD-@@VERSION@@ Install System",
option "Re-install sets or install additional sets",
action { do_reinstall_sets(); };
option "Reboot the computer", exit,
action (endwin) { run_prog(0, 0, NULL, "/sbin/reboot"); };
action (endwin) { run_prog(0, NULL, "/sbin/reboot"); };
option "Utility menu", sub menu utility;
menu utility, title "NetBSD-@@VERSION@@ Utilities", exit;
option "Run /bin/sh",
action (endwin) { system("/bin/sh"); };
/* option "test", action { run_prog(0, 1, NULL, "/bin/pwd"); }; */
/* option "test", action { run_prog(RUN_DISPLAY, NULL, "/bin/pwd"); }; */
option "Set timezone",
action {
set_timezone();
@ -91,7 +91,7 @@ menu utility, title "NetBSD-@@VERSION@@ Utilities", exit;
/* option "Partition a disk"; XXX add later. */
option "Logging functions", action { do_logging(); };
option "Halt the system", exit,
action { run_prog(0, 0, NULL, "/sbin/halt"); };
action { run_prog(0, NULL, "/sbin/halt"); };
menu yesno, title "yes or no?";
option "Yes", exit, action {yesno = 1;};

View File

@ -1,4 +1,4 @@
/* $NetBSD: menus.mi.fr,v 1.29 2000/07/06 20:25:26 jhawk Exp $ */
/* $NetBSD: menus.mi.fr,v 1.30 2000/10/11 23:47:56 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -69,12 +69,12 @@ menu netbsd, title "NetBSD-@@VERSION@@ Programme d'installation",
option "Réinstaller ou installer de nouveaux composants",
action { do_reinstall_sets(); };
option "Redémarrer l'ordinateur", exit,
action (endwin) { run_prog(0, 0, NULL, "/sbin/reboot"); };
action (endwin) { run_prog(0, NULL, "/sbin/reboot"); };
option "Menu utilitaire", sub menu utility;
menu utility, title "Utilitaires NetBSD-@@VERSION@@", exit;
/* option "test", action { run_prog(0, 1, NULL, "/bin/pwd"); }; */
/* option "testfalse", action { run_prog(0, 0, "%s: kaput", "/bin/false"); }; */
/* option "test", action { run_prog(RUN_DISPLAY, NULL, "/bin/pwd"); }; */
/* option "testfalse", action { run_prog(0, "%s: kaput", "/bin/false"); }; */
option "Exécuter /bin/sh",
action (endwin) { system("/bin/sh"); };
option "Configuration du réseau",
@ -87,7 +87,7 @@ menu utility, title "Utilitaires NetBSD-@@VERSION@@", exit;
/* option "Partitioner un disque"; XXX add later. */
option "Traces", action { do_logging(); };
option "Arrêter le système", exit,
action (endwin) { run_prog(0, 0, NULL, "/sbin/halt"); };
action (endwin) { run_prog(0, NULL, "/sbin/halt"); };
menu yesno, title "oui ou non?";
option "Oui", exit, action {yesno = 1;};

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.mi.en,v 1.71 2000/10/11 11:06:47 fvdl Exp $ */
/* $NetBSD: msg.mi.en,v 1.72 2000/10/11 23:47:56 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -319,16 +319,23 @@ message dotarfail
{The bootstrapping binaries and config file installation failed.
Can't continue ...}
message extractcomplete
{The extraction of the selected sets for NetBSD-@@VERSION@@ is complete.
The system is now able to boot from the selected harddisk. To complete
the installation, sysinst will give you the opportunity to configure
some essential things first.
}
message instcomplete
{The installation of NetBSD-@@VERSION@@ is now complete. The system
should boot from hard disk. Follow the instructions in the INSTALL
document about final configuration of your system.
At a minimum, you should set a root password and edit /etc/rc.conf to
match your needs. See /etc/default/rc.conf for the default values.
At a minimum, you should edit /etc/rc.conf to match your needs. See
/etc/default/rc.conf for the default values.
}
message unpackcomplete
message upgrcomplete
{The upgrade to NetBSD-@@VERSION@@ is now complete. You will
now need to follow the instructions in the INSTALL document as to
what you need to do to get your system reconfigured for your
@ -339,7 +346,7 @@ rc_configured=NO to rc_configured=YES or reboots will stop at single-user.
}
message upgrcomplete
message unpackcomplete
{Unpacking additional release sets of NetBSD-@@VERSION@@ is now
complete. Unpacking sets has clobbered the target /etc. Any /etc.old
saved by an earlier upgrade was not touched. You will now need to
@ -787,3 +794,6 @@ an error, please restart the system and try again.}
message swapdelfailed
{Sysinst failed to deactivate the swap partition on the disk that you
chose for installation. Please reboot and try again.}
message rootpw
{Do you want to set a root password for the system now?}

View File

@ -1,4 +1,4 @@
/* $NetBSD: net.c,v 1.63 2000/09/26 13:26:02 fvdl Exp $ */
/* $NetBSD: net.c,v 1.64 2000/10/11 23:47:56 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -588,7 +588,7 @@ again:
fclose(f);
}
run_prog(0, 0, NULL, "/sbin/ifconfig lo0 127.0.0.1");
run_prog(0, NULL, "/sbin/ifconfig lo0 127.0.0.1");
/*
* ifconfig does not allow media specifiers on IFM_MANUAL interfaces.
@ -608,26 +608,26 @@ again:
}
if (*net_media != '\0')
run_prog(0, 1, NULL, "/sbin/ifconfig %s media %s",
run_prog(0, NULL, "/sbin/ifconfig %s media %s",
net_dev, net_media);
#ifdef INET6
if (v6config) {
init_v6kernel(1);
run_prog(0, 0, NULL, "/sbin/ifconfig %s up", net_dev);
run_prog(0, NULL, "/sbin/ifconfig %s up", net_dev);
sleep(get_v6wait() + 1);
run_prog(0, 1, NULL, "/sbin/rtsol -D %s", net_dev);
run_prog(RUN_DISPLAY, NULL, "/sbin/rtsol -D %s", net_dev);
sleep(get_v6wait() + 1);
}
#endif
if (strcmp(net_ip, "") != 0) {
if (strcmp(net_mask, "") != 0) {
run_prog(0, 0, NULL,
run_prog(0, NULL,
"/sbin/ifconfig %s inet %s netmask %s",
net_dev, net_ip, net_mask);
} else {
run_prog(0, 0, NULL,
run_prog(0, NULL,
"/sbin/ifconfig %s inet %s", net_dev, net_ip);
}
}
@ -638,9 +638,9 @@ again:
/* Set a default route if one was given */
if (strcmp(net_defroute, "") != 0) {
run_prog(0, 0, NULL,
run_prog(0, NULL,
"/sbin/route -n flush -inet");
run_prog(0, 0, NULL,
run_prog(0, NULL,
"/sbin/route -n add default %s",
net_defroute);
}
@ -652,22 +652,22 @@ again:
#ifdef INET6
if (v6config && network_up) {
network_up = !run_prog(0, 1, NULL,
network_up = !run_prog(0, NULL,
"/sbin/ping6 -v -c 3 -n -I %s ff02::2", net_dev);
if (strcmp(net_namesvr6, "") != 0)
network_up = !run_prog(0, 1, NULL,
network_up = !run_prog(RUN_DISPLAY, NULL,
"/sbin/ping6 -v -c 3 -n %s", net_namesvr6);
}
#endif
if (strcmp(net_namesvr, "") != 0 && network_up)
network_up = !run_prog(0, 1, NULL,
network_up = !run_prog(0, NULL,
"/sbin/ping -v -c 5 -w 5 -o -n %s",
net_namesvr);
if (strcmp(net_defroute, "") != 0 && network_up)
network_up = !run_prog(0, 1, NULL,
network_up = !run_prog(0, NULL,
"/sbin/ping -v -c 5 -w 5 -o -n %s",
net_defroute);
fflush(NULL);
@ -722,14 +722,14 @@ get_via_ftp()
* unsafe by a strict reading of RFC 1738).
*/
if (strcmp ("ftp", ftp_user) == 0)
ret = run_prog(0, 1, NULL,
ret = run_prog(RUN_DISPLAY, NULL,
"/usr/bin/ftp -a ftp://%s/%s/%s",
ftp_host,
url_encode(ftp_dir_encoded, ftp_dir, STRSIZE,
RFC1738_SAFE_LESS_SHELL_PLUS_SLASH, 1),
filename);
else {
ret = run_prog(0, 1, NULL,
ret = run_prog(RUN_DISPLAY, NULL,
"/usr/bin/ftp ftp://%s:%s@%s/%s/%s",
url_encode(ftp_user_encoded, ftp_user, STRSIZE,
RFC1738_SAFE_LESS_SHELL, 0),
@ -745,6 +745,7 @@ get_via_ftp()
msg_display(MSG_ftperror_cont);
getchar();
puts(CL); /* XXX */
touchwin(stdscr);
wclear(stdscr);
wrefresh(stdscr);
msg_display(MSG_ftperror);
@ -758,6 +759,7 @@ get_via_ftp()
}
puts(CL); /* XXX */
touchwin(stdscr);
wclear(stdscr);
wrefresh(stdscr);
#ifndef DEBUG
@ -784,11 +786,11 @@ get_via_nfs()
process_menu(MENU_nfssource);
again:
run_prog(0, 0, NULL,
run_prog(0, NULL,
"/sbin/umount /mnt2");
/* Mount it */
if (run_prog(0, 0, NULL,
if (run_prog(0, NULL,
"/sbin/mount -r -o -i,-r=1024 -t nfs %s:%s /mnt2",
nfs_host, nfs_dir)) {
msg_display(MSG_nfsbadmount, nfs_host, nfs_dir);
@ -968,7 +970,7 @@ char *inter;
process_menu(MENU_dhcpautoconf);
if (yesno) {
/* spawn off dhclient and wait for parent to exit */
dhcpautoconf = run_prog(0, 1, NULL, "%s -pf /tmp/dhclient.pid -lf /tmp/dhclient.leases %s", DHCLIENT_EX,inter);
dhcpautoconf = run_prog(RUN_DISPLAY, NULL, "%s -pf /tmp/dhclient.pid -lf /tmp/dhclient.leases %s", DHCLIENT_EX,inter);
return dhcpautoconf?0:1;
}
return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: run.c,v 1.31 2000/08/15 01:08:00 hubertf Exp $ */
/* $NetBSD: run.c,v 1.32 2000/10/11 23:47:56 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -71,7 +71,7 @@
* local prototypes
*/
char* va_prog_cmdstr __P((const char *cmd, va_list ap));
int launch_subwin __P((WINDOW *actionwin, char **args, struct winsize win, int display));
int launch_subwin __P((WINDOW *actionwin, char **args, struct winsize *win, int display));
int log_flip __P((menudesc *));
int script_flip __P((menudesc *));
@ -259,11 +259,11 @@ va_prog_cmdstr(const char *cmd, va_list ap)
*/
int
launch_subwin(actionwin, args, win, display)
launch_subwin(actionwin, args, win, flags)
WINDOW *actionwin;
char **args;
struct winsize win;
int display;
struct winsize *win;
int flags;
{
int xcor,ycor;
int n, i, j;
@ -274,6 +274,7 @@ launch_subwin(actionwin, args, win, display)
pid_t child, subchild, pid;
char ibuf[MAXBUF], obuf[MAXBUF];
char *command, *p, *argzero, **origargs;
char pktdata;
struct termios rtt;
struct termios tt;
@ -288,15 +289,19 @@ launch_subwin(actionwin, args, win, display)
strcat(command, " ");
}
(void)tcgetattr(STDIN_FILENO, &tt);
if (openpty(&master, &slave, NULL, &tt, &win) == -1)
if (openpty(&master, &slave, NULL, &tt, win) == -1)
return(1);
#if 0
rtt = tt;
rtt.c_lflag &= ~ECHO;
rtt.c_lflag |= (ICANON|ECHO);
(void)tcsetattr(STDIN_FILENO, TCSAFLUSH, &rtt);
#endif
rtt = tt;
/* ignore tty signals until we're done with subprocess setup */
endwin();
ttysig_ignore = 1;
ioctl(master, TIOCPKT, &ttysig_ignore);
switch(child=fork()) {
case -1:
@ -319,6 +324,9 @@ launch_subwin(actionwin, args, win, display)
(void)close(master);
close(dataflow[1]);
close(dataflow[0]);
rtt = tt;
rtt.c_lflag |= (ICANON|ECHO);
(void)tcsetattr(slave, TCSANOW, &rtt);
login_tty(slave);
if (logging) {
fprintf(log, "executing: %s\n", command);
@ -330,6 +338,12 @@ launch_subwin(actionwin, args, win, display)
fflush(script);
fclose(script);
}
/*
* 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());
execvp(argzero, origargs);
/* the parent will see this as the output from the
child */
@ -368,10 +382,19 @@ launch_subwin(actionwin, args, win, display)
} else for (i = 0; i < FD_SETSIZE; ++i) {
if (FD_ISSET (i, &read_fd_set)) {
n = read(i, ibuf, MAXBUF);
if (i == STDIN_FILENO)
if (i == STDIN_FILENO) {
(void)write(master, ibuf, n);
for (j=0; j < n; j++) {
if (display) {
if ((rtt.c_lflag & ECHO) == 0)
goto enddisp;
}
pktdata = ibuf[0];
if (pktdata != 0 && i != STDIN_FILENO) {
if (pktdata & TIOCPKT_IOCTL)
rtt = *(struct termios *)ibuf;
goto enddisp;
}
for (j=1; j < n; j++) {
if ((flags & RUN_DISPLAY) != 0) {
switch (ibuf[j]) {
case '\n':
getyx(actionwin, ycor, xcor);
@ -398,7 +421,8 @@ launch_subwin(actionwin, args, win, display)
putc(ibuf[j], log);
}
}
if (display)
enddisp:
if ((flags & RUN_DISPLAY) != 0)
wrefresh(actionwin);
if (logging)
fflush(log);
@ -435,7 +459,7 @@ loop:
*/
int
run_prog(int fatal, int display, msg errmsg, const char *cmd, ...)
run_prog(int flags, msg errmsg, const char *cmd, ...)
{
va_list ap;
struct winsize win;
@ -461,11 +485,26 @@ run_prog(int fatal, int display, msg errmsg, const char *cmd, ...)
if (win.ws_col == 0)
win.ws_col = 80;
if (display) {
if ((flags & RUN_SYSTEM) != 0) {
if ((flags & RUN_CHROOT) != 0)
chroot(target_prefix());
ret = system(command);
} else if ((flags & RUN_DISPLAY) != 0) {
wclear(stdscr);
clearok(stdscr, 1);
touchwin(stdscr);
refresh();
if ((flags & RUN_FULLSCREEN) != 0) {
ret = launch_subwin(stdscr, args, &win, flags);
if (ret != 0) {
waddstr(stdscr, "Press any key to continue");
wrefresh(stdscr);
getchar();
}
goto done;
}
statuswin = subwin(stdscr, 3, win.ws_col, 0, 0);
if (statuswin == NULL) {
fprintf(stderr, "sysinst: failed to allocate"
@ -483,7 +522,7 @@ run_prog(int fatal, int display, msg errmsg, const char *cmd, ...)
actionwin = subwin(stdscr, win.ws_row - 4, win.ws_col, 4, 0);
if (actionwin == NULL) {
fprintf(stderr, "sysinst: failed to allocate"
" output window.\n");
" output window.\n");
exit(1);
}
scrollok(actionwin, TRUE);
@ -513,7 +552,7 @@ run_prog(int fatal, int display, msg errmsg, const char *cmd, ...)
wrefresh(actionwin);
ret = launch_subwin(actionwin, args, win, 1);
ret = launch_subwin(actionwin, args, &win, flags);
wmove(statuswin, 0, 13);
wstandout(statuswin);
@ -531,15 +570,16 @@ run_prog(int fatal, int display, msg errmsg, const char *cmd, ...)
delwin(actionwin);
delwin(boxwin);
delwin(statuswin);
done:
wclear(stdscr);
touchwin(stdscr);
clearok(stdscr, 1);
refresh();
} else { /* display */
ret = launch_subwin(NULL, args, win, 0);
ret = launch_subwin(NULL, args, &win, flags);
}
va_end(ap);
if (fatal && ret != 0)
if ((flags & RUN_FATAL) != 0 && ret != 0)
exit(ret);
if (ret && errmsg != MSG_NONE) {
msg_display(errmsg, command);

View File

@ -1,4 +1,4 @@
/* $NetBSD: target.c,v 1.26 2000/10/11 11:10:11 fvdl Exp $ */
/* $NetBSD: target.c,v 1.27 2000/10/11 23:47:56 fvdl Exp $ */
/*
* Copyright 1997 Jonathan Stone
@ -75,7 +75,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: target.c,v 1.26 2000/10/11 11:10:11 fvdl Exp $");
__RCSID("$NetBSD: target.c,v 1.27 2000/10/11 23:47:56 fvdl Exp $");
#endif
/*
@ -424,7 +424,7 @@ make_prefixed_dir(prefix, path)
const char *path;
{
run_prog(0, 0, NULL, "/bin/mkdir -p %s", concat_paths(prefix, path));
run_prog(0, NULL, "/bin/mkdir -p %s", concat_paths(prefix, path));
}
/* Make a directory with a pathname relative to the insatllation target. */
@ -461,7 +461,7 @@ append_to_target_file(path, string)
const char *string;
{
run_prog(1, 0, NULL, "echo %s >> %s", string, target_expand(path));
run_prog(RUN_FATAL, NULL, "echo %s >> %s", string, target_expand(path));
}
/*
@ -497,7 +497,7 @@ trunc_target_file(path)
const char *path;
{
run_prog(1, 0, NULL, "cat < /dev/null > %s", target_expand(path));
run_prog(RUN_FATAL, NULL, "cat < /dev/null > %s", target_expand(path));
}
#endif /* if 0 */
@ -568,7 +568,7 @@ cp_to_target(srcpath, tgt_path)
{
const char *realpath = target_expand(tgt_path);
return run_prog(0, 0, NULL, "/bin/cp %s %s", srcpath, realpath);
return run_prog(0, NULL, "/bin/cp %s %s", srcpath, realpath);
}
/*
@ -600,7 +600,7 @@ mv_within_target_or_die(frompath, topath)
strncpy(realfrom, target_expand(frompath), STRSIZE);
strncpy(realto, target_expand(topath), STRSIZE);
run_prog(1, 0, NULL, "mv %s %s", realfrom, realto);
run_prog(RUN_FATAL, NULL, "mv %s %s", realfrom, realto);
}
/* Do a cp where both pathnames are within the target filesystem. */
@ -614,7 +614,7 @@ int cp_within_target(frompath, topath)
strncpy(realfrom, target_expand(frompath), STRSIZE);
strncpy(realto, target_expand(topath), STRSIZE);
return (run_prog(0, 0, NULL, "cp -p %s %s", realfrom, realto));
return (run_prog(0, NULL, "cp -p %s %s", realfrom, realto));
}
/* fopen a pathname in the target. */
@ -654,7 +654,7 @@ mount_with_unwind(fstype, from, on)
backtowin();
#endif
error = run_prog(0, 0, NULL, "/sbin/mount %s %s %s", fstype, from, on);
error = run_prog(0, NULL, "/sbin/mount %s %s %s", fstype, from, on);
return (error);
}
@ -683,7 +683,7 @@ unwind_mounts()
fprintf(stderr, "unmounting %s\n", m->um_mountpoint);
backtowin();
#endif
run_prog(0, 0, NULL, "/sbin/umount %s", m->um_mountpoint);
run_prog(0, NULL, "/sbin/umount %s", m->um_mountpoint);
prev = m->um_prev;
free(m);
m = prev;

View File

@ -1,4 +1,4 @@
/* $NetBSD: upgrade.c,v 1.23 2000/09/26 23:12:44 fvdl Exp $ */
/* $NetBSD: upgrade.c,v 1.24 2000/10/11 23:47:57 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -60,7 +60,6 @@ int merge_X __P((void));
void
do_upgrade()
{
doingwhat = msg_string(MSG_upgrade);
msg_display(MSG_upgradeusure);
@ -86,6 +85,7 @@ do_upgrade()
if (!fsck_disks())
return;
/*
* Save X symlink, ...
*/
@ -267,6 +267,7 @@ do_reinstall_sets()
fflush(stdout);
puts(CL); /* XXX */
touchwin(stdscr);
wclear(stdscr);
wrefresh(stdscr);

View File

@ -1,4 +1,4 @@
/* $NetBSD: util.c,v 1.55 2000/10/11 11:10:46 fvdl Exp $ */
/* $NetBSD: util.c,v 1.56 2000/10/11 23:47:57 fvdl Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -164,7 +164,7 @@ run_makedev()
/* make /dev, in case the user didn't extract it. */
make_target_dir("/dev");
target_chdir_or_die("/dev");
run_prog(0, 0, NULL, "/bin/sh MAKEDEV all");
run_prog(0, NULL, "/bin/sh MAKEDEV all");
chdir(owd);
free(owd);
@ -202,7 +202,7 @@ get_via_floppy()
first = 1;
while (!mounted || stat(fullname, &sb)) {
if (mounted)
run_prog(0, 0, NULL, "/sbin/umount /mnt2");
run_prog(0, NULL, "/sbin/umount /mnt2");
if (first)
msg_display(MSG_fdmount, fname);
else
@ -210,7 +210,7 @@ get_via_floppy()
process_menu(MENU_fdok);
if (!yesno)
return 0;
while (run_prog(0, 0, NULL,
while (run_prog(0, NULL,
"/sbin/mount -r -t %s %s /mnt2",
fdtype, fddev)) {
msg_display(MSG_fdremount, fname);
@ -233,7 +233,7 @@ get_via_floppy()
else
post[2] = 'a', post[1]++;
}
run_prog(0, 0, NULL, "/sbin/umount /mnt2");
run_prog(0, NULL, "/sbin/umount /mnt2");
mounted = 0;
list++;
}
@ -263,10 +263,10 @@ get_via_cdrom()
process_menu(MENU_cdromsource);
again:
run_prog(0, 0, NULL, "/sbin/umount /mnt2");
run_prog(0, NULL, "/sbin/umount /mnt2");
/* Mount it */
if (run_prog(0, 0, NULL,
if (run_prog(0, NULL,
"/sbin/mount -rt cd9660 /dev/%sa /mnt2", cdrom_dev)) {
msg_display(MSG_badsetdir, cdrom_dev);
process_menu(MENU_cdrombadmount);
@ -309,10 +309,10 @@ get_via_localfs()
process_menu (MENU_localfssource);
again:
run_prog(0, 0, NULL, "/sbin/umount /mnt2");
run_prog(0, NULL, "/sbin/umount /mnt2");
/* Mount it */
if (run_prog(0, 0, NULL, "/sbin/mount -rt %s /dev/%s /mnt2",
if (run_prog(0, NULL, "/sbin/mount -rt %s /dev/%s /mnt2",
localfs_fs, localfs_dev)) {
msg_display(MSG_localfsbadmount, localfs_dir, localfs_dev);
@ -469,7 +469,7 @@ extract_file(path)
target_chdir_or_die("/");
/* now extract set files files into "./". */
tarexit = run_prog(0, 1, NULL,
tarexit = run_prog(RUN_DISPLAY, NULL,
"pax -zr%spe -f %s", verbose ? "v" : "", path);
/* Check tarexit for errors and give warning. */
@ -776,11 +776,11 @@ get_and_unpack_sets(success_msg, failure_msg)
/* Clean up dist dir (use absolute path name) */
if (clean_dist_dir)
run_prog(0, 0, NULL, "/bin/rm -rf %s", ext_dir);
run_prog(0, NULL, "/bin/rm -rf %s", ext_dir);
/* Mounted dist dir? */
if (mnt2_mounted)
run_prog(0, 0, NULL, "/sbin/umount /mnt2");
run_prog(0, NULL, "/sbin/umount /mnt2");
/* Install/Upgrade complete ... reboot or exit to script */
msg_display(success_msg);
@ -1056,3 +1056,13 @@ set_timezone()
return 1;
}
int
set_root_password()
{
msg_display(MSG_rootpw);
process_menu(MENU_yesno);
if (yesno)
run_prog(RUN_DISPLAY|RUN_CHROOT, NULL, "passwd -l root");
return 0;
}