VINTERFACE="$6"
if [ "$VHOSTNAME" != "none" ]; then
- VHOSTNAME="--hostname $VHOSTNAME"
+ VHOSTNAME_OPT="--hostname $VHOSTNAME"
fi
if [ ! -z "$VINTERFACE" ]; then
- VINTERFACE="--interface $VINTERFACE"
+ VINTERFACE_OPT="--interface $VINTERFACE"
+ VIP="`echo $VINTERFACE | cut -d : -f 2 | cut -d '/' -f 1`"
fi
# create basic vserver
vserver $NAME build -n $NAME --context $CONTEXT \
- $VHOSTNAME $VINTERFACE -m debootstrap -- -d $RELEASE -m $DEBOOTSTRAP_MIRROR || exit 1
+ $VHOSTNAME_OPT $VINTERFACE_OPT -m debootstrap -- -d $RELEASE -m $DEBOOTSTRAP_MIRROR || exit 1
# copy in some some defaults
TARGET=/etc/vservers/$NAME/vdir/
cp /etc/apt/{preferences,sources.list} $TARGET/etc/apt/
-# this is needed so puppet can find the puppetmaster and creates the right
-# certificate
-#grep -v $NAME /etc/hosts > $TARGET/etc/hosts
-#echo "127.0.0.1 $NAME" >> $TARGET/etc/hosts
-echo "127.0.0.1 $NAME" > $TARGET/etc/hosts
+# add minimum /etc/hosts entries
+if [ "$VHOSTNAME" != "none" ]; then
+ echo "$VIP $VHOSTNAME" > $TARGET/etc/hosts
+fi
+
+echo "127.0.0.1 $NAME" >> $TARGET/etc/hosts
+
#mkdir -p $TARGET/var/lib/puppet/modules/dbp
#cp /var/lib/puppet/modules/dbp/puppet_current.deb $TARGET/var/lib/puppet/modules/dbp/