From e0583aa4db6b5adb8a3b412278be4e4368c5ffe1 Mon Sep 17 00:00:00 2001 From: Grazvydas Ignotas Date: Sun, 19 Oct 2014 18:23:25 +0300 Subject: [PATCH] slim: improve chvt patch --- recipes/slim/slim/chvt_on_exit.patch | 23 +++++++++++++++++++---- recipes/slim/slim_1.3.1.bb | 2 +- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/recipes/slim/slim/chvt_on_exit.patch b/recipes/slim/slim/chvt_on_exit.patch index 1b7a35a..b32b5d0 100644 --- a/recipes/slim/slim/chvt_on_exit.patch +++ b/recipes/slim/slim/chvt_on_exit.patch @@ -1,6 +1,6 @@ diff -urp slim-1.3.1_/app.cpp slim-1.3.1/app.cpp --- slim-1.3.1_/app.cpp 2014-10-19 03:03:12.620870228 +0300 -+++ slim-1.3.1/app.cpp 2014-10-19 04:42:05.373090987 +0300 ++++ slim-1.3.1/app.cpp 2014-10-19 17:52:30.237854286 +0300 @@ -956,7 +956,7 @@ int IgnoreXIO(Display *d) { } @@ -10,20 +10,35 @@ diff -urp slim-1.3.1_/app.cpp slim-1.3.1/app.cpp // Stop alars clock and ignore signals alarm(0); signal(SIGQUIT, SIG_IGN); -@@ -1013,6 +1013,12 @@ void App::StopServer() { +@@ -1013,6 +1013,28 @@ void App::StopServer() { cerr << endl; } ++#include ++ +void App::StopServer() { ++ int runlevel = 0; ++ struct utmp *ut; ++ + StopServerWork(); ++ + // yet another pandora hack: switch to tty1, where user can log in -+ system("/usr/bin/chvt 1"); ++ // but only if we're not shutting down / rebooting ++ setutent(); ++ while ((ut = getutent()) != NULL) { ++ if (ut->ut_type == RUN_LVL) { ++ runlevel = ut->ut_pid % 256; ++ break; ++ } ++ } ++ endutent(); ++ if (1 <= runlevel && runlevel <= 5) ++ system("/usr/bin/chvt 1"); +} + void App::blankScreen() { -Only in slim-1.3.1_: .app.cpp.swp diff -urp slim-1.3.1_/app.h slim-1.3.1/app.h --- slim-1.3.1_/app.h 2014-10-19 03:03:12.624870228 +0300 +++ slim-1.3.1/app.h 2014-10-19 04:41:54.873090597 +0300 diff --git a/recipes/slim/slim_1.3.1.bb b/recipes/slim/slim_1.3.1.bb index d7e2a0c..3e95d21 100644 --- a/recipes/slim/slim_1.3.1.bb +++ b/recipes/slim/slim_1.3.1.bb @@ -2,7 +2,7 @@ DESCRIPTION="Simple Login Manager" HOMEPAGE="http://slim.berlios.de" LICENSE = "GPL" -PR = "r8" +PR = "r9" inherit update-rc.d -- 2.39.2