aboutsummaryrefslogtreecommitdiff
path: root/release/sysinstall/system.c
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1995-04-29 19:33:06 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1995-04-29 19:33:06 +0000
commite40a316fcf70b54426ebd18c62bb955ccc10c827 (patch)
treeab80745bc8d6737d2054b314ccdba01ec7273564 /release/sysinstall/system.c
parent1b52479293594185144ca9632c7677fa99115e7e (diff)
downloadsrc-e40a316fcf70b54426ebd18c62bb955ccc10c827.tar.gz
src-e40a316fcf70b54426ebd18c62bb955ccc10c827.zip
o Add extra menu types (radio implemented, multiple choice shortly).
o Make the framework generally more robust. o Figured out how to nest the menu descriptions - no more grotty initialization of menus. o Fix bug with helpline and helpfile not being reset. o Add stubs for the media selection code. Coming next: Fdisk and disklabel screens using Phk's new libdisk stuff.
Notes
Notes: svn path=/head/; revision=8174
Diffstat (limited to 'release/sysinstall/system.c')
-rw-r--r--release/sysinstall/system.c70
1 files changed, 69 insertions, 1 deletions
diff --git a/release/sysinstall/system.c b/release/sysinstall/system.c
index a48c9dfd3ea0..cbf7549a2f12 100644
--- a/release/sysinstall/system.c
+++ b/release/sysinstall/system.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id$
+ * $Id: system.c,v 1.1.1.1 1995/04/27 12:50:34 jkh Exp $
*
* Jordan Hubbard
*
@@ -20,6 +20,7 @@
#include <sys/reboot.h>
#include <sys/fcntl.h>
#include <sys/ioctl.h>
+#include <sys/wait.h>
/* Handle interrupt signals (duh!) */
static void
@@ -87,8 +88,11 @@ systemShutdown(void)
/* REALLY exit! */
if (getpid() == 1)
reboot(RB_HALT);
+ else
+ exit(1);
}
+/* Run some general command */
int
systemExecute(char *command)
{
@@ -105,3 +109,67 @@ systemExecute(char *command)
return status;
}
+/* Find and execute a shell */
+int
+systemShellEscape(void)
+{
+ char *sh = NULL;
+
+ if (file_executable("/bin/sh"))
+ sh = "/bin/sh";
+ else if (file_executable("/stand/sh"))
+ sh = "/stand/sh";
+ else {
+ msgWarn("No shell available, sorry!");
+ return 1;
+ }
+ setenv("PS1", "freebsd% ", 1);
+ dialog_clear();
+ dialog_update();
+ move(0, 0);
+ standout();
+ addstr("Type `exit' to leave this shell and continue installallation");
+ standend();
+ refresh();
+ end_dialog();
+ DialogActive = FALSE;
+ if (fork() == 0)
+ execlp(sh, "-sh", 0);
+ else
+ wait(NULL);
+ dialog_clear();
+ DialogActive = TRUE;
+ return 0;
+}
+
+/* Display a file in a filebox */
+int
+systemDisplayFile(char *file)
+{
+ char buf[FILENAME_MAX], *cp, *fname = NULL;
+
+ if (file_readable(file))
+ fname = file;
+ else if ((cp = getenv("LANG")) != NULL) {
+ snprintf(buf, FILENAME_MAX, "%s/%s", cp, file);
+ if (file_readable(buf))
+ fname = buf;
+ }
+ else {
+ snprintf(buf, FILENAME_MAX, "english/%s", file);
+ if (file_readable(buf))
+ fname = buf;
+ }
+ if (!fname) {
+ snprintf(buf, FILENAME_MAX, "The %s file is not provided on this particular floppy image.", file);
+ dialog_msgbox("Sorry!", buf, -1, -1, 1);
+ dialog_clear_norefresh();
+ return 1;
+ }
+ else {
+ dialog_clear_norefresh();
+ dialog_textbox(file, fname, LINES, COLS);
+ dialog_clear_norefresh();
+ }
+ return 0;
+}