From: Stephen Soltesz Date: Fri, 21 Mar 2008 22:36:14 +0000 (+0000) Subject: Adds a conditional check to see whether COW support is enabled in the kernel. X-Git-Tag: VserverReference-4.2-3~4 X-Git-Url: http://git.onelab.eu/?p=vserver-reference.git;a=commitdiff_plain;h=787d86d08033f1d7fb9adf5c7e43ea6911ecd92d Adds a conditional check to see whether COW support is enabled in the kernel. sets the iunlink attribute accordingly. --- diff --git a/vserver-reference.init b/vserver-reference.init index 4458a38..1da2e99 100755 --- a/vserver-reference.init +++ b/vserver-reference.init @@ -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