Koozali.org: home of the SME Server

Trouble with Custom Template

Offline rick1908

  • ***
  • 56
  • +0/-0
    • http://theevansfamily.com/
Trouble with Custom Template
« on: November 28, 2007, 07:19:25 AM »
I am trying to create a custom template for /etc/dhcpd.conf with "{" in the fragment. When I expand the template everything inside the fragments is removed.


Here is the fragment code;
Code: [Select]
#Start vmware subnets

subnet 172.16.180.0 netmask 255.255.255.0 {
# Note: No range is given, vmnet-dhcpd will deal with this subnet.
}

subnet 192.168.2.0 netmask 255.255.255.0 {
# Note: No range is given, vmnet-dhcpd will deal with this subnet.
}

#End vmware subnets
When I execute:
Code: [Select]
expand-template /etc/dhcpd.conf
The resulting /etc/dhcpd.conf looks like this:
Code: [Select]
#Start vmware subnets

subnet 172.16.180.0 netmask 255.255.255.0

subnet 192.168.2.0 netmask 255.255.255.0

#End vmware subnets

How might I get the template to expand with out executing what is inside the brackets in the fragment?

Thanks,
Rick Evans
Seeeeeeeeeeeeeeee ya,
Rick :pint:

Offline thomasch

  • *
  • 232
  • +0/-0
Re: Trouble with Custom Template
« Reply #1 on: November 28, 2007, 07:51:48 AM »
Rick,

the secret is to use

Code: [Select]
$OUT .= "\}"
the fragment maybe looks like this :

Code: [Select]
#Start vmware subnets

$OUT .= "subnet 172.16.180.0 netmask 255.255.255.0\n\{";
# Note: No range is given, vmnet-dhcpd will deal with this subnet.
$OUT .= "\}"

$OUT .= "subnet 192.168.2.0 netmask 255.255.255.0\n\{";

# Note: No range is given, vmnet-dhcpd will deal with this subnet.
$OUT .= "\}"

#End vmware subnets

Off topic : Why do you want to do this?

Offline rick1908

  • ***
  • 56
  • +0/-0
    • http://theevansfamily.com/
Re: Trouble with Custom Template
« Reply #2 on: November 28, 2007, 08:04:25 AM »
Thanks for replying...

...I was just following the instructions given from te vmware server setup. Not really sure to be frank.

Here is the output from the install:
Code: [Select]
DHCP Server exclusions
Probing for an unused private subnet (this can take some time)...

The subnet 172.16.180.0/255.255.255.0 appears to be unused.

This system appears to have a DHCP server configured for normal use.  Beware
that you should teach it how not to interfere with VMware Server's DHCP server.
There are two ways to do this:

1) Modify the file /etc/dhcpd.conf to add something like:

subnet 172.16.180.0 netmask 255.255.255.0 {
# Note: No range is given, vmnet-dhcpd will deal with this subnet.
}

2) Start your DHCP server with an explicit list of network interfaces to deal
with (leaving out vmnet8). e.g.:

dhcpd eth0

Consult the dhcpd(8) and dhcpd.conf(5) manual pages for details.

Hit enter to continue.

Is this correct?

Thanks,
Rick
Seeeeeeeeeeeeeeee ya,
Rick :pint:

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Trouble with Custom Template
« Reply #3 on: November 28, 2007, 05:00:57 PM »
I am trying to create a custom template for /etc/dhcpd.conf with "{" in the fragment.

Wherever you want "{", use "\{". Wherever you want "}", use "\}".

Offline thomasch

  • *
  • 232
  • +0/-0
Re: Trouble with Custom Template
« Reply #4 on: November 29, 2007, 05:10:17 AM »
Thanks for replying...

...I was just following the instructions given from te vmware server setup. Not really sure to be frank.

Here is the output from the install:
Code: [Select]
DHCP Server exclusions

[cut]

Consult the dhcpd(8) and dhcpd.conf(5) manual pages for details.


Is this correct?

Thanks,
Rick

Consult dhcpd.conf manual as advised by vmware script.

see /etc/e-smith/templates/etc/dhcpd.conf as there is the dhcpd.conf template
but DO NOT modify anything in there.. as this practise is not recommended
copy EVERYTHING into /etc/e-smith/templates-custom/etc/dhcpd.conf and edit the fragments from there instead


Offline rick1908

  • ***
  • 56
  • +0/-0
    • http://theevansfamily.com/
Re: Trouble with Custom Template
« Reply #5 on: November 29, 2007, 01:15:41 PM »
That is exactly what I did. I would have expected that a question regarding "Custom Templates" would have made that all too clear.

Thanks for the reminder tho,
Rick
Seeeeeeeeeeeeeeee ya,
Rick :pint: