aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/sade/system.c
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1995-04-27 12:50:35 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1995-04-27 12:50:35 +0000
commit4e278bdb76b2ef92f5dd38ea1862ece85d009102 (patch)
treeb9115197b39d0fd8f46d0081c656b18fbd48b1bd /usr.sbin/sade/system.c
parent278ea7ecee5f772c790860846e22fe737047837b (diff)
downloadsrc-4e278bdb76b2ef92f5dd38ea1862ece85d009102.tar.gz
src-4e278bdb76b2ef92f5dd38ea1862ece85d009102.zip
Here is my first "framework" commit of the new sysinstall. There is a LOT
more to come in the next 24 hours, this is just the first stable result of 8 hours of hacking so far. The specification format for menus is pretty much hammered out and the beginnings (very humble) of the doc hierarchy are present for an example. It should be quite easy to add a lot more menus quickly to this since I did go somewhat out of my way to make the framework easy to work with. This is NOT the glorious semi-graphical sysinstall (or whatever its name will be) that the install-geeks are working on, this is simply the "son of sysinstall" I've been promising to write in the interim for 2.0.5 and 2.1R (super install doesn't come until 2.2R).
Notes
Notes: svn path=/cvs2svn/branches/unlabeled-1.1.1/; revision=8097
Diffstat (limited to 'usr.sbin/sade/system.c')
-rw-r--r--usr.sbin/sade/system.c107
1 files changed, 107 insertions, 0 deletions
diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c
new file mode 100644
index 000000000000..a48c9dfd3ea0
--- /dev/null
+++ b/usr.sbin/sade/system.c
@@ -0,0 +1,107 @@
+/*
+ * The new sysinstall program.
+ *
+ * This is probably the last program in the `sysinstall' line - the next
+ * generation being essentially a complete rewrite.
+ *
+ * $Id$
+ *
+ * Jordan Hubbard
+ *
+ * My contributions are in the public domain.
+ *
+ * Parts of this file are also blatently stolen from Poul-Henning Kamp's
+ * previous version of sysinstall, and as such fall under his "BEERWARE"
+ * license, so buy him a beer if you like it! Buy him a beer for me, too!
+ */
+
+#include "sysinstall.h"
+#include <signal.h>
+#include <sys/reboot.h>
+#include <sys/fcntl.h>
+#include <sys/ioctl.h>
+
+/* Handle interrupt signals (duh!) */
+static void
+handle_intr(int sig)
+{
+}
+
+/* Welcome the user to the system */
+void
+systemWelcome(void)
+{
+}
+
+/* Initialize system defaults */
+void
+systemInitialize(int argc, char **argv)
+{
+ signal(SIGINT, SIG_IGN);
+ globalsInit();
+
+ /* Are we running as init? */
+ if (getpid() == 1) {
+ setsid();
+ if (argc > 1 && strchr(argv[1],'C')) {
+ /* Kernel told us that we are on a CDROM root */
+ close(0); open("/bootcd/dev/console", O_RDWR);
+ close(1); dup(0);
+ close(2); dup(0);
+ CpioFD = open("/floppies/cpio.flp", O_RDONLY);
+ OnCDROM = TRUE;
+ chroot("/bootcd");
+ } else {
+ close(0); open("/dev/console", O_RDWR);
+ close(1); dup(0);
+ close(2); dup(0);
+ }
+ msgInfo("%s running as init", argv[0]);
+
+ ioctl(0, TIOCSCTTY, (char *)NULL);
+ setlogin("root");
+ setbuf(stdin, 0);
+ setbuf(stdout, 0);
+ setbuf(stderr, 0);
+ }
+
+ if (set_termcap() == -1)
+ msgFatal("Can't find terminal entry");
+
+ /* XXX - libdialog has particularly bad return value checking */
+ init_dialog();
+ /* If we haven't crashed I guess dialog is running ! */
+ DialogActive = TRUE;
+
+ signal(SIGINT, handle_intr);
+}
+
+/* Close down and prepare to exit */
+void
+systemShutdown(void)
+{
+ if (DialogActive) {
+ end_dialog();
+ DialogActive = FALSE;
+ }
+ /* REALLY exit! */
+ if (getpid() == 1)
+ reboot(RB_HALT);
+}
+
+int
+systemExecute(char *command)
+{
+ int status;
+
+ dialog_clear();
+ dialog_update();
+ end_dialog();
+ DialogActive = FALSE;
+ status = system(command);
+ DialogActive = TRUE;
+ dialog_clear();
+ dialog_update();
+ return status;
+}
+