Adds a conditional check to see whether COW support is enabled in the kernel.
authorStephen Soltesz <soltesz@cs.princeton.edu>
Fri, 21 Mar 2008 22:36:14 +0000 (22:36 +0000)
committerStephen Soltesz <soltesz@cs.princeton.edu>
Fri, 21 Mar 2008 22:36:14 +0000 (22:36 +0000)
sets the iunlink attribute accordingly.

vserver-reference.init

index 4458a38..1da2e99 100755 (executable)
@@ -57,7 +57,19 @@ setattr --barrier "$__DEFAULT_VSERVERDIR"
 
 # Set the attribute to unlink so vclone does the right thing wrt to 
 # conserving space by linking and not copying unified files.
-find "$__DEFAULT_VSERVERDIR/.vref"/* -type f -print0 | xargs -0 setattr --iunlink
+
+if [ -f /proc/virtual/info ] ; then
+       x=$[ 16#`awk '/^VCIKernel:/ { print $2 }' /proc/virtual/info` ]; 
+       y=$[ (x >> 9) & 1]
+       if test "$y" = 1 ; then 
+               # COW support
+               find "$__DEFAULT_VSERVERDIR/.vref/default" -type f -print0 | xargs -0 setattr --iunlink
+       else 
+               # no COW; 
+               find "$__DEFAULT_VSERVERDIR/.vref/default" -type f -print0 | xargs -0 setattr --~iunlink
+       fi
+fi
+
 
 # Build reference images for system slices
 # xxx if several instances of systemslices get installed, only one gets instanciated