From: Sapan Bhatia Date: Wed, 8 Apr 2009 16:19:07 +0000 (+0000) Subject: Backporting X-Git-Tag: vsys-scripts-0.9-2~2 X-Git-Url: http://git.onelab.eu/?p=vsys-scripts.git;a=commitdiff_plain;h=ab8d503505c6c5c9343c48ca100f55682ec218f6 Backporting --- diff --git a/exec/umount b/exec/umount new file mode 100755 index 0000000..f7c7fea --- /dev/null +++ b/exec/umount @@ -0,0 +1,27 @@ +#!/usr/bin/perl + +use strict; + +my $slicename=$ARGV[0]; +my $slice_dir="/vservers/$slicename/"; +my $localpath = ; + +chomp($localpath); +$localpath=~s/\.\.//g; + +$localpath=$slice_dir.$localpath; + +unless (-d $localpath) { + die("Localpath does not exist, please create it first."); +} + +unless($localpath=~/\/?[\w\d]+\/[\w\d]*\/?/) { + die("$localpath is not a path"); +} + +my $mntcmd="/bin/umount $localpath"; +system($mntcmd); + +if ($?) { + print "Mount failed: $?"; +}