Merge lp:~robert-ancell/lightdm/remove-legacy-support into lp:lightdm

Proposed by Robert Ancell
Status: Merged
Approved by: Robert Ancell
Approved revision: 1844
Merged at revision: 1841
Proposed branch: lp:~robert-ancell/lightdm/remove-legacy-support
Merge into: lp:lightdm
Diff against target: 650 lines (+18/-447)
18 files modified
.bzrignore (+2/-8)
Makefile.am (+1/-1)
configure.ac (+0/-1)
data/Makefile.am (+1/-2)
data/dm-tool.1 (+1/-2)
data/lightdm-set-defaults.1 (+0/-52)
data/lightdm.1 (+1/-2)
debian/lightdm.postinst (+0/-10)
debian/rules (+0/-1)
po/POTFILES.in (+0/-1)
src/Makefile.am (+12/-1)
src/session-child.c (+0/-5)
tests/Makefile.am (+0/-2)
tests/scripts/util-path.conf (+0/-33)
tests/test-util-path (+0/-2)
utils/Makefile.am (+0/-30)
utils/gdmflexiserver (+0/-17)
utils/lightdm-set-defaults.c (+0/-277)
To merge this branch: bzr merge lp:~robert-ancell/lightdm/remove-legacy-support
Reviewer Review Type Date Requested Status
Robert Ancell Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+194294@code.launchpad.net

Commit message

Remove lightdm-set-defaults and gdmflexiserver.

lightdm-set-defaults is not required since 1.8 as configuration can now be loaded from a lightdm.conf.d directory. This allows a file per setting to be written and better handles more than one thing (e.g. a packaging system) setting these values.

Any software that still relies on gdmflexiserver should have switched to using dm-tool or the D-Bus interface by now.

Drop the GDM migration in the Ubuntu packaging. All Ubuntu users upgrading to this version of LightDM will be using at least 12.04 which had LightDM installed by default. (Only upgrades back to the last LTS are required to work).

To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Remove lightdm-set-defaults and gdmflexiserver.

lightdm-set-defaults is not required since 1.8 as configuration can now be loaded from a lightdm.conf.d directory. This allows a file per setting to be written and better handles more than one thing (e.g. a packaging system) setting these values.

Any software that still relies on gdmflexiserver should have switched to using dm-tool or the D-Bus interface by now.

Drop the GDM migration in the Ubuntu packaging. All Ubuntu users upgrading to this version of LightDM will be using at least 12.04 which had LightDM installed by default. (Only upgrades back to the last LTS are required to work).

