#!/bin/sh # # Description: universal (distro independent) IP configuration writer for # several dhcp clients. The result is written in unified form # to the /etc/machine-setup file # # Author(s): Dirk von Suchodoletz , 18-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 $0 in *dhcpd*) cat /var/lib/dhcp/dhcpcd-eth0.info | sed -n -e '/^new/p' | 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 ;; *dhclient*) set | sed -n -e '/^new/p' | sed \ -e "s,^new_,," -e "s,fixed_address,clientip," \ -e "s,routers,gateway," -e "s,dhcp_server_identifier,serverip," \ -e "s,.*_t[iy][mp]e.*,," -e "s,.*_message_.*,," -e "/^$/d" \ -e "s,language=,country=," -e "s,ip_address,clientip," \ >>/etc/machine-setup ;; *pump*) # ;; esac