-#if !ENABLE_DEBUG_INIT
- /* Expect to be invoked as init with PID=1 or be invoked as linuxrc */
- if (getpid() != 1
- && (!ENABLE_FEATURE_INITRD || !strstr(applet_name, "linuxrc"))
- ) {
- bb_show_usage();
+
+ if (!ENABLE_DEBUG_INIT) {
+ /* Expect to be invoked as init with PID=1 or be invoked as linuxrc */
+ if (getpid() != 1
+ && (!ENABLE_FEATURE_INITRD || !strstr(applet_name, "linuxrc"))
+ ) {
+ bb_show_usage();
+ }
+ /* Set up sig handlers -- be sure to
+ * clear all of these in run() */
+ signal(SIGHUP, exec_restart_action);
+ signal(SIGQUIT, exec_restart_action);
+ signal(SIGUSR1, halt_reboot_pwoff); /* halt */
+ signal(SIGUSR2, halt_reboot_pwoff); /* poweroff */
+ signal(SIGTERM, halt_reboot_pwoff); /* reboot */
+ signal(SIGINT, ctrlaltdel_signal);
+ signal(SIGCONT, cont_handler);
+ signal(SIGSTOP, stop_handler);
+ signal(SIGTSTP, stop_handler);
+
+ /* Turn off rebooting via CTL-ALT-DEL -- we get a
+ * SIGINT on CAD so we can shut things down gracefully... */
+ init_reboot(RB_DISABLE_CAD);