summaryrefslogtreecommitdiff
path: root/bin/removelinks
blob: 87d5c5fbdaf3070eeb26e207ef12c2c174ddb54e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/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 '..';
	$_ = "$home/bin/$_";
	next unless (-l);
	if ((split(/\//, readlink))[2] eq $package) {
		unlink;
		print "Removed $_\n" if $verbose;
	}
}