summaryrefslogtreecommitdiff
path: root/templates/system/static-host-mapping
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@sydney.vyatta.com>2007-10-24 10:01:04 -0700
committerAn-Cheng Huang <ancheng@sydney.vyatta.com>2007-10-24 10:01:04 -0700
commit1229e8c6f130c62c42900f424a772d4e9c5e8ef5 (patch)
treea89f7b29d4a7e62c803f3b0306922777681f319a /templates/system/static-host-mapping
parentb1fcb904eab1425d349fd7ab8d65b39c1bfb2e3f (diff)
downloadvyatta-cfg-system-1229e8c6f130c62c42900f424a772d4e9c5e8ef5.tar.gz
vyatta-cfg-system-1229e8c6f130c62c42900f424a772d4e9c5e8ef5.zip
add 'sudo' for 'system' and 'service/ssh' configuration commands.
Diffstat (limited to 'templates/system/static-host-mapping')
-rw-r--r--templates/system/static-host-mapping/host-name/node.tag/alias/node.def33
-rw-r--r--templates/system/static-host-mapping/host-name/node.tag/inet/node.def30
2 files changed, 17 insertions, 46 deletions
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
index b6f897f3..c8f5cdef 100644
--- 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
@@ -1,33 +1,18 @@
multi:
type: txt
help: "Alias for this address"
-create: "sh -c \"touch /etc/hosts && \
+update: "sudo sh -c \"touch /etc/hosts && \
sed -i '/$(../@).*#vyatta entry/d;/127\\.0\\.0\\.1.*#vyatta entry/d' \
-/etc/hosts && \
+ /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; \
+ >> /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 \
+ echo \\\"127.0.0.1\t localhost \
$(../../../host-name/@).$(../../../domain-name/@)\t #vyatta entry\\\" \
->> /etc/hosts; \
+ >> /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 && \
+delete: "sudo 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
index 192273c3..47a84733 100644
--- 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
@@ -1,30 +1,16 @@
type: ipv4
help: "Internet address"
-create: "sh -c \"touch /etc/hosts && \
+update: "sudo sh -c \"touch /etc/hosts && \
sed -i '/$(../@).*#vyatta entry/d;/127\\.0\\.0\\.1.*#vyatta entry/d' \
-/etc/hosts && \
+ /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; \
+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 \
+ echo \\\"127.0.0.1\t localhost \
$(../../../host-name/@).$(../../../domain-name/@)\t #vyatta entry\\\" \
->> /etc/hosts; \
+ >> /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 && \
+delete: "sudo sh -c \"touch /etc/hosts && \
sed -i '/ $(../@) .*#vyatta entry/{/localhost/!d}' /etc/hosts\" "