diff options
-rw-r--r-- | release/sysinstall/main.c | 5 | ||||
-rw-r--r-- | release/sysinstall/sysinstall.h | 1 | ||||
-rw-r--r-- | release/sysinstall/system.c | 52 | ||||
-rw-r--r-- | usr.sbin/sade/main.c | 5 | ||||
-rw-r--r-- | usr.sbin/sade/sade.h | 1 | ||||
-rw-r--r-- | usr.sbin/sade/system.c | 52 | ||||
-rw-r--r-- | usr.sbin/sysinstall/main.c | 5 | ||||
-rw-r--r-- | usr.sbin/sysinstall/sysinstall.h | 1 | ||||
-rw-r--r-- | usr.sbin/sysinstall/system.c | 52 |
9 files changed, 162 insertions, 12 deletions
diff --git a/release/sysinstall/main.c b/release/sysinstall/main.c index d16720d..e48d6c5 100644 --- a/release/sysinstall/main.c +++ b/release/sysinstall/main.c @@ -38,6 +38,8 @@ #include <sys/signal.h> #include <sys/fcntl.h> +const char *StartName; /* Initial contents of argv[0] */ + static void screech(int sig) { @@ -49,6 +51,9 @@ int main(int argc, char **argv) { int choice, scroll, curr, max, status; + + /* Record name to be able to restart */ + StartName = argv[0]; /* Catch fatal signals and complain about them if running as init */ if (getpid() == 1) { diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h index 048a5e7..8dab491 100644 --- a/release/sysinstall/sysinstall.h +++ b/release/sysinstall/sysinstall.h @@ -403,6 +403,7 @@ extern DMenu MenuUsermgmt; /* User management menu */ extern DMenu MenuFixit; /* Fixit floppy/CDROM/shell menu */ extern DMenu MenuXF86Config; /* Select XFree86 configuration type */ extern int FixItMode; /* FixItMode starts shell onc urrent device (ie Serial port) */ +extern const char * StartName; /* Which name we were started as */ /* Stuff from libdialog which isn't properly declared outside */ extern void display_helpfile(void); diff --git a/release/sysinstall/system.c b/release/sysinstall/system.c index 0eec38a..1423405 100644 --- a/release/sysinstall/system.c +++ b/release/sysinstall/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); } diff --git a/usr.sbin/sade/main.c b/usr.sbin/sade/main.c index d16720d..e48d6c5 100644 --- a/usr.sbin/sade/main.c +++ b/usr.sbin/sade/main.c @@ -38,6 +38,8 @@ #include <sys/signal.h> #include <sys/fcntl.h> +const char *StartName; /* Initial contents of argv[0] */ + static void screech(int sig) { @@ -49,6 +51,9 @@ int main(int argc, char **argv) { int choice, scroll, curr, max, status; + + /* Record name to be able to restart */ + StartName = argv[0]; /* Catch fatal signals and complain about them if running as init */ if (getpid() == 1) { diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index 048a5e7..8dab491 100644 --- a/usr.sbin/sade/sade.h +++ b/usr.sbin/sade/sade.h @@ -403,6 +403,7 @@ extern DMenu MenuUsermgmt; /* User management menu */ extern DMenu MenuFixit; /* Fixit floppy/CDROM/shell menu */ extern DMenu MenuXF86Config; /* Select XFree86 configuration type */ extern int FixItMode; /* FixItMode starts shell onc urrent device (ie Serial port) */ +extern const char * StartName; /* Which name we were started as */ /* Stuff from libdialog which isn't properly declared outside */ extern void display_helpfile(void); 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); } diff --git a/usr.sbin/sysinstall/main.c b/usr.sbin/sysinstall/main.c index d16720d..e48d6c5 100644 --- a/usr.sbin/sysinstall/main.c +++ b/usr.sbin/sysinstall/main.c @@ -38,6 +38,8 @@ #include <sys/signal.h> #include <sys/fcntl.h> +const char *StartName; /* Initial contents of argv[0] */ + static void screech(int sig) { @@ -49,6 +51,9 @@ int main(int argc, char **argv) { int choice, scroll, curr, max, status; + + /* Record name to be able to restart */ + StartName = argv[0]; /* Catch fatal signals and complain about them if running as init */ if (getpid() == 1) { diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index 048a5e7..8dab491 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -403,6 +403,7 @@ extern DMenu MenuUsermgmt; /* User management menu */ extern DMenu MenuFixit; /* Fixit floppy/CDROM/shell menu */ extern DMenu MenuXF86Config; /* Select XFree86 configuration type */ extern int FixItMode; /* FixItMode starts shell onc urrent device (ie Serial port) */ +extern const char * StartName; /* Which name we were started as */ /* Stuff from libdialog which isn't properly declared outside */ extern void display_helpfile(void); diff --git a/usr.sbin/sysinstall/system.c b/usr.sbin/sysinstall/system.c index 0eec38a..1423405 100644 --- a/usr.sbin/sysinstall/system.c +++ b/usr.sbin/sysinstall/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); } |