entrance: let the greeter user be configurable

This commit is contained in:
Marcel Hollerbach 2015-08-08 14:56:55 +02:00
parent 4486d92901
commit babe4d9807
4 changed files with 20 additions and 2 deletions

View File

@ -69,4 +69,7 @@ group "Entrance_Config" struct {
/* Use a virtual keyboard */
value "virtual_keyboard" uchar: 0;
/* the user to log in with */
value "start_user" string: "entrance";
}

View File

@ -192,17 +192,30 @@ _entrance_main(const char *dname)
if (!_entrance_client)
{
char buf[PATH_MAX];
const char *user = NULL;
ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
_entrance_client_del, NULL);
ecore_event_handler_add(ECORE_EXE_EVENT_ERROR,
_entrance_client_error, NULL);
ecore_event_handler_add(ECORE_EXE_EVENT_DATA,
(Ecore_Event_Handler_Cb)_entrance_client_data, NULL);
if (entrance_config->start_user && entrance_config->start_user[0])
{
if (getpwnam(entrance_config->start_user))
user = entrance_config->start_user;
}
if (!user)
{
PT("The given user %s, is not not valid. Falling back to nobody user, possible that this wont work, set up a correct start_user in entrance.conf", entrance_config->start_user);
user = "nobody";
}
snprintf(buf, sizeof(buf),
SUDO" -u nobody "
SUDO" -u %s "
"LD_LIBRARY_PATH="PACKAGE_LIB_DIR" "
PACKAGE_BIN_DIR"/entrance_client -d %s -t %s",
dname, entrance_config->theme);
user, dname, entrance_config->theme);
PT("Exec entrance_client: %s", buf);
_entrance_client = ecore_exe_pipe_run(buf, ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR, NULL);

View File

@ -170,6 +170,7 @@ entrance_config_init()
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "elementary_profile", elm_profile, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "virtual_keyboard", vkbd_enabled, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "custom_conf", custom_conf, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "start_user", start_user, EET_T_STRING);
_entrance_config_descriptor = edd;
if (stat( "/var/cache/"PACKAGE"/"ENTRANCE_CONFIG_FILE, &cache) == -1)

View File

@ -37,6 +37,7 @@ struct _Entrance_Config
Eina_Bool autologin;
Eina_Bool custom_conf;
Eina_Bool vkbd_enabled;
const char *start_user;
};
void entrance_config_init(void);