diff options
author | eivind <eivind@FreeBSD.org> | 2000-10-29 09:57:50 +0000 |
---|---|---|
committer | eivind <eivind@FreeBSD.org> | 2000-10-29 09:57:50 +0000 |
commit | 6f8edb50c6d8904d12219526a9ccc789f8a782fb (patch) | |
tree | 1cd8de68787755af69e70fd406807ee3654dd56c /usr.sbin/sade/system.c | |
parent | e96f5ed9b3717ccf4dcca29937101d43ffe25d1c (diff) | |
download | FreeBSD-src-6f8edb50c6d8904d12219526a9ccc789f8a782fb.zip FreeBSD-src-6f8edb50c6d8904d12219526a9ccc789f8a782fb.tar.gz |
Teach sysinstall how to restart itself on Ctrl-C (as an addition to its old
tricks of rebooting and continuing where it was.)
Reviewed by: jkh, jhb
Diffstat (limited to 'usr.sbin/sade/system.c')
-rw-r--r-- | usr.sbin/sade/system.c | 52 |
1 files changed, 48 insertions, 4 deletions
diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c index 0eec38a..1423405 100644 --- a/usr.sbin/sade/system.c +++ b/usr.sbin/sade/system.c @@ -39,15 +39,50 @@ static pid_t ehs_pid; * due to our having bogotified the internal state of dialog or curses, * but we'll give it a try. */ +static int +intr_continue(dialogMenuItem *self) +{ + return DITEM_LEAVE_MENU; +} + +static int +intr_reboot(dialogMenuItem *self) +{ + systemShutdown(-1); + /* NOTREACHED */ + return 0; +} + +static int +intr_restart(dialogMenuItem *self) +{ + execl(StartName, StartName, NULL); + /* NOTREACHED */ + return -1; +} + +static dialogMenuItem intrmenu[] = { + { "Abort", "Abort the installation", NULL, intr_reboot }, + { "Restart", "Restart the installation program", NULL, intr_restart }, + { "Continue", "Continue the installation", NULL, intr_continue }, +}; + + static void handle_intr(int sig) { WINDOW *save = savescr(); - if (!msgYesNo("Are you sure you want to abort the installation?")) - systemShutdown(-1); - else - restorescr(save); + use_helpline(NULL); + use_helpfile(NULL); + if (OnVTY) { + ioctl(0, VT_ACTIVATE, 1); /* Switch back */ + msgInfo(NULL); + } + (void)dialog_menu("Installation interrupt", + "Do you want to abort the installation?", + -1, -1, 3, -3, intrmenu, NULL, NULL, NULL); + restorescr(save); } /* Expand a file into a convenient location, nuking it each time */ @@ -75,6 +110,7 @@ void systemInitialize(int argc, char **argv) { int i, boothowto; + sigset_t signalset; signal(SIGINT, SIG_IGN); globalsInit(); @@ -150,6 +186,14 @@ systemInitialize(int argc, char **argv) if (!getenv("HOME")) setenv("HOME", "/", 1); signal(SIGINT, handle_intr); + /* + * Make sure we can be interrupted even if we were re-executed + * from an interrupt. + */ + sigemptyset(&signalset); + sigaddset(&signalset, SIGINT); + sigprocmask(SIG_UNBLOCK, &signalset, NULL); + (void)vsystem("rm -rf %s", DOC_TMP_DIR); } |