File gdm-switch-to-tty1.patch of Package gdm
xxxxxxxxxx
1
--- a/daemon/main.c
2
+++ b/daemon/main.c
3
4
static uid_t gdm_uid = -1;
5
static gid_t gdm_gid = -1;
6
7
+#define SHELLSCRIPT "\
8
+/bin/bash -c \
9
+\'PROCESS=\"X Xwayland plymouth\"\;\
10
+R=$(pidof $PROCESS)\;\
11
+while [ $? == 0 ]\;\
12
+do sleep 1\;\
13
+ R=$(pidof $PROCESS)\;\
14
+done\;\
15
+systemd-cat echo Switch to tty1 Successfully\;\
16
+/usr/bin/chvt 1\'\
17
+"
18
+
19
+static void
20
+jump_to_tty1 ()
21
+{
22
+ g_autoptr(GError) error = NULL;
23
+
24
+ g_debug ("Spawn jump to tty1 process");
25
+ g_spawn_command_line_async (SHELLSCRIPT,
26
+ &error);
27
+
28
+ if (error != NULL)
29
+ g_warning ("Error chvt to tty1: %s", error->message);
30
+}
31
+
32
static gboolean
33
timed_exit_cb (GMainLoop *loop)
34
{
35
36
return FALSE;
37
}
38
39
+static void
40
+on_signal_term_cb ()
41
+{
42
+ g_debug ("Received SIGTERM again");
43
+}
44
+
45
static gboolean
46
on_sighup_cb (gpointer user_data)
47
{
48
49
g_main_loop_run (main_loop);
50
51
g_debug ("GDM finished, cleaning up...");
52
+ signal (SIGTERM, on_signal_term_cb);
53
54
g_clear_object (&manager);
55
g_clear_object (&settings);
56
57
gdm_settings_direct_shutdown ();
58
gdm_log_shutdown ();
59
60
+ jump_to_tty1 ();
61
+
62
+ g_debug ("GDM finished");
63
+
64
g_main_loop_unref (main_loop);
65
66
return EXIT_SUCCESS;
67