summaryrefslogtreecommitdiffstats
path: root/data/ip-dns-conf
blob: f14ecd8825eb6ac1a22bc1c625b0bfea21ebfb0a (plain) (blame)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/sh
# Copyright (c) 2013 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
#
# If you have any feedback please consult http://openslx.org/feedback and
# send your feedback to feedback@openslx.org
#
# General information about OpenSLX can be found under http://openslx.org
#
# Set IP and DNS configuration ...

#############################################################################

# Depends on running network interface, provides IP and DNS configuration

# Dns and ip configuration, hostname of the machine --> to be merged with udhcpc.default.script!!
echo "$host_name" >/proc/sys/kernel/hostname
echo -e "# /etc/hosts - file generated by $0 during OpenSLX stage3\
\n#\n# IP-Address  Full-Qualified-Hostname  Short-Hostname\n#\n\
127.0.0.1\tlocalhost\n::1\t\tlocalhost ipv6-localhost ipv6-loopback\n\
fe00::0\t\tipv6-localnet\nff00::0\t\tipv6-mcastprefix\nff02::1\
\t\tipv6-allnodes\nff02::2\t\tipv6-allrouters\nff02::3\t\t\
ipv6-allhosts\n" >/etc/hosts
if [ -n  "${domain_name}" ]; then
  echo -en "${clientip}\t" >>/etc/hosts
  for name in ${domain_name}; do
    echo -en "${host_name}.${name} " >>/etc/hosts
  done
  echo -e "${host_name}" >>/etc/hosts
else
  echo -e "${clientip}\t${host_name}" >>/etc/hosts
fi
# set up domainname and resolving
#rm -rf /etc/resolv.conf

out=/etc/resolv.conf
echo -e "# /etc/resolv.conf - file generated by\n#\t$0:\n\
#\t${date}\n#options timeout:1 attempts:1 rotate" > $out

[ "x${domain_name}" != "x" ] && echo -e "domain ${domain_name}" >> $out
[ "x${domain_search}" != "x" ] && echo -e "search ${domain_search}" >> $out
# fallback
[ "x${domain_search}" == "x" ] && [ "x${domain_name}" != "x" ] && \
  echo -e "search ${domain_name}" >> $out

[ -n "${domain_name_servers}" ] && {
  for name in ${domain_name_servers}; do
    echo nameserver ${name} >> $out;
  done; }

# Create hostname file
[ -n ${host_name} ] && [ -n ${domain_name} ] && \
  echo "${host_name}.${domain_name}" > /etc/hostname


# Set greeting and add information on booted system
len=$(expr length ${SLXVERSION}${SYSTEM_NAME})
if [ $len -le 28 ] ; then
  vdstr="Stateless Workstation (V${SLXVERSION}/${SYSTEM_NAME})"
  smax=28
else
  vdstr="V${SLXVERSION}/${SYSTEM_NAME}"
  smax=52
fi
while [ $len -le $smax ] ; do
  vdstr="$vdstr "
  len=$(($len + 1))
done
len=$(expr length ${host_name})
while [ $len -le 30 ] ; do
  space="$space "
  len=$(($len + 1))
done
echo "
   WELCOME TO                 $space        \n (\l)
           _____  ______  ______ __    __    _______ __     __    __
          /  _   |   _   |   ___|  |  |  |  |   ____|  |   |  |  |  |
         |  | |  |  |_|  |  |_  |   |    |  |  |___ |  |        /  /
         |  | |  |   ___/|   _|      |   |   ____   |  |     |    |
         |  |_|  |  |    |  |___|  |  |  |   ____|  |  |___ /  /
           _____/|__|    |______|__|  |__|  |_______|______|__|  |__|

   $vdstr (c) <OpenSLX.ORG>
" >/etc/issue