Backporting
authorSapan Bhatia <sapanb@cs.princeton.edu>
Wed, 8 Apr 2009 16:19:07 +0000 (16:19 +0000)
committerSapan Bhatia <sapanb@cs.princeton.edu>
Wed, 8 Apr 2009 16:19:07 +0000 (16:19 +0000)
exec/umount [new file with mode: 0755]

diff --git a/exec/umount b/exec/umount
new file mode 100755 (executable)
index 0000000..f7c7fea
--- /dev/null
@@ -0,0 +1,27 @@
+#!/usr/bin/perl
+
+use strict;
+
+my $slicename=$ARGV[0];
+my $slice_dir="/vservers/$slicename/";
+my $localpath = <STDIN>;
+
+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: $?";
+}