From ad3a39e7874daabb4056d14fffd492657c32948e Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 14 Jun 2008 12:01:45 +0200 Subject: Added bin/removelinks --- bin/removelinks | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 bin/removelinks (limited to 'bin/removelinks') 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; + } +} -- cgit v1.2.3