aboutsummaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorChmouel Boudjnah <chmouel@mandriva.org>2000-07-11 21:43:14 +0000
committerChmouel Boudjnah <chmouel@mandriva.org>2000-07-11 21:43:14 +0000
commita58fcd8b62d1cfabe5fe86dde4b418de39c7708f (patch)
tree4fa9fc84840fb2f66511b5130567eb4303310a4e /sbin
parent6791af034baf8b48c0573c7dabe8b1863b3be24f (diff)
downloadcommon-data-a58fcd8b62d1cfabe5fe86dde4b418de39c7708f.tar
common-data-a58fcd8b62d1cfabe5fe86dde4b418de39c7708f.tar.gz
common-data-a58fcd8b62d1cfabe5fe86dde4b418de39c7708f.tar.bz2
common-data-a58fcd8b62d1cfabe5fe86dde4b418de39c7708f.tar.xz
common-data-a58fcd8b62d1cfabe5fe86dde4b418de39c7708f.zip
sbin/chksession: make window-managers file dynamic by simple entry in /etc/X11/wmsession.d/
sbin/convertsession: a new greatest hit. mandrake_desk.spec: %post with convertsession
Diffstat (limited to 'sbin')
-rw-r--r--sbin/chksession29
1 files changed, 9 insertions, 20 deletions
diff --git a/sbin/chksession b/sbin/chksession
index 77a067d..c21b034 100644
--- a/sbin/chksession
+++ b/sbin/chksession
@@ -17,7 +17,6 @@ Usage: $0 [OPTION]...
-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.
--r=ENTRY, --remove=ENTRY: remove an entry (product to stdin).
-k, --kdm: Product window-managers list for kdm sessions.
-g, --gdm: Product window-managers script for gdm sessions.
-h, --help: Product this help.
@@ -29,7 +28,7 @@ EOF
sub parse_file {
my $f=shift @_;
open F, $f or die "Can't open $f\n";
- local $/ = "--@@--";
+ local $/ = "";
while (<F>) {
$n = $1 if /^NAME=(.*)/m;
$e = $1 if /^EXEC=(.*)/m;
@@ -40,17 +39,6 @@ sub parse_file {
}
}
-sub remove_entry {
- my $e = shift @_;
- my $f = shift @_;
- open F, $f or die "Can't open $f\n";
- local $/ = "--@@--";
- while (<F>) {
- next if /^NAME=$e/m;
- print;
- }
-}
-
usage(1)
if @ARGV < 1;
@@ -69,10 +57,8 @@ while ($ARGV[0] =~ /^--/ || $ARGV[0] =~ /^-/) {
$kdm++;
} elsif (/^--test/ || /^-t/) {
$test++;
- } elsif (/^--file=([^ ]+)/ || /^-f=([^ ]+)/) {
- $file = $1;
- } elsif (/^--remove=([^ ]+)/ || /^-r=([^ ]+)/) {
- $remove=$1;
+ } elsif (/^--dir=([^ ]+)/ || /^-d=([^ ]+)/) {
+ $dir = $1;
} elsif (/^--help/ || /^-h/ || /^-\?/) {
usage(0);
} else {
@@ -81,9 +67,12 @@ while ($ARGV[0] =~ /^--/ || $ARGV[0] =~ /^-/) {
}
}
-$file = $test ? './window-managers' : '/etc/X11/window-managers' unless $file;
-die "$file don't exist\n" unless -r $file;
-$remove ? remove_entry($remove, $file) : parse_file ($file);
+$dir = $test ? './wmsession.d/' : '/etc/X11/wmsession.d/' unless $dir;
+opendir D, $dir or die "Can't open $dir\n";
+for (readdir(D)) {
+ my $file = $_;
+ parse_file ("$dir/$file");
+}
sub cat { my ($f) = @_; local *F; open F, $f; join '', <F> }
my ($e) = cat("/etc/sysconfig/desktop") =~ /(\S+)/;