Merge branch 'master' into install-raid
[ipfire-2.x.git] / src / installer / dracut-module / 70-dhcpcd.exe
1 #/bin/bash
2 ########################################################################
3 # Begin
4 #
5 # Description : DHCP Client Script (initrd version)
6 #
7 # Authors : Arne Fitzenreiter - arne_f@ipfire.org
8 #
9 # Version : 02.00
10 #
11 # Notes :
12 #
13 ########################################################################
14
15 dhcpcd_up()
16 {
17 set | grep "^new_" | sed "s|^new_||g" | \
18 sed "s|'||g" | \
19 sort > /var/ipfire/dhcpc/dhcpcd-$interface.info
20
21 DNS=`grep "domain_name_servers" /var/ipfire/dhcpc/dhcpcd-$interface.info | cut -d"=" -f2`
22 DNS1=`echo $DNS | cut -d" " -f1`
23 DNS2=`echo $DNS | cut -d" " -f2`
24
25 echo "nameserver $DNS1" > /etc/resolv.conf
26 echo "nameserver $DNS2" >> /etc/resolv.conf
27
28 }
29
30 case "$reason" in
31 BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC) dhcpcd_up;;
32 esac