[Initng-svn] r2692 - initng/initfiles/system

svn at initng.thinktux.net svn at initng.thinktux.net
Tue Jan 3 23:54:20 CET 2006


Author: deac
Date: Tue Jan  3 23:54:18 2006
New Revision: 2692

Modified:
   initng/initfiles/system/hostname.ii
Log:
hostname: bug #387 fixed

Modified: initng/initfiles/system/hostname.ii
==============================================================================
--- initng/initfiles/system/hostname.ii	(original)
+++ initng/initfiles/system/hostname.ii	Tue Jan  3 23:54:18 2006
@@ -1,7 +1,8 @@
 # /etc/env.d/01hostname in gentoo is setted by init-script.
-# i say, you should set a link: /etc/conf.d/hostname <- /etc/env.d/01hostname
+# i say, you should set a link: /etc/conf.d/hostname <- /etc/env.d/01hostname, but don't do it at the moment!
 service system/hostname {
 	need = system/initial;
+	env HOSTNAME=localhost;
 #ifd fedora
 	env_file = /etc/sysconfig/network;
 #elsed
@@ -9,22 +10,20 @@
 #endd
 	script start = {
 		myhost=`@/bin/hostname@ 2>/dev/null`
-		retval=0
-	
+
 		# If the hostname is already set via the kernel, and /etc/hostname
 		# isn't setup, then we shouldn't go reseting the configuration #38172.
-		[ -z "${myhost}" -o "${myhost}" = "(none)" ] && myhost="localhost"
-	
-		if [ -f /etc/hostname ]
+		if [ -n "${myhost}" -a "${myhost}" != "(none)" ]
 		then
-			#echo "You should stop using /etc/hostname and use /etc/conf.d/hostname"
-			myhost=`@cat@ /etc/hostname`
+		elsif [ -f /etc/hostname ]
+		then
+			myhost="`@cat@ /etc/hostname`"
 		else
-			myhost=${HOSTNAME}
+			myhost="${HOSTNAME}"
 		fi
 #ifd gentoo
-		[ "${retval}" -eq 0 ] && \
-				echo "HOSTNAME=\"${myhost}\"" 2>/dev/null >/etc/env.d/01hostname
+		@rm@ /etc/env.d/01hostname
+		echo "HOSTNAME=\"${myhost}\"" 2>/dev/null >/etc/env.d/01hostname
 #endd
 		echo "Setting hostname to ${myhost} ..."
 		@/bin/hostname@ "${myhost}"


More information about the Initng-svn mailing list