From bc986e631b2dcba0f5ce7c742d498f5820028f0b Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Fri, 21 Mar 2008 20:06:30 +0000 Subject: Rename 18hostname -> 06hostname We must configure a valid hostname in the target before 10adduser, or sudo fails with "unable to resolve host (none)" - before 18hostname is called /root/etc/hostname is empty. This was resulting in the "su as sudo" modifications not being applied in the target which was causing X configuration applications to show different behaviours when attempting elevating their priviledges. Reordering the hostname configuration seems somewhat preferable to applying a hack inside 10adduser to use 'su' or similar, as other pre-XXhostname calls may incorporate calls to sudo in the future. --- scripts/live-bottom/06hostname | 51 ++++++++++++++++++++++++++++++++++++++++++ scripts/live-bottom/18hostname | 51 ------------------------------------------ 2 files changed, 51 insertions(+), 51 deletions(-) create mode 100755 scripts/live-bottom/06hostname delete mode 100755 scripts/live-bottom/18hostname (limited to 'scripts') diff --git a/scripts/live-bottom/06hostname b/scripts/live-bottom/06hostname new file mode 100755 index 0000000..446bc23 --- /dev/null +++ b/scripts/live-bottom/06hostname @@ -0,0 +1,51 @@ +#!/bin/sh + +#set -e + +# initramfs-tools header + +PREREQ="" + +prereqs() +{ + echo "${PREREQ}" +} + +case "${1}" in + prereqs) + prereqs + exit 0 + ;; +esac + +# live-initramfs header + +if [ -n "${NOHOSTS}" ] +then + exit 0 +fi + +. /scripts/live-functions + +log_begin_msg "Setting hostname..." + +# live-initramfs script + +echo "${HOSTNAME}" > /root/etc/hostname + +cat >> /root/etc/hosts << EOF +127.0.0.1 localhost +127.0.1.1 ${HOSTNAME} + +# The following lines are desirable for IPv6 capable hosts +::1 ip6-localhost ip6-loopback +fe00::0 ip6-localnet +ff00::0 ip6-mcastprefix +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters +ff02::3 ip6-allhosts +EOF + +hostname "${HOSTNAME}" + +log_end_msg diff --git a/scripts/live-bottom/18hostname b/scripts/live-bottom/18hostname deleted file mode 100755 index 446bc23..0000000 --- a/scripts/live-bottom/18hostname +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh - -#set -e - -# initramfs-tools header - -PREREQ="" - -prereqs() -{ - echo "${PREREQ}" -} - -case "${1}" in - prereqs) - prereqs - exit 0 - ;; -esac - -# live-initramfs header - -if [ -n "${NOHOSTS}" ] -then - exit 0 -fi - -. /scripts/live-functions - -log_begin_msg "Setting hostname..." - -# live-initramfs script - -echo "${HOSTNAME}" > /root/etc/hostname - -cat >> /root/etc/hosts << EOF -127.0.0.1 localhost -127.0.1.1 ${HOSTNAME} - -# The following lines are desirable for IPv6 capable hosts -::1 ip6-localhost ip6-loopback -fe00::0 ip6-localnet -ff00::0 ip6-mcastprefix -ff02::1 ip6-allnodes -ff02::2 ip6-allrouters -ff02::3 ip6-allhosts -EOF - -hostname "${HOSTNAME}" - -log_end_msg -- cgit v1.2.3