From 9fcc3dba8a299d9f6c2a2dc6d3d3fe63011d0f70 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Wed, 12 Feb 2014 02:21:40 +0100 Subject: get_config_dir: add function to get config dir based on context id --- lib/VServer.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/VServer.pm b/lib/VServer.pm index 8c70bde..cb2e351 100644 --- a/lib/VServer.pm +++ b/lib/VServer.pm @@ -1,7 +1,7 @@ #!/usr/bin/perl -T package VServer; -our $VERSION = '1.0'; +our $VERSION = '1.1'; use strict; use warnings; @@ -37,4 +37,14 @@ sub get_proc_dir($) { return undef; } +sub get_config_dir($) { + my $context = shift; + + my $dir = qx(/usr/sbin/vuname --xid $context --get context 2> /dev/null); + return undef unless ($? eq 0); + + chomp($dir); + return $dir; +} + 1; -- cgit v1.2.3-1-g7c22