Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 325605
Collapse All | Expand All

(-)a/client/scripts/bsdos (-12 / +19 lines)
Lines 1-34 Link Here
1
#!/bin/sh
1
#!/bin/sh
2
2
3
make_resolv_conf() {
3
make_resolv_conf() {
4
  if [ x"$PEER_DNS" != x ] && [ x"$PEER_DNS" != xyes ]; then
5
    return 0
6
  fi
7
  local conf=
4
  if [ x"$new_domain_name_servers" != x ]; then
8
  if [ x"$new_domain_name_servers" != x ]; then
5
    cat /dev/null > /etc/resolv.conf.dhclient
6
    if [ "x$new_domain_search" != x ]; then
9
    if [ "x$new_domain_search" != x ]; then
7
      echo search $new_domain_search >> /etc/resolv.conf.dhclient
10
      conf="${conf}search ${new_domain_search}\n"
8
    elif [ "x$new_domain_name" != x ]; then
11
    elif [ "x$new_domain_name" != x ]; then
9
      # Note that the DHCP 'Domain Name Option' is really just a domain
12
      # Note that the DHCP 'Domain Name Option' is really just a domain
10
      # name, and that this practice of using the domain name option as
13
      # name, and that this practice of using the domain name option as
11
      # a search path is both nonstandard and deprecated.
14
      # a search path is both nonstandard and deprecated.
12
      echo search $new_domain_name >> /etc/resolv.conf.dhclient
15
      conf="${conf}search ${new_domain_name}\n"
13
    fi
16
    fi
14
    for nameserver in $new_domain_name_servers; do
17
    for nameserver in $new_domain_name_servers; do
15
      echo nameserver $nameserver >> /etc/resolv.conf.dhclient
18
      conf="${conf}nameserver ${nameserver}\n"
16
    done
19
    done
17
18
    mv /etc/resolv.conf.dhclient /etc/resolv.conf
19
  elif [ "x${new_dhcp6_name_servers}" != x ] ; then
20
  elif [ "x${new_dhcp6_name_servers}" != x ] ; then
20
    cat /dev/null > /etc/resolv.conf.dhclient6
21
    chmod 644 /etc/resolv.conf.dhclient6
22
23
    if [ "x${new_dhcp6_domain_search}" != x ] ; then
21
    if [ "x${new_dhcp6_domain_search}" != x ] ; then
24
      echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
22
      conf="${conf}search ${new_dhcp6_domain_search}\n"
25
    fi
23
    fi
26
    for nameserver in ${new_dhcp6_name_servers} ; do
24
    for nameserver in ${new_dhcp6_name_servers} ; do
27
      echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
25
      conf="${conf}nameserver ${nameserver}\n"
28
    done
26
    done
27
  fi
29
28
30
    mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
29
  if [ x"$conf" != x ]; then
30
    conf="# Generated by dhclient or interface $interface\n${conf}"
31
    if type resolvconf >/dev/null 2>&1; then
32
      printf "${conf}" | resolvconf -a $interface
33
    else
34
      printf "${conf}" > /etc/resolv.conf
35
      chmod 644 /etc/resolv.conf
36
    fi
31
  fi
37
  fi
38
32
  # If we're making confs, may as well make an ntp.conf too
39
  # If we're making confs, may as well make an ntp.conf too
33
  make_ntp_conf
40
  make_ntp_conf
34
}
41
}
(-)a/client/scripts/freebsd (-56 / +29 lines)
Lines 11-78 Link Here
11
fi
11
fi
12
12
13
make_resolv_conf() {
13
make_resolv_conf() {
14
  if [ x"$PEER_DNS" != x ] && [ x"$PEER_DNS" != xyes ]; then
15
    return 0
16
  fi
17
  local conf=
14
  if [ x"$new_domain_name_servers" != x ]; then
18
  if [ x"$new_domain_name_servers" != x ]; then
15
    ( cat /dev/null > /etc/resolv.conf.dhclient )
19
    if [ "x$new_domain_search" != x ]; then
16
    exit_status=$?
20
      conf="${conf}search ${new_domain_search}\n"
17
    if [ $exit_status -ne 0 ]; then
21
    elif [ "x$new_domain_name" != x ]; then
18
      $LOGGER "Unable to create /etc/resolv.conf.dhclient: Error $exit_status"
22
      # Note that the DHCP 'Domain Name Option' is really just a domain
19
    else
23
      # name, and that this practice of using the domain name option as
20
      if [ "x$new_domain_search" != x ]; then
24
      # a search path is both nonstandard and deprecated.
21
	( echo search $new_domain_search >> /etc/resolv.conf.dhclient )
25
      conf="${conf}search ${new_domain_name}\n"
22
	exit_status=$?
23
      elif [ "x$new_domain_name" != x ]; then
24
	# Note that the DHCP 'Domain Name Option' is really just a domain
25
	# name, and that this practice of using the domain name option as
26
	# a search path is both nonstandard and deprecated.
27
	( echo search $new_domain_name >> /etc/resolv.conf.dhclient )
28
	exit_status=$?
29
      fi
30
      for nameserver in $new_domain_name_servers; do
31
	if [ $exit_status -ne 0 ]; then
32
	  break
33
	fi
34
	( echo nameserver $nameserver >>/etc/resolv.conf.dhclient )
35
	exit_status=$?
36
      done
37
38
      # If there were no errors, attempt to mv the new file into place.
39
      if [ $exit_status -eq 0 ]; then
40
	( mv /etc/resolv.conf.dhclient /etc/resolv.conf )
41
	exit_status=$?
42
      fi
43
44
      if [ $exit_status -ne 0 ]; then
45
	$LOGGER "Error while writing new /etc/resolv.conf."
46
      fi
47
    fi
26
    fi
27
    for nameserver in $new_domain_name_servers; do
28
      conf="${conf}nameserver ${nameserver}\n"
29
    done
48
  elif [ "x${new_dhcp6_name_servers}" != x ] ; then
30
  elif [ "x${new_dhcp6_name_servers}" != x ] ; then
49
    ( cat /dev/null > /etc/resolv.conf.dhclient6 )
31
    if [ "x${new_dhcp6_domain_search}" != x ] ; then
50
    exit_status=$?
32
      conf="${conf}search ${new_dhcp6_domain_search}\n"
51
    if [ $exit_status -ne 0 ] ; then
33
    fi
52
      $LOGGER "Unable to create /etc/resolv.conf.dhclient6: Error $exit_status"
34
    for nameserver in ${new_dhcp6_name_servers} ; do
53
    else
35
      conf="${conf}nameserver ${nameserver}\n"
54
      if [ "x${new_dhcp6_domain_search}" != x ] ; then
36
    done
55
	( echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6 )
37
  fi
56
	exit_status=$?
57
      fi
58
      for nameserver in ${new_dhcp6_name_servers} ; do
59
	if [ $exit_status -ne 0 ] ; then
60
	  break
61
	fi
62
        ( echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6 )
63
	exit_status=$?
64
      done
65
66
      if [ $exit_status -eq 0 ] ; then
67
        ( mv /etc/resolv.conf.dhclient6 /etc/resolv.conf )
68
	exit_status=$?
69
      fi
70
38
71
      if [ $exit_status -ne 0 ] ; then
39
  if [ x"$conf" != x ]; then
72
	$LOGGER "Error while writing new /etc/resolv.conf."
40
    conf="# Generated by dhclient or interface $interface\n${conf}"
73
      fi
41
    if type resolvconf >/dev/null 2>&1; then
42
      printf "${conf}" | resolvconf -a $interface
43
    else
44
      printf "${conf}" > /etc/resolv.conf
45
      chmod 644 /etc/resolv.conf
74
    fi
46
    fi
75
  fi
47
  fi
48
76
  # If we're making confs, may as well make an ntp.conf too
49
  # If we're making confs, may as well make an ntp.conf too
77
  make_ntp_conf
50
  make_ntp_conf
78
}
51
}
(-)a/client/scripts/linux (-15 / +21 lines)
Lines 26-60 Link Here
26
ip=/sbin/ip
26
ip=/sbin/ip
27
27
28
make_resolv_conf() {
28
make_resolv_conf() {
29
  if [ x"$PEER_DNS" != x ] && [ x"$PEER_DNS" != xyes ]; then
30
    return 0
31
  fi
32
  local conf=
29
  if [ x"$new_domain_name_servers" != x ]; then
33
  if [ x"$new_domain_name_servers" != x ]; then
30
    cat /dev/null > /etc/resolv.conf.dhclient
34
    if [ "x$new_domain_search" != x ]; then
31
    chmod 644 /etc/resolv.conf.dhclient
35
      conf="${conf}search ${new_domain_search}\n"
32
    if [ x"$new_domain_search" != x ]; then
36
    elif [ "x$new_domain_name" != x ]; then
33
      echo search $new_domain_search >> /etc/resolv.conf.dhclient
34
    elif [ x"$new_domain_name" != x ]; then
35
      # Note that the DHCP 'Domain Name Option' is really just a domain
37
      # Note that the DHCP 'Domain Name Option' is really just a domain
36
      # name, and that this practice of using the domain name option as
38
      # name, and that this practice of using the domain name option as
37
      # a search path is both nonstandard and deprecated.
39
      # a search path is both nonstandard and deprecated.
38
      echo search $new_domain_name >> /etc/resolv.conf.dhclient
40
      conf="${conf}search ${new_domain_name}\n"
39
    fi
41
    fi
40
    for nameserver in $new_domain_name_servers; do
42
    for nameserver in $new_domain_name_servers; do
41
      echo nameserver $nameserver >>/etc/resolv.conf.dhclient
43
      conf="${conf}nameserver ${nameserver}\n"
42
    done
44
    done
43
44
    mv /etc/resolv.conf.dhclient /etc/resolv.conf
45
  elif [ "x${new_dhcp6_name_servers}" != x ] ; then
45
  elif [ "x${new_dhcp6_name_servers}" != x ] ; then
46
    cat /dev/null > /etc/resolv.conf.dhclient6
47
    chmod 644 /etc/resolv.conf.dhclient6
48
49
    if [ "x${new_dhcp6_domain_search}" != x ] ; then
46
    if [ "x${new_dhcp6_domain_search}" != x ] ; then
50
      echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
47
      conf="${conf}search ${new_dhcp6_domain_search}\n"
51
    fi
48
    fi
52
    for nameserver in ${new_dhcp6_name_servers} ; do
49
    for nameserver in ${new_dhcp6_name_servers} ; do
53
      echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
50
      conf="${conf}nameserver ${nameserver}\n"
54
    done
51
    done
52
  fi
55
53
56
    mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
54
  if [ x"$conf" != x ]; then
55
    conf="# Generated by dhclient or interface $interface\n${conf}"
56
    if type resolvconf >/dev/null 2>&1; then
57
      printf "${conf}" | resolvconf -a $interface
58
    else
59
      printf "${conf}" > /etc/resolv.conf
60
      chmod 644 /etc/resolv.conf
61
    fi
57
  fi
62
  fi
63
58
  # If we're making confs, may as well make an ntp.conf too
64
  # If we're making confs, may as well make an ntp.conf too
59
  make_ntp_conf
65
  make_ntp_conf
60
}
66
}
(-)a/client/scripts/netbsd (-15 / +22 lines)
Lines 1-34 Link Here
1
#!/bin/sh
1
#!/bin/sh
2
2
3
make_resolv_conf() {
3
make_resolv_conf() {
4
  if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then
4
  if [ x"$PEER_DNS" != x ] && [ x"$PEER_DNS" != xyes ]; then
5
    cat /dev/null > /etc/resolv.conf.dhclient
5
    return 0
6
    if [ "x$new_domain_search != x ]; then
6
  fi
7
      echo search $new_domain_search >> /etc/resolv.conf.dhclient
7
  local conf=
8
    elif [ "x$new_domain_name != x ]; then
8
  if [ x"$new_domain_name_servers" != x ]; then
9
    if [ "x$new_domain_search" != x ]; then
10
      conf="${conf}search ${new_domain_search}\n"
11
    elif [ "x$new_domain_name" != x ]; then
9
      # Note that the DHCP 'Domain Name Option' is really just a domain
12
      # Note that the DHCP 'Domain Name Option' is really just a domain
10
      # name, and that this practice of using the domain name option as
13
      # name, and that this practice of using the domain name option as
11
      # a search path is both nonstandard and deprecated.
14
      # a search path is both nonstandard and deprecated.
12
      echo search $new_domain_name >> /etc/resolv.conf.dhclient
15
      conf="${conf}search ${new_domain_name}\n"
13
    fi
16
    fi
14
    for nameserver in $new_domain_name_servers; do
17
    for nameserver in $new_domain_name_servers; do
15
      echo nameserver $nameserver >>/etc/resolv.conf.dhclient
18
      conf="${conf}nameserver ${nameserver}\n"
16
    done
19
    done
17
18
    mv /etc/resolv.conf.dhclient /etc/resolv.conf
19
  elif [ "x${new_dhcp6_name_servers}" != x ] ; then
20
  elif [ "x${new_dhcp6_name_servers}" != x ] ; then
20
    cat /dev/null > /etc/resolv.conf.dhclient6
21
    chmod 644 /etc/resolv.conf.dhclient6
22
23
    if [ "x${new_dhcp6_domain_search}" != x ] ; then
21
    if [ "x${new_dhcp6_domain_search}" != x ] ; then
24
      echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
22
      conf="${conf}search ${new_dhcp6_domain_search}\n"
25
    fi
23
    fi
26
    for nameserver in ${new_dhcp6_name_servers} ; do
24
    for nameserver in ${new_dhcp6_name_servers} ; do
27
      echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
25
      conf="${conf}nameserver ${nameserver}\n"
28
    done
26
    done
27
  fi
29
28
30
    mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
29
  if [ x"$conf" != x ]; then
30
    conf="# Generated by dhclient or interface $interface\n${conf}"
31
    if type resolvconf >/dev/null 2>&1; then
32
      printf "${conf}" | resolvconf -a $interface
33
    else
34
      printf "${conf}" > /etc/resolv.conf
35
      chmod 644 /etc/resolv.conf
36
    fi
31
  fi
37
  fi
38
32
  # If we're making confs, may as well make an ntp.conf too
39
  # If we're making confs, may as well make an ntp.conf too
33
  make_ntp_conf
40
  make_ntp_conf
34
}
41
}
(-)a/client/scripts/openbsd (-15 / +22 lines)
Lines 1-34 Link Here
1
#!/bin/sh
1
#!/bin/sh
2
2
3
make_resolv_conf() {
3
make_resolv_conf() {
4
  if x"$new_domain_name_servers" != x ]; then
4
  if [ x"$PEER_DNS" != x ] && [ x"$PEER_DNS" != xyes ]; then
5
    cat /dev/null > /etc/resolv.conf.dhclient
5
    return 0
6
    if [ x"$new_domain_search" != x ]; then
6
  fi
7
      echo search $new_domain_search >> /etc/resolv.conf.dhclient
7
  local conf=
8
    elif [ x"$new_domain_name" != x ]; then
8
  if [ x"$new_domain_name_servers" != x ]; then
9
    if [ "x$new_domain_search" != x ]; then
10
      conf="${conf}search ${new_domain_search}\n"
11
    elif [ "x$new_domain_name" != x ]; then
9
      # Note that the DHCP 'Domain Name Option' is really just a domain
12
      # Note that the DHCP 'Domain Name Option' is really just a domain
10
      # name, and that this practice of using the domain name option as
13
      # name, and that this practice of using the domain name option as
11
      # a search path is both nonstandard and deprecated.
14
      # a search path is both nonstandard and deprecated.
12
      echo search $new_domain_name >> /etc/resolv.conf.dhclient
15
      conf="${conf}search ${new_domain_name}\n"
13
    fi
16
    fi
14
    for nameserver in $new_domain_name_servers; do
17
    for nameserver in $new_domain_name_servers; do
15
      echo nameserver $nameserver >>/etc/resolv.conf.dhclient
18
      conf="${conf}nameserver ${nameserver}\n"
16
    done
19
    done
17
18
    mv /etc/ersolv.conf.dhclient /etc/resolv.conf
19
  elif [ "x${new_dhcp6_name_servers}" != x ] ; then
20
  elif [ "x${new_dhcp6_name_servers}" != x ] ; then
20
    cat /dev/null > /etc/resolv.conf.dhclient6
21
    chmod 644 /etc/resolv.conf.dhclient6
22
23
    if [ "x${new_dhcp6_domain_search}" != x ] ; then
21
    if [ "x${new_dhcp6_domain_search}" != x ] ; then
24
      echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
22
      conf="${conf}search ${new_dhcp6_domain_search}\n"
25
    fi
23
    fi
26
    for nameserver in ${new_dhcp6_name_servers} ; do
24
    for nameserver in ${new_dhcp6_name_servers} ; do
27
      echo nameserver ${nameserver} >> /etc/resolv.conf.dhclient6
25
      conf="${conf}nameserver ${nameserver}\n"
28
    done
26
    done
27
  fi
29
28
30
    mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
29
  if [ x"$conf" != x ]; then
30
    conf="# Generated by dhclient or interface $interface\n${conf}"
31
    if type resolvconf >/dev/null 2>&1; then
32
      printf "${conf}" | resolvconf -a $interface
33
    else
34
      printf "${conf}" > /etc/resolv.conf
35
      chmod 644 /etc/resolv.conf
36
    fi
31
  fi
37
  fi
38
32
  # If we're making confs, may as well make an ntp.conf too
39
  # If we're making confs, may as well make an ntp.conf too
33
  make_ntp_conf
40
  make_ntp_conf
34
}
41
}
(-)a/client/scripts/solaris (-7 / +26 lines)
Lines 1-22 Link Here
1
#!/bin/sh  
1
#!/bin/sh  
2
2
3
make_resolv_conf() {
3
make_resolv_conf() {
4
  if [ x"$PEER_DNS" != x ] && [ x"$PEER_DNS" != xyes ]; then
5
    return 0
6
  fi
7
  local conf=
4
  if [ x"$new_domain_name_servers" != x ]; then
8
  if [ x"$new_domain_name_servers" != x ]; then
5
    cat /dev/null > /etc/resolv.conf.dhclient
9
    if [ "x$new_domain_search" != x ]; then
6
    if [ x"$new_domain_search" != x ]; then
10
      conf="${conf}search ${new_domain_search}\n"
7
      echo search $new_domain_search >> /etc/resolv.conf.dhclient
11
    elif [ "x$new_domain_name" != x ]; then
8
    elif [ x"$new_domain_name" != x ]; then
9
      # Note that the DHCP 'Domain Name Option' is really just a domain
12
      # Note that the DHCP 'Domain Name Option' is really just a domain
10
      # name, and that this practice of using the domain name option as
13
      # name, and that this practice of using the domain name option as
11
      # a search path is both nonstandard and deprecated.
14
      # a search path is both nonstandard and deprecated.
12
      echo search $new_domain_name >> /etc/resolv.conf.dhclient
15
      conf="${conf}search ${new_domain_name}\n"
13
    fi
16
    fi
14
    for nameserver in $new_domain_name_servers; do
17
    for nameserver in $new_domain_name_servers; do
15
      echo nameserver $nameserver >>/etc/resolv.conf.dhclient
18
      conf="${conf}nameserver ${nameserver}\n"
19
    done
20
  elif [ "x${new_dhcp6_name_servers}" != x ] ; then
21
    if [ "x${new_dhcp6_domain_search}" != x ] ; then
22
      conf="${conf}search ${new_dhcp6_domain_search}\n"
23
    fi
24
    for nameserver in ${new_dhcp6_name_servers} ; do
25
      conf="${conf}nameserver ${nameserver}\n"
16
    done
26
    done
27
  fi
17
28
18
    mv /etc/resolv.conf.dhclient /etc/resolv.conf
29
  if [ x"$conf" != x ]; then
30
    conf="# Generated by dhclient or interface $interface\n${conf}"
31
    if type resolvconf >/dev/null 2>&1; then
32
      printf "${conf}" | resolvconf -a $interface
33
    else
34
      printf "${conf}" > /etc/resolv.conf
35
      chmod 644 /etc/resolv.conf
36
    fi
19
  fi
37
  fi
38
20
  # If we're making confs, may as well make an ntp.conf too
39
  # If we're making confs, may as well make an ntp.conf too
21
  make_ntp_conf
40
  make_ntp_conf
22
}
41
}

Return to bug 325605