[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#920861: Use same $HOSTNAME for hosts on LAN and WiFi



On Tue, Jan 29, 2019 at 09:28:02PM +0000, Mike Gabriel wrote:
> This could all be avoided if the update-hostname-from-ip could be taught the
> above (or a similar) hack.
> 
> Is this something, we can provide via Debian Edu directly? Our alternative
> here is to override update-hostname-from-ip with dpkg-divert here locally,
> which I would like to avoid.

If your only intention is to set the hostname once and stay unchanged 
(regardless of any possible side-effects) then the following might be a 
solution:

(1) Introduce a new profile, say Dual-IP, using a patch like this one:

diff --git a/etc/dhcp/dhclient-exit-hooks.d/hostname b/etc/dhcp/dhclient-exit-hooks.d/hostname
old mode 100755
new mode 100644
index ae6718d6..f5247407
--- a/etc/dhcp/dhclient-exit-hooks.d/hostname
+++ b/etc/dhcp/dhclient-exit-hooks.d/hostname
@@ -19,7 +19,7 @@ if [ -r /etc/debian-edu/config ] ; then
	. /etc/debian-edu/config
 fi
 
-if echo "$PROFILE" | egrep -q 'Main-Server|Roaming-Workstation|Standalone' ; then
+if echo "$PROFILE" | egrep -q 'Main-Server|Roaming-Workstation|Standalone|Dual-IP' ; then
	exit 0
	else
	    if echo "$PROFILE" | egrep -q 'Workstation|LTSP-Server|Thin-Client-Server|Minimal' ; then
diff --git a/etc/network/if-up.d/hostname b/etc/network/if-up.d/hostname
index d6b2b34e..34bc5192 100755
--- a/etc/network/if-up.d/hostname
+++ b/etc/network/if-up.d/hostname
@@ -19,7 +19,7 @@ if [ -r /etc/debian-edu/config ] ; then
	. /etc/debian-edu/config
 fi
 
-if echo "$PROFILE" | egrep -q 'Main-Server|Roaming-Workstation|Standalone' ; then
+if echo "$PROFILE" | egrep -q 'Main-Server|Roaming-Workstation|Standalone|Dual-IP' ; then
	exit 0
	else
	    if echo "$PROFILE" | egrep -q 'Workstation|LTSP-Server|Thin-Client-Server|Minimal' ; then

IMO this patch wouldn't mess up anything else, but please check. 


(2) Configure the workstation:

hostname <wanted name>
hostname > /etc/hostname
sed -i 's#Workstation#Workstation, Dual-IP#' /etc/debian-edu/config

Wolfgang

Attachment: signature.asc
Description: PGP signature


Reply to: