From: <cod...@go...> - 2008-11-03 19:49:40
|
Author: M0E.lnx Date: Mon Nov 3 08:32:53 2008 New Revision: 256 Modified: branches/iVL/FrmNetConf.class branches/iVL/MdlNetConf.module Log: Fixed problem with /etc/hosts not being created or appended in the target system.This led to problem when starting XFCE4 complaining about not finding the hostname. Modified: branches/iVL/FrmNetConf.class ============================================================================== --- branches/iVL/FrmNetConf.class (original) +++ branches/iVL/FrmNetConf.class Mon Nov 3 08:32:53 2008 @@ -18,7 +18,7 @@ PUBLIC FUNCTION GET_CURRENT_HOST_NAME() AS String DIM sRes AS String - SHELL "hostname" TO sRes + SHELL "chroot " & ClsGlobal.sTargetMnt & " hostname" TO sRes sRes = Trim(sRes) IF sRes = "" THEN Modified: branches/iVL/MdlNetConf.module ============================================================================== --- branches/iVL/MdlNetConf.module (original) +++ branches/iVL/MdlNetConf.module Mon Nov 3 08:32:53 2008 @@ -548,9 +548,45 @@ ELSE ' X is not running SHELL "hostname $HOSTNAME; echo " & sHostName & " > " & ClsGlobal.sTargetMnt &/ "etc" &/ "HOSTNAME" WAIT ' This sets the hostname to the current CLI session and saves it for future boots END IF + ME.UPDATE_HOSTS_FILE(sHostName) + + +END + +PUBLIC SUB UPDATE_HOSTS_FILE(sHostName AS String) + DIM sFileIn, sFileOut AS String + + sFileIn = "# \n" & + "# hosts \n" & + "#\n #\n" & + "# This file describes a numeber of host-to-address mappings for the TCP/IP subsystem. \n" & + "# It is mostly used at boot time, when no name servers are running. On small systems, this \n" & + "# file can be used instead of a \"named\" name server. Just add the names, addresses and any \n" & + "# aliases to this file ...\n #\n#\n#n" & + "# By the way, Arnt Gulbrandsen <agr...@nv...> says that 127.0.0.1 should NEVER \n" & + "# be named with the name of the machine. It causes problem sor some programs, irc and \n" & + "# reputedly talk. :^) \n#\n#\n" & + "# For loopbacking." & + "127.0.0.1" & Space(5) & "localhost" & "\n" & + "#\n#\n" & + "# This next entry is technically wrong, but good enough to get TCP/IP applications to quit complaining \n" & + "# that they can\'t clarify the hostname on a loopback-only system \n#\n#\n#" & + "127.0.0.1" & Space(5) & sHostName & Space(5) & sHostName & "\n#\n#" & + "# End of hosts." + + IF Exist(ClsGlobal.sTargetMnt &/ "etc" &/ "hosts") THEN MOVE ClsGlobal.sTargetMnt &/ "etc" &/ "hosts" TO ClsGlobal.sTargetMnt &/ "etc" &/ "hosts.bak" + IF Exist(ClsGlobal.sTargetMnt &/ "etc" &/ "hosts") THEN KILL ClsGlobal.sTargetMnt &/ "etc" &/ "hosts" + + TRY File.Save(ClsGlobal.sTargetMnt &/ "etc" &/ "hosts", SConv(sFileIn)) + CATCH + Message.Error(Error.where & gb.NewLine & Error.text) + END + + + PUBLIC SUB SET_DNS_ADDRESSES() |