summaryrefslogtreecommitdiff
path: root/templates/system/host-name/node.def
blob: 8c733b9f3376b012dcb9cdf5889e5f806978123d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
priority: 100
type: txt
help: System host name (default: vyatta)
default: "vyatta"
syntax:expression: pattern $VAR(@) "^[[:alnum:]][-.[:alnum:]]*[[:alnum:]]$"
                   ; "invalid host name $VAR(@)"

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"