summaryrefslogblamecommitdiffstats
path: root/satellit_installer/includes/30-setup_dhcp.inc
blob: 14e2d544290f955ef0528b6c8f80072dd491f065 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                                                                      
          
 
 
                

                                              
                                                     

                                         





                                                                                            




                                   



























                                                                                                
install_dhclient() {
	echo -n "# Installing dhclient (isc-dhclient)..."
	apt-get install isc-dhcp-client 2>/dev/null 1>&2
	if [ "$ERR" -ne 0 ]; then
		echo
		echo "# WARNING: Could not re-install dhclient (isc-dhcp-client)!"
		echo "#          This should not happen. I give up."
		echo "#          Please keep in mind this problem has to be solved"
		echo "#          before the next boot, as the server will most likely"
		echo "#          not receive an IP (if not set statically)."
	else
		echo " ok."
	fi
}

install_pump() {
	if [ ! $(which pump) ]; then	
		echo -n "# Installing pump..."
		apt-get install pump 2>/dev/null 1>&2
		if [ "$ERR" -ne 0 ]; then
			echo
			echo "# WARNING: Could not install pump! This is a problem, as pump"
			echo "#          is an essential package. The server install will"
			echo "#          continue, but keep in mind this problem has to be"
			echo "#          solved before the server will work correctly."
			echo "# Now re-installing dhclient (isc-dhcp-client)..."
			install_dhclient
		else
			echo " ok."
		fi
	fi
}

uninstall_dhclient() {
	echo -n "# Uninstalling dhclient (isc-dhclient)..."
	dpkg --remove isc-dhcp-client 2>/dev/null 1>&2
	if [ "$ERR" -ne 0 ]; then
		echo
		echo "# WARNING: Could not uninstall dhclient (isc-dhcp-client)!"
		echo "#          This should not happen. I give up."
		echo "#          Please keep in mind this problem has to be solved"
		echo "#          before the next boot, as the server will most likely"
		echo "#          not receive an IP (if not set statically)."
		echo "# pump will be installed anyway, but keep an eye on possible problems."
	else
		echo " ok."
	fi
}

setup_dhcp() {
	echo "#"
	echo "# First: let's see whether the package isc-dhcp-client is installed,"
	echo "# as we do not like it due to udp checksum failures using virtIO."
	echo "# Checking dhcp configuration / utilities..."
	if [ $(which dhclient) ]; then
		echo "# dhclient detected. dhclient will be uninstalled due to virtIO-problems."
		uninstall_dhclient
	fi
	install_pump
}