diff options
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/chksession | 131 | ||||
-rw-r--r-- | sbin/convertsession | 31 | ||||
-rwxr-xr-x | sbin/fndSession | 18 | ||||
-rwxr-xr-x | sbin/kdeDesktopCleanup | 30 |
4 files changed, 0 insertions, 210 deletions
diff --git a/sbin/chksession b/sbin/chksession deleted file mode 100644 index 37108a4..0000000 --- a/sbin/chksession +++ /dev/null @@ -1,131 +0,0 @@ -#!/usr/bin/perl -# (c) MandrakeSoft, Chmouel Boudjnah <chmouel@mandrakesoft.com> -# Copyright under GPL blah blah blah. -## you'll don't find much info here, see --help. - -my @lf; - -sub usage { - my $e = shift @_; - $0 =~ s|.*/||; - print { $e ? STDERR : STDOUT } << "EOF"; -Usage: $0 [OPTION]... - - -F --first: Print only first available entry. - -t, --test: Go in test mode. - -l, --list: List window-managers. - -f=FILE, --file=FILE: Specify an alternarte config files other - than /etc/X11/window-manager --x=ENTRY, --xsession=ENTRY: Product window-managers script of ENTRY. - -k, --kdm: Product window-managers list for kdm sessions. - -g, --gdm: Product window-managers script for gdm sessions. - -h, --help: Product this help. - -EOF - exit($e); -} - -sub parse_file { - my $f=shift @_; - open F, $f or die "Can't open $f\n"; - local $/ = ""; - while (<F>) { - $n = $1 if /^NAME=(.*)/m; - $e = $1 if /^EXEC=(.*)/m; - $d = $1 if /^DESC=(.*)/m; - $i = $1 if /^ICON=(.*)/m; - $s = $1 while /SCRIPT:(.*?)$/gs; chomp $s; - if (-x $e) { $script{$n} = $s; $exec{$n} = $e; $desc{$n} = $d; $icon{$n} = $i; push @lf, $n; } - } -} - -usage(1) - if @ARGV < 1; - -while ($ARGV[0] =~ /^--/ || $ARGV[0] =~ /^-/) { - $_ = shift; - if (/^--xsession=([^ ]+)/ || /^-x=([^ ]+)/) { - $xsession = $1; - } elsif (/^--first/ || /^-F/) { - $first++; - } elsif (/^--gdm/ || /^-g/) { - die "You should be root to build gdm session\n" if $< != 0; - $gdm++; - } elsif (/^--list/ || /^-l/) { - $list++; - } elsif (/^--kdmsess/ || /^-k/) { - $kdm++; - } elsif (/^--test/ || /^-t/) { - $test++; - } elsif (/^--dir=([^ ]+)/ || /^-d=([^ ]+)/) { - $dir = $1; - } elsif (/^--help/ || /^-h/ || /^-\?/) { - usage(0); - } else { - print STDERR "Unrecognized switch: $_\n"; - usage(1); - } -} - -$dir = $test ? './wmsession.d/' : '/etc/X11/wmsession.d/' unless $dir; -chdir $dir; parse_file ("$dir/$_") for <*>; - -sub cat { my ($f) = @_; local *F; open F, $f; join '', <F> } -my ($e) = cat("/etc/sysconfig/desktop") =~ /(\S+)/; -@lf = sort { $b =~ /$e/i <=> $a =~ /$e/i } @lf; - -if ($kdm) { - $session="SessionTypes="; - for(@lf) { $session .= /$lf[-1]/ ? "$_,failsafe,default" : "$_," } - print "$session\n"; - exit(0); -} - - -if ($gdm) { - my $d = '/etc/X11/gdm/Sessions/'; - chdir $d; - - #Any better way ? - opendir D, $d or die "Can't open $d\n"; - for ( readdir(D)) { next if /^\.\.?/;next if /^Failsafe/; chmod 0644, $_; } - closedir D; - - for my $file (@lf) { - open FH, ">/etc/X11/gdm/Sessions/$file" or die "Can't write to /etc/X11/gdm/Sessions/$file\n"; - print FH "#!/bin/sh\n"; - print FH "exec /etc/X11/xdm/Xsession $file\n"; - close FH; - chmod 0755, $file; - } - unlink 'Default'; - symlink shift @lf, 'Default'; -} - -if ($xsession) { - if ($script{$xsession}) { - print "#!/bin/sh\n"; - print $script{$xsession} - } else { - print "xterm -geometry 100x25+0+0 &\n"; - if ( -x '/usr/X11R6/bin/icewm' ) { - print "icewm\n"; - } elsif ( -x '/usr/X11R6/bin/twm' ) { - print "twm\n"; - } else { - print "xterm -geometry 67x14+384+446\n"; - } - } - exit (0); -} - -@lf ? print shift @lf, "\n" : print "Default\n" - if $first; - -if ($list) { - if (@lf) { - my $p; for(@lf) { $p .= /$lf[-1]/ ? "$_ default failsafe" : "$_ " } print "$p\n"; - } else { - print "Default\n"; - } -} diff --git a/sbin/convertsession b/sbin/convertsession deleted file mode 100644 index 794ef07..0000000 --- a/sbin/convertsession +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/perl -# -*- Mode: cperl -*- -# Copyright (C) 2000 by Chmouel Boudjnah <chmouel@mandrakesoft.com> -# Redistribution of this file is permitted under the terms of the GNU -# Public License (GPL) -## description: Convert a file /etc/X11/window-managers to a -## /etc/X11/wmsession.d/ style files. - -my $dir = '/etc/X11/wmsession.d/'; - -if ($ARGV[0] =~ /-f/ ) { - $file = $ARGV[1]; -} else { - $file = '/etc/X11/window-managers'; -} - -my $cnt = 0; - -open F, $file or die "Can't open $file\n"; -while (<F>) { - $/ = "--@@--"; - s|--@@--||g; - if ($cnt != 0) { - $content = "$_"; - $n = $1 if /^NAME=(.*)/m; - open C, ">$dir/$cnt$n" or die "Can't open $dir/$cnt$n\n"; - print C $content; - close C; - } - $cnt++; -} diff --git a/sbin/fndSession b/sbin/fndSession deleted file mode 100755 index 1f7ec8b..0000000 --- a/sbin/fndSession +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# fndSession (c) MandrakeSoft, Chmouel Boudjnah <chmouel@mandrakesoft.com> -## FindSession for kdm and gdm. - -[ -x /usr/sbin/chksession ] || { - echo "I can't find /usr/sbin/chksession" - echo "check your installation" - exit 1 -} - -if [ -e /usr/share/config/kdmrc ];then -LIST="`/usr/sbin/chksession -k`" perl -pi -e 's|^SessionTypes=.*|$ENV{LIST}|'\ - /usr/share/config/kdmrc -fi - -if [ -d /etc/X11/gdm/Sessions ];then - /usr/sbin/chksession -g -fi diff --git a/sbin/kdeDesktopCleanup b/sbin/kdeDesktopCleanup deleted file mode 100755 index 1ff6ea0..0000000 --- a/sbin/kdeDesktopCleanup +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/perl -# (c) MandrakeSoft, Pixel <pixel@mandrakesoft.com> -# Copyright under GPL - -@dirs = (qw(/etc/skel /root), glob("/home/*")); -@path = split ":", "/sbin:/usr/sbin:/usr/X11R6/bin:/bin:/usr/bin"; - -foreach $f (map { grep { /\.kdelnk$/ } eval { all("$_/Desktop") } } @dirs) { - open F, $f or next; - L: foreach (<F>) { - if (/^Exec=(?:kdesu\s+-c\s+)?"?(\S+)/) { - -x "$_/$1" and last L foreach '', @path; - } elsif (m|^URL=file:(/.*)|) { - -e $1 and last; - } else { next } - print STDERR "removing $f\n"; - unlink $f; - last; - } -} - -sub all { - my $d = shift; - local *F; - opendir F, $d or die "all: can't open dir $d: $!\n"; - my @l = grep { $_ ne '.' && $_ ne '..' } readdir F; - closedir F; - - map { "$d/$_" } @l; -} |