From e49d748f4736c9c119e07b60ef843e91219a5a13 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Mon, 5 Dec 2011 02:47:51 +0000 Subject: chksession: add support for generic --generate=DIR and --wrap-sessions See mgabz #2740. This also allows migrating other users to the more readable and robust versions, avoiding the use of hardcoded directories in chksession. --- sbin/chksession | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'sbin') diff --git a/sbin/chksession b/sbin/chksession index 196414f..f61ef1c 100644 --- a/sbin/chksession +++ b/sbin/chksession @@ -18,12 +18,19 @@ Usage: $0 [OPTION]... -t, --test: Go in test mode. -l, --list: List window-managers. -L: List window-managers including the order number + -d=DIR, --dir=DIR: Specifies a directory of w-m configuration files. Default is /etc/X11/wmsession.d/ + -x=ENTRY, --xsession=ENTRY: Produce window-managers script of ENTRY. - -k, --kdm3: Produce window-managers list for kdm3 sessions. - -K, --kdm4: Produce window-managers list for kdm4 sessions. - -g, --gdm: Produce window-managers script for gdm sessions. + + --generate=DIR: Produce window-manager .desktop files into DIR. + --wrap-sessions: Wrap window-managers with /usr/share/X11/xdm/Xsession. + + -k, --kdm3: Shortcut for --generate=/opt/kde3/share/apps/kdm/sessions + -K, --kdm4: Shortcut for --generate=/usr/share/apps/kdm/sessions + -g, --gdm: Shortcut for --generate=/etc/X11/dm/Sessions --wrap-sessions + -h, --help: Produce this help. EOF @@ -83,6 +90,10 @@ while ($ARGV[0] =~ /^--/ || $ARGV[0] =~ /^-/) { $xsession = $1; } elsif (/^--first/ || /^-F/) { $first++; + } elsif (/^--generate=([^ ]+)/) { + $generate = $1; + } elsif (/^--wrap-sessions/) { + $wrap_sessions++; } elsif (/^--gdm/ || /^-g/) { die "You should be root to build gdm session\n" if $< != 0; $gdm++; @@ -123,6 +134,10 @@ my ($e) = eval {cat("/etc/sysconfig/desktop")} =~ /DESKTOP=(\S+)/; @lf = sort { $b =~ /^$e$/i <=> $a =~ /^$e$/i } @lf; +if ($generate) { + gen_desktops($generate, $wrap_sessions); +} + if ($kdm3) { gen_desktops('/opt/kde3/share/apps/kdm/sessions', 0); } -- cgit v1.2.1