summaryrefslogtreecommitdiff
path: root/bin/removelinks
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-06-14 12:01:45 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2008-06-14 12:01:45 +0200
commitad3a39e7874daabb4056d14fffd492657c32948e (patch)
treef69fb0809dabceab95d687e06c621c4827eacf4c /bin/removelinks
parent6cedd14690f59db2157fcea9508472d19b2dd381 (diff)
Added bin/removelinks
Diffstat (limited to 'bin/removelinks')
-rwxr-xr-xbin/removelinks23
1 files changed, 23 insertions, 0 deletions
diff --git a/bin/removelinks b/bin/removelinks
new file mode 100755
index 0000000..c5e80c1
--- /dev/null
+++ b/bin/removelinks
@@ -0,0 +1,23 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+my $i;
+my $package = shift or die('not enough arguments');
+my $verbose = 1;
+my $home = $ENV{HOME} || '/home/derf';
+my @binaries;
+
+opendir(BIN, "$home/bin");
+@binaries = readdir(BIN);
+closedir(BIN);
+
+foreach(@binaries) {
+ next if $_ eq '.';
+ next if $_ eq '..';
+ next unless (-l);
+ if ((split(/\//, readlink))[2] eq $package) {
+ unlink("$home/bin/$_");
+ print "Removed $_\n" if $verbose;
+ }
+}