Comment 2 for bug 35182

Revision history for this message
Jan Mynarik (jan-mynarik) wrote : Re: Shutdown from g-p-m doesn't use usplash

I'm not involved in any development of update-notifier and/or gdm but this is what I've found.

From update-notifier/src/reboot.c (requests reboot from gdm after session end, logouts):

static void
request_reboot (void)
{
 GnomeClient *client;
 char *cmd[] = { GDM_SIGNAL, "--reboot", NULL };

 client = gnome_master_client ();
 g_return_if_fail (client != NULL);

 /* Tell gdm to reboot once we exit the session */
 g_spawn_sync (NULL, cmd, NULL, G_SPAWN_STDOUT_TO_DEV_NULL,
        NULL, NULL, NULL, NULL, NULL, NULL);

 /* Tell gnome-session to save and exit the session without asking
  * the user. */
 gnome_client_request_save (client,
       GNOME_SAVE_GLOBAL,
       TRUE,
       GNOME_INTERACT_NONE,
       FALSE,
       TRUE);
}

This is one of ubuntu patches (gdm/debian/patches/15_usplash.patch) for gdm to get it co-operate with usplash in case of boot and shutdown/reboot:

--- gdm-2.8.0.4/debian/init 2005-09-29 15:56:09.000000000 +0200
+++ gdm-2.8.0.4/debian/init 2005-09-29 15:56:58.000000000 +0200
@@ -50,6 +50,10 @@
    if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" -a "$HEED_DEFAULT_DISPLAY_MANAGER" = "true" -a "$(cat $DEFAULT_DISPLAY_MANAGER_FILE 2>/dev/null)" != "$DAEMON" ]; then
   log_warning_msg "Not starting GNOME Display Manager (gdm); it is not the default display manager."
  else
+ # if usplash is runing, make sure to stop it now, yes "start" kills it.
+ if pidof usplash > /dev/null; then
+ /etc/init.d/usplash start
+ fi
   log_begin_msg "Starting GNOME Display Manager..."
   start-stop-daemon --start --quiet --pidfile $PIDFILE --name gdm $SSD_ARG -- $CONFIG_FILE >/dev/null 2>&1 || log_end_msg 1
   log_end_msg 0
--- gdm-2.13.0.8/daemon/gdm.c 2006-02-10 07:04:13.000000000 +1100
+++ gdm-2.13.0.8/daemon/gdm.c 2006-02-23 12:31:42.000000000 +1100
@@ -601,6 +601,13 @@
 static void
 change_to_first_and_clear (gboolean restart)
 {
+ if (WEXITSTATUS(system("/sbin/usplash_down 2>/dev/null")) == 0) {
+ if (restart)
+ system("/sbin/usplash_write \"TEXT System is restarting, please wait...\"");
+ else
+ system("/sbin/usplash_write \"TEXT System is shutting down, please wait...\"");
+ } else {
+
  gdm_change_vt (1);
  VE_IGNORE_EINTR (close (0));
  VE_IGNORE_EINTR (close (1));
@@ -624,6 +631,8 @@
   printf (_("System is shutting down, please wait ..."));
  /* set to black */
  printf ("\033[0m\n\033[1m---\033[0m\n\n");
+
+ }
 }
 #endif /* __linux__ */

If I understand it right, g-p-m just sets policy for hal and hal takes care of shutdown even if GNOME is currently not running. Am I right?

Ideally the hal-system-power-shutdown script should try to shutdown computer via gdm; including session save, what it currently does (some gnome-session behaviour for the case of shutdown?). If gdm weren't running (should it be possible? kubuntu/kdm?), just copy the gdm's shutdown/restart behaviour.