#!/bin/sh

#
#        +-----------------------------------------------------------------------------+
#        | Endian Firewall                                                             |
#        +-----------------------------------------------------------------------------+
#        | Copyright (c) 2005-2006 Endian                                              |
#        |         Endian GmbH/Srl                                                     |
#        |         Bergweg 41 Via Monte                                                |
#        |         39057 Eppan/Appiano                                                 |
#        |         ITALIEN/ITALIA                                                      |
#        |         info@endian.it                                                      |
#        |                                                                             |
#        | This program is free software; you can redistribute it and/or               |
#        | modify it under the terms of the GNU General Public License                 |
#        | as published by the Free Software Foundation; either version 2              |
#        | of the License, or (at your option) any later version.                      |
#        |                                                                             |
#        | This program is distributed in the hope that it will be useful,             |
#        | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
#        | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
#        | GNU General Public License for more details.                                |
#        |                                                                             |
#        | You should have received a copy of the GNU General Public License           |
#        | along with this program; if not, write to the Free Software                 |
#        | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
#        | http://www.fsf.org/                                                         |
#        +-----------------------------------------------------------------------------+
#


assigned_ip=$new_ip_address
test -z "$assigned_ip" && assigned_ip=$old_ip_address

subnet_mask=$new_subnet_mask
test -z "$new_subnet_mask" && subnet_mask=$old_subnet_mask

dns=$new_domain_name_servers
test -z "$dns" && dns=$old_domain_name_servers

routers=$new_routers
test -z "$routers" && routers=$old_routers

dhcp_server=$new_dhcp_server_identifier
test -z "$dhcp_server" && dhcp_server=$old_dhcp_server_identifier

dhcp_lease_time=$new_dhcp_lease_time
test -z "$dhcp_lease_time" && dhcp_lease_time=$old_dhcp_lease_time

expiry=$new_expiry
test -z "$new_expiry" && new_expiry=$new_expiry

cat > /var/lib/dhcp/dhclient.$interface.info <<EOF
DNS=$dns
ASSIGNED_IP=$assigned_ip
SUBNET_MASK=$subnet_mask
ROUTERS=$routers
DHCP_SERVER=$dhcp_server
DHCP_LEASE_TIME=$dhcp_lease_time
EXPIRY=$expiry
EOF
