-# This tells the Boot Manager that it is okay to update
-# /etc/resolv.conf and /etc/hosts whenever the network configuration
-# changes. Users are free to delete this file.
-touch $vroot/etc/AUTO_UPDATE_NET_FILES
+for systemvserver in reference-vservers/*.lst ; do
+ NAME=$(basename $systemvserver .lst)
+
+ # "Parse" out the packages and groups for yum
+ systempackages=$(grep "^package:.*" $systemvserver | awk '{print $2}')
+ systemgroups=$(grep "^group:.*" $systemvserver | awk '{print $2}')
+
+ vdir=${vstubdir}/${NAME}
+ install -d -m 755 ${vdir}
+
+ # Clone the base vserver reference to the system vserver reference
+ # OPTIMIZATION: Consider using "cp -al" in the future
+ rsync -a ${vref}/ ${vdir}/
+ rm -f ${vdir}/var/lib/rpm/__db*
+
+ # Communicate to the initialization script from which vref this stub was cloned
+ echo ${vrefname} > ${vdir}.cloned
+
+ # Construct the excludes & includes patterns for rsync
+ (cd ${vdir} && find *) > ${vdir}.excludes
+ echo "var/lib/rpm/*" > ${vdir}.includes
+
+ # Install the system vserver specific packages
+ [ -n "$systempackages" ] && yum -c ${vdir}/etc/yum.conf --installroot=${vdir} -y install $systempackages
+ [ -n "$systemgroups" ] && yum -c ${vdir}/etc/yum.conf --installroot=${vdir} -y groupinstall $systemgroups
+
+ # Create a copy of the system vserver w/o the vserver reference files
+ mkdir -p ${vdir}-tmp/
+ rsync -a --include-from=${vdir}.includes --exclude-from=${vdir}.excludes ${vdir}/ ${vdir}-tmp/
+ rm -rf ${vdir}
+ rm -f ${vdir}.excludes ${vdir}.includes
+ mv ${vdir}-tmp ${vdir}
+done