summaryrefslogtreecommitdiff
path: root/templates/system/static-host-mapping/host-name/node.def
blob: 693b55929d1fe4e61516d1a9e2f1a33723d5aa01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
tag:
type: txt
help: Host name for static address mapping

syntax:expression: pattern $VAR(@) "^[[:alnum:]][-.[:alnum:]]*[[:alnum:]]$"
                   ; "invalid host name $VAR(@)"


commit:expression: $VAR(./inet) != ""; "IP address for the static mapping must be set"

end: sudo sh -c "
  touch /etc/hosts
  sed -i '/ $VAR(@) .*#vyatta entry/d' /etc/hosts
  if [ -z \"$VAR(./inet/@)\" ]; then
     if [ -d /opt/vyatta/config/active/service/dns/forwarding ]; then /etc/init.d/dnsmasq restart >&/dev/null; fi
     exit 0
  fi
  declare -a aliases=( $VAR(alias/@@) )
  echo -e \"$VAR(inet/@)\\t $VAR(@) \${aliases[*]} \\t #vyatta entry\" >> /etc/hosts
  if [ -d /opt/vyatta/config/active/service/dns/forwarding ]; then /etc/init.d/dnsmasq restart >&/dev/null; fi"