- Added feature a option called fastexit, if this is set entrance will

quit in any way, if not entrance just quits if the DE exits with an
  error.
- Fixed the issue that entrance is not restarting after closing the
  logged in session, this is done by NOT exitings if a user is logged in
  allready, the pam session is closed, Xserver is quit, so entrance can restart.
This commit is contained in:
Marcel Hollerbach 2014-01-23 21:44:01 +01:00
parent c64f88186b
commit 1be65edee7
2 changed files with 28 additions and 6 deletions

View File

@ -195,6 +195,10 @@ static const Ecore_Getopt options =
{
ECORE_GETOPT_STORE_TRUE('n', "nodaemon", "Don't daemonize."),
ECORE_GETOPT_STORE_TRUE('t', "test", "run in test mode."),
ECORE_GETOPT_STORE_TRUE('e', "fastexit", "Will change the way entrance \
handles the exit of the created session.\n If set, entrance will exit if the session \
quits.\n If not, entrance will restart if the session is quit because of an error, \
or if the environment variable ENTRANCE_RESTART is set."),
ECORE_GETOPT_STORE_TRUE('x', "xephyr", "run in test mode and use Xephyr."),
ECORE_GETOPT_HELP ('h', "help"),
ECORE_GETOPT_VERSION('V', "version"),
@ -212,12 +216,14 @@ main (int argc, char ** argv)
char *dname;
char *entrance_user = NULL;
unsigned char nodaemon = 0;
unsigned char fastexit = 0;
unsigned char quit_option = 0;
Ecore_Getopt_Value values[] =
{
ECORE_GETOPT_VALUE_BOOL(nodaemon),
ECORE_GETOPT_VALUE_BOOL(_testing),
ECORE_GETOPT_VALUE_BOOL(fastexit),
ECORE_GETOPT_VALUE_BOOL(_xephyr),
ECORE_GETOPT_VALUE_BOOL(quit_option),
ECORE_GETOPT_VALUE_BOOL(quit_option),
@ -244,6 +250,12 @@ main (int argc, char ** argv)
if (!_xephyr && getenv("ENTRANCE_XEPHYR"))
_xephyr = EINA_TRUE;
if (fastexit)
{
putenv(strdup("ENTRANCE_FAST_QUIT=1"));
PT("Fast exit enabled !\n");
}
if (_xephyr)
{
_testing = EINA_TRUE;
@ -321,9 +333,7 @@ main (int argc, char ** argv)
entrance_close_log();
exit(0);
}
entrance_close_log();
PT("Nice to see you again.\n");
exit(1);
PT("Nice to see you again. Entrance will restart.\n");
}
PT("Welcome\n");
ecore_init();

View File

@ -1,5 +1,6 @@
#include <sys/wait.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
@ -31,13 +32,15 @@ int
main (int argc __UNUSED__, char **argv __UNUSED__)
{
int status = 0;
char *pid;
char *pid, *exit_policy;
struct sigaction action;
pid_t rpid;
pid = getenv("ENTRANCE_XPID");
if (!pid) return -1;
_x_pid = atoi(pid);
exit_policy = getenv("ENTRANCE_FAST_QUIT");
action.sa_sigaction = _entrance_wait_action;
action.sa_flags = SA_RESTART | SA_SIGINFO;
@ -61,8 +64,17 @@ main (int argc __UNUSED__, char **argv __UNUSED__)
}
if (_x_pid == rpid)
{
if (WIFEXITED(status) && WEXITSTATUS(status))
setenv("ENTRANCE_QUIT", "1", 1);
if (exit_policy)
{
setenv("ENTRANCE_QUIT", "1", 1);
}
else
{
if ( WIFEXITED(status) && WEXITSTATUS(status))
{
setenv("ENTRANCE_QUIT", "1", 1);
}
}
execlp(PACKAGE_SBIN_DIR"/entrance", PACKAGE_SBIN_DIR"/entrance", "--nodaemon", NULL);
}
return -1;