diff options
author | James Davidson <james.davidson@vyatta.com> | 2012-09-10 09:11:42 -0700 |
---|---|---|
committer | James Davidson <james.davidson@vyatta.com> | 2012-09-10 09:11:42 -0700 |
commit | c087276ca0827d7a58c93c9c7683af7311ef5c58 (patch) | |
tree | 991d1dc2b4f24a697bca7bc3e7099cda32c5617e /templates | |
parent | 9168bdd266fe7c92487356e190d07eb38bdd851a (diff) | |
download | vyatta-cfg-system-c087276ca0827d7a58c93c9c7683af7311ef5c58.tar.gz vyatta-cfg-system-c087276ca0827d7a58c93c9c7683af7311ef5c58.zip |
Update /etc/hosts when host name and domain name changes
Diffstat (limited to 'templates')
-rw-r--r-- | templates/system/domain-name/node.def | 4 | ||||
-rw-r--r-- | templates/system/host-name/node.def | 29 |
2 files changed, 5 insertions, 28 deletions
diff --git a/templates/system/domain-name/node.def b/templates/system/domain-name/node.def index 87f9e0fa..429fd47f 100644 --- a/templates/system/domain-name/node.def +++ b/templates/system/domain-name/node.def @@ -5,8 +5,8 @@ help: System domain name # Allow letter-number-hyphen in label (but can not start or end with hyphen) syntax:expression: exec "/opt/vyatta/sbin/vyatta_check_domainname.pl $VAR(../host-name).$VAR(@)" -# also add localhost line into /etc/hosts (see host-name template)? update: sudo /opt/vyatta/sbin/vyatta_update_resolv.pl + sudo /opt/vyatta/sbin/vyatta_update_hosts.pl -# also update localhost line in /etc/hosts (see host-name template)? delete: sudo /opt/vyatta/sbin/vyatta_update_resolv.pl + sudo /opt/vyatta/sbin/vyatta_update_hosts.pl
\ No newline at end of file diff --git a/templates/system/host-name/node.def b/templates/system/host-name/node.def index 8c733b9f..25f22e29 100644 --- a/templates/system/host-name/node.def +++ b/templates/system/host-name/node.def @@ -7,29 +7,6 @@ syntax:expression: pattern $VAR(@) "^[[:alnum:]][-.[:alnum:]]*[[:alnum:]]$" syntax:expression: pattern $VAR(@) "^.{1,63}$" ; "invalid host-name length" -update: sudo sh -c " \ - hostname '$VAR(@)' - echo '$VAR(@)' > /etc/hostname - touch /etc/hosts - sed -i '/^127.0.1.1/d' /etc/hosts - echo -e \"127.0.1.1\t $VAR(@)\t #vyatta entry\" >> /etc/hosts - if [ x$VAR(../domain-name/@) != x ]; then - echo -e \"127.0.1.1\t $VAR(@).$VAR(../domain-name/@)\t #vyatta entry\" \ - >> /etc/hosts - echo \"$VAR(@).$VAR(../domain-name/@)\" > /etc/mailname - else - echo \"$VAR(@)\" > /etc/mailname - fi" -delete: sudo sh -c " \ - echo 'vyatta' > /etc/hostname - hostname 'vyatta' - touch /etc/hosts - sed -i '/^127.0.1.1/d' /etc/hosts - echo -e \"127.0.1.1\t vyatta\t #vyatta entry\" >> /etc/hosts - if [ x$VAR(../domain-name/@) != x ]; then - echo -e \"127.0.1.1\t vyatta.$VAR(../domain-name/@)\t #vyatta entry\" \ - >> /etc/hosts - echo \"vyatta.$VAR(../domain-name/@)\" > /etc/mailname - else - echo \"vyatta\" > /etc/mailname - fi" +update: sudo /opt/vyatta/sbin/vyatta_update_hosts.pl + +delete: sudo /opt/vyatta/sbin/vyatta_update_hosts.pl |