summaryrefslogtreecommitdiff
path: root/templates/system/host-name/node.def
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@sydney.vyatta.com>2007-10-19 11:26:15 -0700
committerAn-Cheng Huang <ancheng@sydney.vyatta.com>2007-10-19 11:26:15 -0700
commit07183520f3f4d2f89e526055db418046d0d2450f (patch)
tree7968eac48a0a57ff97ec4769d999bf31348a2a12 /templates/system/host-name/node.def
parent66b621cf7759c3448ae8bfe7d7479fb13ea04b65 (diff)
downloadvyatta-cfg-quagga-07183520f3f4d2f89e526055db418046d0d2450f.tar.gz
vyatta-cfg-quagga-07183520f3f4d2f89e526055db418046d0d2450f.zip
move "system" configuration templates/scripts from vyatta-cfg.
Diffstat (limited to 'templates/system/host-name/node.def')
-rw-r--r--templates/system/host-name/node.def24
1 files changed, 24 insertions, 0 deletions
diff --git a/templates/system/host-name/node.def b/templates/system/host-name/node.def
new file mode 100644
index 00000000..fc7c91ba
--- /dev/null
+++ b/templates/system/host-name/node.def
@@ -0,0 +1,24 @@
+type: txt
+help: "Configure system host name"
+default: "vyatta"
+syntax: pattern $(@) "^[-a-zA-Z0-9.]+$" ; "invalid host name $(@)"
+create: "sh -c \"hostname '$(@)' && \
+touch /etc/hosts && \
+sed -i '/localhost/d' /etc/hosts && \
+echo \\\"127.0.0.1\t localhost $(@)\t #vyatta entry\\\" >> /etc/hosts && \
+if [ x$(../domain-name/@) != x ]; then \
+echo \\\"127.0.0.1\t localhost $(@).$(../domain-name/@)\t #vyatta entry\\\" \>> /etc/hosts; fi\" "
+# do we need to add ntpd restart here?
+update: "sh -c \"hostname '$(@)' && \
+touch /etc/hosts && \
+sed -i '/localhost/d' /etc/hosts && \
+echo \\\"127.0.0.1\t localhost $(@)\t #vyatta entry\\\" >> /etc/hosts && \
+if [ x$(../domain-name/@) != x ]; then \
+echo \\\"127.0.0.1\t localhost $(@).$(../domain-name/@)\t #vyatta entry\\\" \
+>> /etc/hosts; fi\" "
+# do we need to add ntpd restart here?
+delete: "sh -c \"echo > /etc/hostname.conf && hostname '' && \
+touch /etc/hosts && \
+sed -i '/localhost.*#vyatta entry/d' /etc/hosts && \
+if [ -f /etc/ntp/ntp.conf ] && grep -q 'server' /etc/ntp/ntp.conf; then \
+/opt/vyatta/sbin/ntpd.init restart; fi\" "