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

Re: How to preseed install via pppoe (for A-DSL)?



On Monday 10 December 2007, Josef Wolf wrote:
> IMHO, the setting in /etc/resolv.conf is mostly for convenience.  It
> saves me some typing, that's all.  In contrast, the setting in /etc/hosts
> is more important since it is needed to make "hostname -d" and
> "hostname -f" work.

Right. I'd forgotten about hosts.

Could you try the attached patch to the postinst? I've also attached the 
full file in case you can just copy it onto the system.

This patch should make ppp-udeb generate the hosts file the same as netcfg 
does for systems with dynamic IP.
Please try with both a set and an empty domain name.

> > Note also that for normal netcfg, D-I basically works the same way when
> > dhcp is used: if the domain name is entered manually, it is ignored.
> > See for example #328646.
>
> But isn't this considered to be a bug?

I'm not sure as I'm not enough of a networking expert. It probably does not 
really make sense to fix it in d-i as long as dhcp-client remains as it is.

--- ppp-udeb.postinst.sv	2007-12-12 22:59:15.000000000 +0100
+++ ppp-udeb.postinst	2007-12-12 23:31:58.000000000 +0100
@@ -167,17 +167,22 @@
 db_unregister ppp/username
 
 
-# Ask for the hostname to use for the system (using the netcfg template!)
+# Ask for the hostname and domainname to use for the system
+# (using the netcfg templates!)
 while true; do
-	db_input high netcfg/get_hostname
+	db_input high netcfg/get_hostname || [ $? -eq 30 ]
+	db_input high netcfg/get_domain || [ $? -eq 30 ]
 	db_go || exit 10
 	db_get netcfg/get_hostname
 	HOSTNAME="$RET"
 	if valid_hostname "$HOSTNAME"; then
+		db_get netcfg/get_domain
+		DOMAINNAME="$RET"
 		break
+	else
+		db_input high netcfg/invalid_hostname || true
+		db_fset netcfg/get_hostname seen false
 	fi
-	db_input high netcfg/invalid_hostname
-	db_fset netcfg/get_hostname seen false
 done
 
 
@@ -197,14 +202,20 @@
 	provider provider
 EOF
 
-# Set hostname
+# Set hostname and create a basic /etc/hosts file
+echo -e "127.0.0.1\tlocalhost" > /etc/hosts
+
 if [ "$HOSTNAME" ]; then
 	echo "$HOSTNAME" >/etc/hostname
+
+	if [ "$DOMAINNAME" ]; then
+		echo -e "127.0.1.1\t$HOSTNAME.$DOMAINNAME\t$HOSTNAME" >> /etc/hosts
+	else
+		echo -e "127.0.1.1\t$HOSTNAME" >> /etc/hosts
+	fi
 fi
 
-# Create a basic /etc/hosts file
-cat > /etc/hosts <<EOF
-127.0.0.1       localhost	$HOSTNAME
+cat >> /etc/hosts <<EOF
 
 # The following lines are desirable for IPv6 capable hosts
 ::1     ip6-localhost ip6-loopback

Attachment: ppp-udeb.postinst
Description: application/shellscript

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: