summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-01-31 21:07:37 +0100
committerDaniel Friesel <derf@finalrewind.org>2011-01-31 21:07:37 +0100
commit724eb33c2a3fb121731f254c20af10107ef74086 (patch)
tree4decbe20118cf6921167ba6fac93f1069cec1e30 /bin
parentb11c3ec341b6282c21c23e2226cce41434651d61 (diff)
Remove hardcoded share path
Diffstat (limited to 'bin')
-rwxr-xr-xbin/vnet13
1 files changed, 12 insertions, 1 deletions
diff --git a/bin/vnet b/bin/vnet
index 7e78295..aa4f7c0 100755
--- a/bin/vnet
+++ b/bin/vnet
@@ -15,7 +15,7 @@ use LWP::Simple;
my %opts;
my $alpha;
-my $share = "$ENV{HOME}/packages/visual/share";
+my $share = $0;
my ($ext_ip, $int_ip);
sub get_ext_ip {
@@ -68,6 +68,17 @@ sub show_net_console {
);
}
+if (-l $share) {
+ my $link = readlink($share);
+ $share =~ s{ [^/]+ $ }{}x;
+ $link =~ s{ / bin / vnet $ }{}x;
+ $share .= "${link}/share";
+}
+else {
+ $share =~ s{ / bin / vnet $ }{}x;
+ $share .= '/share';
+}
+
getopts('a:cfg', \%opts);
$alpha = $opts{'a'} // 0;