Package: ppp-udeb
Version: 2.4.4rel-9
Severity: wishlist
Tags: d-i patch

This change was requested by Josef Wolf in the following thread:
http://lists.debian.org/debian-boot/2007/12/msg00160.html

The attached patch implements this and ensures that the created /etc/hosts 
file is similar to the one created by netcfg when regular Ethernet or 
wireless networking is used.

The patch applies on top of the last one for #455366.

Cheers,
FJP

commit 488b4baf9a0aca03b23653c9bb48c7aaf26099f6
Author: Frans Pop <[EMAIL PROTECTED]>
Date:   Tue Apr 8 16:25:53 2008 +0200

    ppp-udeb: also ask for a domain name to be used in /etc/hosts

diff --git a/debian/changelog b/debian/changelog
index 5e5be60..cd409c4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,8 +3,9 @@ ppp (2.4.4rel-9.1) UNRELEASED; urgency=low
   * Non-maintainer upload.
   * ppp-udeb: allow for preseeding of the netcfg/get_hostname template.
     Closes: #455366.
+  * ppp-udeb: also ask for a domain name to be used in /etc/hosts.
 
- -- Frans Pop <[EMAIL PROTECTED]>  Tue, 08 Apr 2008 16:15:53 +0200
+ -- Frans Pop <[EMAIL PROTECTED]>  Tue, 08 Apr 2008 16:24:35 +0200
 
 ppp (2.4.4rel-9) unstable; urgency=low
 
diff --git a/debian/ppp-udeb.postinst b/debian/ppp-udeb.postinst
index 899357f..1daa9ba 100644
--- a/debian/ppp-udeb.postinst
+++ b/debian/ppp-udeb.postinst
@@ -167,17 +167,22 @@ db_unregister ppp/password
 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 || [ $? -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 || true
-	db_fset netcfg/get_hostname seen false
 done
 
 
@@ -197,14 +202,20 @@ iface provider inet ppp
 	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

Reply via email to