aboutsummaryrefslogtreecommitdiffstats
path: root/sbin/kdeDesktopCleanup
diff options
context:
space:
mode:
authorDexter Morgan <dmorgan@mageia.org>2011-06-02 20:30:42 +0000
committerDexter Morgan <dmorgan@mageia.org>2011-06-02 20:30:42 +0000
commitac5099ebf8fced835c2108ce4d2d327762d0e595 (patch)
treec9d6bb9a8e3a7e3de6a100e2ae300922003f995e /sbin/kdeDesktopCleanup
downloadcommon-data-ac5099ebf8fced835c2108ce4d2d327762d0e595.tar
common-data-ac5099ebf8fced835c2108ce4d2d327762d0e595.tar.gz
common-data-ac5099ebf8fced835c2108ce4d2d327762d0e595.tar.bz2
common-data-ac5099ebf8fced835c2108ce4d2d327762d0e595.tar.xz
common-data-ac5099ebf8fced835c2108ce4d2d327762d0e595.zip
Branch for updates
Diffstat (limited to 'sbin/kdeDesktopCleanup')
-rwxr-xr-xsbin/kdeDesktopCleanup30
1 files changed, 30 insertions, 0 deletions
diff --git a/sbin/kdeDesktopCleanup b/sbin/kdeDesktopCleanup
new file mode 100755
index 0000000..323dcc5
--- /dev/null
+++ b/sbin/kdeDesktopCleanup
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+# (c) Mandriva, Pixel <pixel@mandriva.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;
+}