Re: libnss-myhostname instead of mangling /etc/hosts
Joachim Breitner wrote:
> Would this be something that could be used by default in Debian, maybe
> for squeeze+1?
You're suggesting making the package standard priority. This is not a
decision within the purvue of the d-i team, really.
If libnss-myhostname becomes standard priority, or /etc/hosts becomes a
conffile, d-i will need some modifications to deal with it. We could
make those changes in d-i in a future proof way today.
Attached patch would probably work. My only real concern is some package
may depend on /etc/hosts existing at installation time.
--
see shy jo
diff --git a/packages/finish-install/debian/changelog b/packages/finish-install/debian/changelog
index 10c52e0..565c805 100644
--- a/packages/finish-install/debian/changelog
+++ b/packages/finish-install/debian/changelog
@@ -1,8 +1,14 @@
finish-install (2.25) UNRELEASED; urgency=low
+ [ Frans Pop ]
* There's no need anymore to unmount /target/cdrom.
* Stop creating a cdrom symlink in /dev. This is now the province of udev.
+ [ Joey Hess ]
+ * 50config-target-network: Copy /etc/hostname to target, so netcfg does not
+ need to do that in a base-installer hook. (Also copy other networking files
+ into place if they do not exist in target.)
+
-- Frans Pop <fjp@debian.org> Thu, 11 Mar 2010 17:58:26 +0100
finish-install (2.24) unstable; urgency=low
diff --git a/packages/finish-install/finish-install.d/50config-target-network b/packages/finish-install/finish-install.d/50config-target-network
index 388097a..888042e 100755
--- a/packages/finish-install/finish-install.d/50config-target-network
+++ b/packages/finish-install/finish-install.d/50config-target-network
@@ -1,14 +1,19 @@
#! /bin/sh
-#
-# Make sure /etc/hostname, /etc/hosts and /target/etc/network/interfaces
-# exist before reboot. This is a fallback in case netcfg doesn't do it.
set -e
+# Copy in any files that netcfg or a package did not already install.
+for file in /etc/network/interfaces /etc/networks /etc/hostname /etc/resolv.conf /etc/hosts; do
+ if [ ! -e /target/"$file" ] && [ -f "$file" ]; then
+ mkdir /target/$(dirname $file) -p
+ cp $file /target/$file
+ fi
+done
+
+# Just in case.
if [ ! -e /target/etc/hostname ]; then
echo "localhost" > /target/etc/hostname
fi
-
if [ ! -e /target/etc/hosts ]; then
echo "127.0.0.1 localhost" > /target/etc/hosts
fi
diff --git a/packages/netcfg/base-installer.d/40netcfg b/packages/netcfg/base-installer.d/40netcfg
index f09b20a..42ba6e5 100755
--- a/packages/netcfg/base-installer.d/40netcfg
+++ b/packages/netcfg/base-installer.d/40netcfg
@@ -5,7 +5,7 @@ if [ ! -f /etc/network/interfaces ]; then
netcfg write_loopback
fi
-for file in /etc/network/interfaces /etc/networks /etc/hostname /etc/resolv.conf /etc/hosts; do
+for file in /etc/network/interfaces /etc/networks /etc/hostname /etc/resolv.conf; do
if [ -f "$file" ]; then
mkdir /target/$(dirname $file) -p
cp $file /target/$file
diff --git a/packages/netcfg/debian/changelog b/packages/netcfg/debian/changelog
index 1d3f5af..9b9a7f9 100644
--- a/packages/netcfg/debian/changelog
+++ b/packages/netcfg/debian/changelog
@@ -11,6 +11,12 @@ netcfg (1.53) UNRELEASED; urgency=low
* Revert workaround for FTBFS on s390 which is no longer needed as of
debhelper version 7.4.17.
+ [ Joey Hess ]
+ * Do not copy /etc/hosts into /target in base-installer hook. Not needed to
+ run debootstrap, and it should be ok for it to be provided in
+ finish-install. There is talk of making it a static conffile using
+ libnss-myhostname.
+
-- Frans Pop <fjp@debian.org> Thu, 08 Apr 2010 00:32:48 +0200
netcfg (1.52) unstable; urgency=low
Reply to: