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
|
#!/bin/sh
#
# Description: universal (distro independent) configuration writer for
# several dhcp clients
#
# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 07-01-2006
# Blabla
# Blub
#
# Copyright: (c) 2006 - RZ Universitaet Freiburg
# functions common for all distros
. /etc/functions
# client variable should be exported via calling function
echo -e "\n# ip configuration written by $0" \
>>/etc/machine-setup
case $client in
dhcpcd)
cat /var/lib/dhcp/dhcpcd-eth0.info | sed -e "s,',\",g" \
-e "s,IPADDR,clientip," -e "s,NETMASK,subnet_mask," \
-e "s,GATEWAY,gateway," -e "s,BROADCAST,broadcast_address," \
-e "s,HOSTNAME,host_name," -e "s,DOMAIN,domain_name," \
-e "s,ROOTPATH,root_path," -e "s,DNS,domain_name_servers," \
-e "s,NTPSERVERS,ntp_servers," -e "s,DHCPSID,serverip," \
-e "s,WINSSERVERS,netbios_name_servers," \
-e "s,NETWORK,network," \
-e "s,DHCP..ADDR.*,," -e "s,.*TIME=.*,," -e "s,CL.*,," \
-e "s,INTER.*,," -e "s,DHCPSNAME.*,," \
>>/etc/machine-setup
# empty lines should be removed somehow
;;
dhclient)
set | grep "new_" | sed \
-e "s,^new_,," -e "s,fixed-address,clientip," \
-e "s,routers,gateway," -e "s,dhcp-server-identifier,serverip," \
-e "s,.*-time.*,," -e "s,language=,country=," \
>>/etc/machine-setup
;;
esac
|