#!/bin/bash # $1 eth_device # $2 internal || external # $3 srv_ip || dhcp || ip # $4 srv_mask || extra-ns || srv_ip # $5 extra-ns || extran-domain || srv_mask # $6 extra-domain || || gateway # $7 || || extra-ns # $8 || || extra-domain function fix_internal_interface() { echo "fix_internal_interface" cat > /etc/network/interfaces << EOF auto lo iface lo inet loopback EOF } if [ "$2" = "internal" ];then echo "internal device configuration" if [ "$6" = "" ];then echo "lliurex-srv-netfix $1 --internal -ip $3 -netmask $4 -extra-ns $5" lliurex-srv-netfix $1 --internal -ip $3 -netmask $4 -extra-ns $5 else echo "lliurex-srv-netfix $1 --internal -ip $3 -netmask $4 -extra-ns $5 -extra-domain $6" lliurex-srv-netfix $1 --internal -ip $3 -netmask $4 -extra-ns $5 -extra-domain $6 fi echo "zero-kill-dhclients $1" zero-kill-dhclients $1 zero-sqlmanager -s zero-network-internal-server 1 fi if [ "$2" = "external" ];then echo "external device configuration" if [ "$3" = "dhcp" ];then if [ "$5" = "" ];then fix_internal_interface echo "lliurex-srv-netfix $1 --external dhcp -extra-ns $4" lliurex-srv-netfix $1 --external dhcp else fix_internal_interface echo "lliurex-srv-netfix $1 --external dhcp -extra-ns $4 --extra-domain $5" lliurex-srv-netfix $1 --external dhcp fi else if [ "$8" = "" ];then fix_internal_interface echo "lliurex-srv-netfix $1 --external -ip $4 -netmask $5 -gateway $6 -extra-ns $7" lliurex-srv-netfix $1 --external -ip $4 -netmask $5 -gateway $6 -extra-ns $7 else fix_internal_interface echo "lliurex-srv-netfix $1 --external -ip $4 -netmask $5 -gateway $6 -extra-ns $7 -extra-domain $8" lliurex-srv-netfix $1 --external -ip $4 -netmask $5 -gateway $6 -extra-ns $7 -extra-domain $8 fi fi fi