Revision history for this message
Robert Ancell (robert-ancell) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Robert Ancell (robert-ancell) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2013-07-23 02:24:45 +0000
3+++ .bzrignore 2013-11-07 08:45:29 +0000
4@@ -51,12 +51,7 @@
5 po/*.gmo
6 po/POTFILES
7 po/stamp-it
8-src/display-glue.h
9-src/display-manager-glue.h
10-src/session-manager-glue.h
11-src/user-manager-glue.h
12-src/ldm-marshal.c
13-src/ldm-marshal.h
14+src/dm-tool
15 src/lightdm
16 src/lightdm-guest-session-wrapper
17 tests/*.log
18@@ -69,6 +64,7 @@
19 tests/src/plymouth
20 tests/src/test-gobject-greeter
21 tests/src/test-greeter-wrapper
22+tests/src/test-guest-wrapper
23 tests/src/test-mir-greeter
24 tests/src/test-qt4-greeter
25 tests/src/test-qt5-greeter
26@@ -79,5 +75,3 @@
27 tests/src/vnc-client
28 tests/src/X
29 tests/src/Xvnc
30-utils/lightdm-set-defaults
31-utils/dm-tool
32
33=== modified file 'Makefile.am'
34--- Makefile.am 2013-02-06 14:08:25 +0000
35+++ Makefile.am 2013-11-07 08:45:29 +0000
36@@ -6,7 +6,7 @@
37 if COMPILE_TESTS
38 SUBDIRS += tests
39 endif
40-SUBDIRS += data po src doc help utils
41+SUBDIRS += data po src doc help
42
43 DISTCHECK_CONFIGURE_FLAGS = --enable-introspection --enable-gtk-doc
44
45
46=== modified file 'configure.ac'
47--- configure.ac 2013-11-07 02:24:50 +0000
48+++ configure.ac 2013-11-07 08:45:29 +0000
49@@ -217,7 +217,6 @@
50 src/Makefile
51 tests/Makefile
52 tests/src/Makefile
53-utils/Makefile
54 ])
55 AC_OUTPUT
56
57
58=== modified file 'data/Makefile.am'
59--- data/Makefile.am 2013-11-07 03:24:11 +0000
60+++ data/Makefile.am 2013-11-07 08:45:29 +0000
61@@ -25,8 +25,7 @@
62 apparmor/abstractions/lightdm_chromium-browser
63
64 dist_man1_MANS = dm-tool.1 \
65- lightdm.1 \
66- lightdm-set-defaults.1
67+ lightdm.1
68
69 EXTRA_DIST = apparmor/lightdm-guest-session.in
70 CLEANFILES = lightdm-guest-session
71
72=== modified file 'data/dm-tool.1'
73--- data/dm-tool.1 2013-11-07 03:24:11 +0000
74+++ data/dm-tool.1 2013-11-07 08:45:29 +0000
75@@ -59,5 +59,4 @@
76 .B add-seat TYPE [NAME=VALUE...]
77 Add a dynamic seat.
78 .SH SEE ALSO
79-.BR lightdm (1),
80-.BR lightdm-set-defaults (1)
81+.BR lightdm (1)
82
83=== removed file 'data/lightdm-set-defaults.1'
84--- data/lightdm-set-defaults.1 2013-11-07 03:24:29 +0000
85+++ data/lightdm-set-defaults.1 1970-01-01 00:00:00 +0000
86@@ -1,52 +0,0 @@
87-.TH LIGHTDM-SET-DEFAULTS 1 "7 November 2013"
88-.SH NAME
89-lightdm-set-defaults \- sets configuration options for lightdm
90-.SH SYNOPSIS
91-.B lightdm-set-defaults
92-[
93-.I OPTION
94-]
95-.SH DESCRIPTION
96-.B lightdm-set-defaults
97-sets configuration options for lightdm. Requires root permissions to run.
98-.SH OPTIONS
99-.TP
100-.B \-h, \-\-help
101-Show help options
102-.TP
103-.B \-k, \-\-keep\-old
104-Only update if no default already set
105-.TP
106-.B \-d, \-\-debug
107-Enable debugging messages
108-.TP
109-.B \-r, \-\-remove
110-Remove default value if it's the current one
111-.TP
112-.B \-s, \-\-session=SESSION_NAME
113-Set the default session to SESSION_NAME
114-.TP
115-.B \-g, \-\-greeter=GREETER_NAME
116-Set the default greeter to GREETER_NAME
117-.TP
118-.B \-a, \-\-autologin=USERNAME
119-Set the autologin user to USERNAME
120-.TP
121-.B \-i, \-\-hide\-users=<true|false>
122-Set greeter-hide-users to true or false.
123-.TP
124-.B \-m, \-\-show\-manual\-login=<true|false>
125-Set show-manual-login to true or false.
126-.TP
127-.B \-R, \-\-show\-remote\-login=<true|false>
128-Set show-manual-login to true or false.
129-.TP
130-.B \-l, \-\-allow\-guest=<true|false>
131-Set allow-guest to true or false.
132-.SH FILES
133-.TP
134-.B /etc/lightdm/lightdm.conf
135-Configuration
136-.SH SEE ALSO
137-.BR lightdm (1),
138-.BR dm-tool (1)
139
140=== modified file 'data/lightdm.1'
141--- data/lightdm.1 2013-11-07 03:24:29 +0000
142+++ data/lightdm.1 2013-11-07 08:45:29 +0000
143@@ -54,5 +54,4 @@
144 .B /etc/lightdm/keys.conf
145 XDMCP keys
146 .SH SEE ALSO
147-.BR dm-tool (1),
148-.BR lightdm-set-defaults (1)
149+.BR dm-tool (1)
150
151=== modified file 'debian/lightdm.postinst'
152--- debian/lightdm.postinst 2013-07-16 23:36:16 +0000
153+++ debian/lightdm.postinst 2013-11-07 08:45:29 +0000
154@@ -69,16 +69,6 @@
155 # stdout, which can confuse debconf.
156 db_stop
157
158-# migrate gdm configuration on first-time installation
159-if [ -z "$2" ]; then
160- if grep -q '^AutomaticLoginEnable *= *true$' /etc/gdm/custom.conf 2>/dev/null; then
161- user=`sed -n '/^AutomaticLogin *=/ { s/^.*= *//; p }' /etc/gdm/custom.conf`
162- if [ -n "$user" ]; then
163- /usr/lib/lightdm/lightdm-set-defaults --keep-old --autologin="$user"
164- fi
165- fi
166-fi
167-
168 case "$1" in
169 configure)
170 # LP: #1189948
171
172=== modified file 'debian/rules'
173--- debian/rules 2013-08-21 21:38:56 +0000
174+++ debian/rules 2013-11-07 08:45:29 +0000
175@@ -21,7 +21,6 @@
176 rm -r debian/tmp/usr/share/help/C/
177 # we do install pam through installpam and init through installinit
178 dh_install -X.a -X.la -Xpam.d -X'etc/init/lightdm.conf' --fail-missing
179- mv debian/lightdm/usr/lib/lightdm/lightdm/lightdm-set-defaults debian/lightdm/usr/lib/lightdm
180 chmod +x debian/lightdm/usr/lib/lightdm/lightdm-greeter-session
181
182 override_dh_installinit:
183
184=== modified file 'po/POTFILES.in'
185--- po/POTFILES.in 2011-11-29 03:22:56 +0000
186+++ po/POTFILES.in 2013-11-07 08:45:29 +0000
187@@ -2,5 +2,4 @@
188 # Please keep this file sorted alphabetically.
189 [encoding: UTF-8]
190 src/lightdm.c
191-utils/lightdm-set-defaults.c
192 utils/dm-tool.c
193
194=== modified file 'src/Makefile.am'
195--- src/Makefile.am 2013-09-19 17:23:31 +0000
196+++ src/Makefile.am 2013-11-07 08:45:29 +0000
197@@ -1,4 +1,5 @@
198 sbin_PROGRAMS = lightdm
199+bin_PROGRAMS = dm-tool
200
201 lightdm_SOURCES = \
202 accounts.c \
203@@ -77,7 +78,6 @@
204 lightdm_CFLAGS = \
205 $(LIGHTDM_CFLAGS) \
206 $(WARN_CFLAGS) \
207- -DPKGLIBEXEC_DIR=\"$(pkglibexecdir)\" \
208 -DSBIN_DIR=\"$(sbindir)\" \
209 -DCONFIG_DIR=\"$(sysconfdir)/lightdm\" \
210 -DLOG_DIR=\"$(localstatedir)/log/lightdm\" \
211@@ -93,6 +93,17 @@
212 -lgcrypt \
213 -lpam
214
215+dm_tool_SOURCES = \
216+ dm-tool.c
217+
218+dm_tool_CFLAGS = \
219+ $(LIGHTDM_CFLAGS) \
220+ -DCONFIG_DIR=\"$(sysconfdir)/lightdm\" \
221+ -DLOCALE_DIR=\"$(datadir)/locale\"
222+
223+dm_tool_LDADD = \
224+ $(LIGHTDM_LIBS)
225+
226 pkglibexec_PROGRAMS = lightdm-guest-session-wrapper
227
228 lightdm_guest_session_wrapper_SOURCES = lightdm-guest-session-wrapper.c
229
230=== renamed file 'utils/dm-tool.c' => 'src/dm-tool.c'
231=== modified file 'src/session-child.c'
232--- src/session-child.c 2013-10-21 22:55:16 +0000
233+++ src/session-child.c 2013-11-07 08:45:29 +0000
234@@ -530,11 +530,6 @@
235 g_free (value);
236 }
237
238- /* Put our tools directory in the path as a hack so we can use the legacy gdmflexiserver interface */
239- path = pam_getenv (pam_handle, "PATH");
240- if (path)
241- pam_putenv (pam_handle, g_strdup_printf ("PATH=%s:%s", PKGLIBEXEC_DIR, path));
242-
243 /* Catch terminate signal and pass it to the child */
244 signal (SIGTERM, signal_cb);
245
246
247=== modified file 'tests/Makefile.am'
248--- tests/Makefile.am 2013-10-31 00:17:40 +0000
249+++ tests/Makefile.am 2013-11-07 08:45:29 +0000
250@@ -52,7 +52,6 @@
251 test-xdg-current-desktop \
252 test-xdg-seat \
253 test-language-env \
254- test-util-path \
255 test-session-stdout \
256 test-session-stderr \
257 test-session-stderr-multi-write \
258@@ -451,7 +450,6 @@
259 scripts/user-layout.conf \
260 scripts/user-logged-in.conf \
261 scripts/user-name.conf \
262- scripts/util-path.conf \
263 scripts/user-renamed.conf \
264 scripts/user-renamed-invalid.conf \
265 scripts/user-session.conf \
266
267=== removed file 'tests/scripts/util-path.conf'
268--- tests/scripts/util-path.conf 2013-10-03 21:28:05 +0000
269+++ tests/scripts/util-path.conf 1970-01-01 00:00:00 +0000
270@@ -1,33 +0,0 @@
271-#
272-# Check utility path is set in session
273-#
274-
275-[SeatDefaults]
276-autologin-user=have-password1
277-user-session=default
278-
279-#?RUNNER DAEMON-START
280-
281-# X server starts
282-#?XSERVER-0 START VT=7
283-
284-# Daemon connects when X server is ready
285-#?*XSERVER-0 INDICATE-READY
286-#?XSERVER-0 INDICATE-READY
287-#?XSERVER-0 ACCEPT-CONNECT
288-
289-# Session starts
290-#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 DESKTOP_SESSION=default USER=have-password1
291-#?XSERVER-0 ACCEPT-CONNECT
292-#?SESSION-X-0 CONNECT-XSERVER
293-
294-# Check utility path is there
295-#?*SESSION-X-0 READ-ENV NAME=PATH
296-# FIXME: This is a really crap regex and the path could be overridden in the configure stage
297-#?SESSION-X-0 READ-ENV NAME=PATH VALUE=.*/lightdm:.*
298-
299-# Cleanup
300-#?*STOP-DAEMON
301-#?SESSION-X-0 TERMINATE SIGNAL=15
302-#?XSERVER-0 TERMINATE SIGNAL=15
303-#?RUNNER DAEMON-EXIT STATUS=0
304
305=== removed file 'tests/test-util-path'
306--- tests/test-util-path 2012-04-04 07:32:17 +0000
307+++ tests/test-util-path 1970-01-01 00:00:00 +0000
308@@ -1,2 +0,0 @@
309-#!/bin/sh
310-./src/dbus-env ./src/test-runner util-path test-gobject-greeter
311
312=== removed directory 'utils'
313=== removed file 'utils/Makefile.am'
314--- utils/Makefile.am 2012-01-12 10:20:17 +0000
315+++ utils/Makefile.am 1970-01-01 00:00:00 +0000
316@@ -1,30 +0,0 @@
317-bin_PROGRAMS = dm-tool
318-pkglibexec_PROGRAMS = lightdm-set-defaults
319-legacydir = $(libexecdir)/lightdm
320-dist_legacy_SCRIPTS = gdmflexiserver
321-
322-dm_tool_SOURCES = \
323- dm-tool.c
324-
325-dm_tool_CFLAGS = \
326- $(LIGHTDM_CFLAGS) \
327- -DCONFIG_DIR=\"$(sysconfdir)/lightdm\" \
328- -DLOCALE_DIR=\"$(datadir)/locale\"
329-
330-dm_tool_LDADD = \
331- $(LIGHTDM_LIBS)
332-
333-lightdm_set_defaults_SOURCES = \
334- lightdm-set-defaults.c
335-
336-lightdm_set_defaults_CFLAGS = \
337- $(LIGHTDM_CFLAGS) \
338- -DCONFIG_DIR=\"$(sysconfdir)/lightdm\" \
339- -DLOCALE_DIR=\"$(datadir)/locale\"
340-
341-lightdm_set_defaults_LDADD = \
342- $(LIGHTDM_LIBS)
343-
344-DISTCLEANFILES = \
345- Makefile.in
346-
347
348=== removed file 'utils/gdmflexiserver'
349--- utils/gdmflexiserver 2011-08-17 00:49:26 +0000
350+++ utils/gdmflexiserver 1970-01-01 00:00:00 +0000
351@@ -1,17 +0,0 @@
352-#!/bin/sh
353-#
354-# Copyright (C) 2011 Canonical Ltd
355-# Author: Michael Terry <michael.terry@canonical.com>
356-#
357-# This program is free software: you can redistribute it and/or modify it under
358-# the terms of the GNU General Public License as published by the Free Software
359-# Foundation, version 3 of the License.
360-#
361-# See http://www.gnu.org/copyleft/gpl.html for the full text of the license.
362-
363-if [ -z "$XDG_SEAT_PATH" ]; then
364- # something went wrong
365- exit 1
366-fi
367-
368-dbus-send --system --type=method_call --print-reply --dest=org.freedesktop.DisplayManager $XDG_SEAT_PATH org.freedesktop.DisplayManager.Seat.SwitchToGreeter
369
370=== removed file 'utils/lightdm-set-defaults.c'
371--- utils/lightdm-set-defaults.c 2013-09-05 05:42:21 +0000
372+++ utils/lightdm-set-defaults.c 1970-01-01 00:00:00 +0000
373@@ -1,277 +0,0 @@
374-/*
375- * Copyright (C) 2011 Didier Roche.
376- * Author: Didier Roche <didrocks@ubuntu.com>
377- *
378- * This program is free software: you can redistribute it and/or modify it under
379- * the terms of the GNU General Public License as published by the Free Software
380- * Foundation, either version 3 of the License, or (at your option) any later
381- * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
382- * license.
383- */
384-
385-#ifdef HAVE_CONFIG_H
386-#include "config.h"
387-#endif
388-
389-#include <stdlib.h>
390-#include <unistd.h>
391-
392-#include <glib.h>
393-#include <glib/gi18n.h>
394-
395-#define SEATDEFAULT_KEY_GROUP "SeatDefaults"
396-#define TYPE_KEY_NAME "type"
397-#define SESSION_KEY_NAME "user-session"
398-#define GREETER_KEY_NAME "greeter-session"
399-#define AUTOLOGIN_KEY_NAME "autologin-user"
400-#define HIDE_USERS_KEY_NAME "greeter-hide-users"
401-#define MANUAL_LOGIN_KEY_NAME "greeter-show-manual-login"
402-#define REMOTE_LOGIN_KEY_NAME "greeter-show-remote-login"
403-#define ALLOW_GUEST_KEY_NAME "allow-guest"
404-
405-#define IS_STRING_EMPTY(x) ((x)==NULL||(x)[0]=='\0')
406-
407-static gboolean debug = FALSE;
408-static gboolean keep_old = FALSE;
409-static gboolean remove = FALSE;
410-static gboolean hide_users = FALSE;
411-static gboolean show_manual_login = FALSE;
412-static gboolean show_remote_login = FALSE;
413-static gboolean allow_guest = FALSE;
414-
415-static char *type = NULL;
416-static char *session = NULL;
417-static char *greeter = NULL;
418-static char *autologin = NULL;
419-static char *str_hide_users = NULL;
420-static char *str_show_manual_login = NULL;
421-static char *str_show_remote_login = NULL;
422-static char *str_allow_guest = NULL;
423-
424-static GOptionEntry entries[] =
425-{
426- { "debug", 'd', 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging"), NULL },
427- { "keep-old", 'k', 0, G_OPTION_ARG_NONE, &keep_old, N_("Only update if no default already set"), NULL },
428- { "remove", 'r', 0, G_OPTION_ARG_NONE, &remove, N_("Remove default value if it's the current one"), NULL },
429- { "type", 't', 0, G_OPTION_ARG_STRING, &type, N_("Set default seat type"), NULL },
430- { "session", 's', 0, G_OPTION_ARG_STRING, &session, N_("Set default session"), NULL },
431- { "greeter", 'g', 0, G_OPTION_ARG_STRING, &greeter, N_("Set default greeter"), NULL },
432- { "autologin",'a', 0, G_OPTION_ARG_STRING, &autologin, N_("Set autologin user"), NULL },
433- { "hide-users",'i', 0, G_OPTION_ARG_STRING, &str_hide_users, N_("Set greeter-hide-users to true or false"), NULL },
434- { "show-manual-login",'m', 0, G_OPTION_ARG_STRING, &str_show_manual_login, N_("Set show-manual-login to true or false"), NULL },
435- { "show-remote-login",'R', 0, G_OPTION_ARG_STRING, &str_show_remote_login, N_("Set show-remote-login to true or false"), NULL },
436- { "allow-guest",'l', 0, G_OPTION_ARG_STRING, &str_allow_guest, N_("Set allow-guest to true or false"), NULL },
437- { NULL }
438-};
439-
440-void
441-show_nothing(const gchar *log_domain,
442- GLogLevelFlags log_level,
443- const gchar *message,
444- gpointer unused_data) {};
445-
446-int
447-update_boolean(const gboolean new_value,
448- gboolean keep_old,
449- const gchar *key_group,
450- const gchar *key_name,
451- GKeyFile *keyfile)
452-{
453- if (keep_old)
454- g_debug ("keep-old mode: keep previous default value");
455- else {
456- g_debug ("Update to %d for %s", new_value, key_name);
457- g_key_file_set_boolean (keyfile, key_group, key_name, new_value);
458- }
459- return(0);
460-}
461-
462-int
463-update_string(const gchar *default_value,
464- const gchar *new_value,
465- gboolean keep_old,
466- gboolean remove,
467- const gchar *key_group,
468- const gchar *key_name,
469- GKeyFile *keyfile)
470-{
471- if (!(default_value) || (strlen(default_value) < 1)) {
472- g_debug ("No existing valid value for %s. Set to %s", key_name, new_value);
473- g_key_file_set_string (keyfile, key_group, key_name, new_value);
474- }
475- else {
476- if (remove) {
477- if (g_strcmp0 (default_value, new_value) == 0) {
478- g_debug ("Remove %s as default value for %s", default_value, key_name);
479- g_key_file_set_string (keyfile, key_group, key_name, "");
480- return(0);
481- }
482- g_debug ("Can't remove: %s is not the default value for %s", default_value, key_name);
483- return(4);
484- }
485- else {
486- g_debug ("Found existing default value(%s) for %s", default_value, key_name);
487- if (keep_old)
488- g_debug ("keep-old mode: keep previous default value");
489- else {
490- g_debug ("Update to %s for %s", new_value, key_name);
491- g_key_file_set_string (keyfile, key_group, key_name, new_value);
492- }
493- }
494- }
495- return(0);
496-}
497-
498-int
499-str_to_bool(const gchar *str, gboolean *bool_out)
500-{
501- if (IS_STRING_EMPTY(str)) {
502- return -1;
503- }
504- else if (strncasecmp(str, "true", 4)==0) {
505- *bool_out = TRUE;
506- return 0;
507- }
508- else if (strncasecmp(str, "false", 5)==0) {
509- *bool_out = FALSE;
510- return 0;
511- }
512- else {
513- return -2;
514- }
515-}
516-
517-int
518-main (int argc, char *argv[])
519-{
520- GOptionContext *context = NULL;
521- GError *error = NULL;
522-
523- GKeyFile *keyfile;
524- GKeyFileFlags flags;
525- gchar *s_data;
526- gsize size;
527- const gchar *gdm_conf_file = CONFIG_DIR "/lightdm.conf";
528-
529- gchar *default_type = NULL;
530- gchar *default_session = NULL;
531- gchar *default_greeter = NULL;
532- gchar *default_autologin = NULL;
533- gint return_code = 0;
534-
535- bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
536- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
537- textdomain (GETTEXT_PACKAGE);
538-
539-#if !defined(GLIB_VERSION_2_36)
540- g_type_init ();
541-#endif
542-
543- context = g_option_context_new (N_("- set lightdm default values"));
544- g_option_context_add_main_entries (context, entries, NULL);
545- if (!g_option_context_parse (context, &argc, &argv, &error)) {
546- g_printerr (N_("option parsing failed: %s\n"), error->message);
547- g_option_context_free (context);
548- g_error_free (error);
549- return 1;
550- }
551- if (IS_STRING_EMPTY (type) && IS_STRING_EMPTY (session) && IS_STRING_EMPTY (greeter) && IS_STRING_EMPTY (autologin) && IS_STRING_EMPTY(str_hide_users) && IS_STRING_EMPTY(str_show_manual_login) && IS_STRING_EMPTY(str_show_remote_login) && IS_STRING_EMPTY(str_allow_guest)) {
552- g_printerr (N_("Wrong usage of the command\n%s"), g_option_context_get_help (context, FALSE, NULL));
553- g_option_context_free (context);
554- return 1;
555- }
556- if (context)
557- g_option_context_free (context);
558- if (!debug)
559- g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, show_nothing, NULL);
560-
561- keyfile = g_key_file_new ();
562- flags = G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS;
563- if (!(g_key_file_load_from_file (keyfile, gdm_conf_file, flags, &error))) {
564- g_debug ("File doesn't seem to exist or can't be read: create one (%s)", error->message);
565- g_error_free (error);
566- error = NULL;
567- }
568-
569- // try to get the right keys
570- default_type = g_key_file_get_string (keyfile, SEATDEFAULT_KEY_GROUP, TYPE_KEY_NAME, NULL);
571- default_session = g_key_file_get_string (keyfile, SEATDEFAULT_KEY_GROUP, SESSION_KEY_NAME, NULL);
572- default_greeter = g_key_file_get_string (keyfile, SEATDEFAULT_KEY_GROUP, GREETER_KEY_NAME, NULL);
573- default_autologin = g_key_file_get_string (keyfile, SEATDEFAULT_KEY_GROUP, AUTOLOGIN_KEY_NAME, NULL);
574-
575- if (!(IS_STRING_EMPTY (type)))
576- return_code = update_string (default_type, type, keep_old, remove, SEATDEFAULT_KEY_GROUP, TYPE_KEY_NAME, keyfile);
577- if (!(IS_STRING_EMPTY (session)))
578- return_code = update_string (default_session, session, keep_old, remove, SEATDEFAULT_KEY_GROUP, SESSION_KEY_NAME, keyfile);
579- if (!(IS_STRING_EMPTY (greeter)) && (return_code == 0))
580- return_code = update_string (default_greeter, greeter, keep_old, remove, SEATDEFAULT_KEY_GROUP, GREETER_KEY_NAME, keyfile);
581- if (!(IS_STRING_EMPTY (autologin)) && (return_code == 0))
582- return_code = update_string (default_autologin, autologin, keep_old, remove, SEATDEFAULT_KEY_GROUP, AUTOLOGIN_KEY_NAME, keyfile);
583- if (!(IS_STRING_EMPTY(str_hide_users)) && (return_code == 0)) {
584- if (str_to_bool(str_hide_users, &hide_users) == 0) {
585- return_code = update_boolean (hide_users, keep_old, SEATDEFAULT_KEY_GROUP, HIDE_USERS_KEY_NAME, keyfile);
586- }
587- else {
588- g_printerr (N_("true and false are the only valid choices for hide-users\n"));
589- return 1;
590- }
591- }
592- if (!(IS_STRING_EMPTY(str_allow_guest)) && (return_code == 0)) {
593- if (str_to_bool(str_allow_guest, &allow_guest) == 0) {
594- return_code = update_boolean (allow_guest, keep_old, SEATDEFAULT_KEY_GROUP, ALLOW_GUEST_KEY_NAME, keyfile);
595- }
596- else {
597- g_printerr (N_("true and false are the only valid choices for allow-guest\n"));
598- return 1;
599- }
600- }
601- if (!(IS_STRING_EMPTY(str_show_manual_login)) && (return_code == 0)) {
602- if (str_to_bool(str_show_manual_login, &show_manual_login) == 0) {
603- return_code = update_boolean (show_manual_login, keep_old, SEATDEFAULT_KEY_GROUP, MANUAL_LOGIN_KEY_NAME, keyfile);
604- }
605- else {
606- g_printerr (N_("true and false are the only valid choices for show-manual-login\n"));
607- return 1;
608- }
609- }
610- if (!(IS_STRING_EMPTY(str_show_remote_login)) && (return_code == 0)) {
611- if (str_to_bool(str_show_remote_login, &show_remote_login) == 0) {
612- return_code = update_boolean (show_remote_login, keep_old, SEATDEFAULT_KEY_GROUP, REMOTE_LOGIN_KEY_NAME, keyfile);
613- }
614- else {
615- g_printerr (N_("true and false are the only valid choices for show-remote-login\n"));
616- return 1;
617- }
618- }
619-
620- if (return_code == 0) {
621- s_data = g_key_file_to_data (keyfile, &size, &error);
622- if (!s_data) {
623- g_debug ("Can't convert data to string: %s", error->message);
624- g_error_free (error);
625- return_code = 1;
626- }
627- else {
628- if(!g_file_set_contents (gdm_conf_file, s_data, size, &error)) {
629- g_printerr ("Can't update: %s\n", error->message);
630- g_error_free (error);
631- return_code = 1;
632- }
633- g_free (s_data);
634- }
635- }
636-
637- g_key_file_free (keyfile);
638-
639- if (default_type)
640- g_free (default_type);
641- if (default_session)
642- g_free (default_session);
643- if (default_greeter)
644- g_free (default_greeter);
645- if (default_autologin)
646- g_free (default_autologin);
647-
648- return return_code;
649-
650-}

Subscribers

People subscribed via source and target branches