diff options
Diffstat (limited to 'templates/system/static-host-mapping')
4 files changed, 68 insertions, 0 deletions
diff --git a/templates/system/static-host-mapping/host-name/node.def b/templates/system/static-host-mapping/host-name/node.def new file mode 100644 index 0000000..ea0000a --- /dev/null +++ b/templates/system/static-host-mapping/host-name/node.def @@ -0,0 +1,4 @@ +tag: +type: txt +help: "Map DNS names to system interfaces" +syntax: pattern $(@) "^[-a-zA-Z0-9.]+$" ; "invalid host name $(@)" diff --git a/templates/system/static-host-mapping/host-name/node.tag/alias/node.def b/templates/system/static-host-mapping/host-name/node.tag/alias/node.def new file mode 100644 index 0000000..b6f897f --- /dev/null +++ b/templates/system/static-host-mapping/host-name/node.tag/alias/node.def @@ -0,0 +1,33 @@ +multi: +type: txt +help: "Alias for this address" +create: "sh -c \"touch /etc/hosts && \ +sed -i '/$(../@).*#vyatta entry/d;/127\\.0\\.0\\.1.*#vyatta entry/d' \ +/etc/hosts && \ +echo \\\"$(../inet/@)\t $(../@) $(@) \t #vyatta entry\\\" \ +>> /etc/hosts && \ +if [ x$(../../../domain-name/@) == x ]; \ +then \ +echo \\\"127.0.0.1\t localhost $(../../../host-name/@)\t #vyatta entry\\\" \ +>> /etc/hosts; \ +else \ +echo \\\"127.0.0.1\t localhost \ +$(../../../host-name/@).$(../../../domain-name/@)\t #vyatta entry\\\" \ +>> /etc/hosts; \ +fi\" " +update: "sh -c \"touch /etc/hosts && \ +sed -i '/$(../@).*#vyatta entry/d;/127\\.0\\.0\\.1.*#vyatta entry/d' \ +/etc/hosts && \ +echo \\\"$(../inet/@)\t $(../@) $(@) \t #vyatta entry\\\" \ +>> /etc/hosts && \ +if [ x$(../../../domain-name/@) == x ]; \ +then \ +echo \\\"127.0.0.1\t localhost $(../../../host-name/@)\t #vyatta entry\\\" \ +>> /etc/hosts; \ +else \ +echo \\\"127.0.0.1\t localhost \ +$(../../../host-name/@).$(../../../domain-name/@)\t #vyatta entry\\\" \ +>> /etc/hosts; \ +fi\" " +delete: "sh -c \"touch /etc/hosts && \ +sed -i '/ $(../@) .*#vyatta entry/{/localhost/!d}' /etc/hosts\" " diff --git a/templates/system/static-host-mapping/host-name/node.tag/inet/node.def b/templates/system/static-host-mapping/host-name/node.tag/inet/node.def new file mode 100644 index 0000000..192273c --- /dev/null +++ b/templates/system/static-host-mapping/host-name/node.tag/inet/node.def @@ -0,0 +1,30 @@ +type: ipv4 +help: "Internet address" +create: "sh -c \"touch /etc/hosts && \ +sed -i '/$(../@).*#vyatta entry/d;/127\\.0\\.0\\.1.*#vyatta entry/d' \ +/etc/hosts && \ +echo \\\"$(@)\t $(../@) \t #vyatta entry\\\" >> /etc/hosts && \ +if [ x$(../../../domain-name/@) == x ]; \ +then \ +echo \\\"127.0.0.1\t localhost $(../../../host-name/@)\t #vyatta entry\\\" \ +>> /etc/hosts; \ +else \ +echo \\\"127.0.0.1\t localhost \ +$(../../../host-name/@).$(../../../domain-name/@)\t #vyatta entry\\\" \ +>> /etc/hosts; \ +fi\" " +update: "sh -c \"touch /etc/hosts && \ +sed -i '/$(../@).*#vyatta entry/d;/127\\.0\\.0\\.1.*#vyatta entry/d' \ +/etc/hosts && \ +echo \\\"$(@)\t $(../@) \t #vyatta entry\\\" >> /etc/hosts && \ +if [ x$(../../../domain-name/@) == x ]; \ +then \ +echo \\\"127.0.0.1\t localhost $(../../../host-name/@)\t #vyatta entry\\\" \ +>> /etc/hosts; \ +else \ +echo \\\"127.0.0.1\t localhost \ +$(../../../host-name/@).$(../../../domain-name/@)\t #vyatta entry\\\" \ +>> /etc/hosts; \ +fi\" " +delete: "sh -c \"touch /etc/hosts && \ +sed -i '/ $(../@) .*#vyatta entry/{/localhost/!d}' /etc/hosts\" " diff --git a/templates/system/static-host-mapping/node.def b/templates/system/static-host-mapping/node.def new file mode 100644 index 0000000..736413f --- /dev/null +++ b/templates/system/static-host-mapping/node.def @@ -0,0 +1 @@ +help: "Map DNS names to system interfaces" |