henk1955
Group: Members
Posts: 249
Joined: June 2004 |
|
Posted: Dec. 06 2004,15:10 |
|
i have hacked the knoppix-autoconfig file( for use on a remastered dsl) to allow the use of a bootparam to set the hostname to something else the "box"
1. add a # infront of the line: hostname box 2. add the following lines just below the lines: # / must be read-write in any case, starting from here mount -o remount,rw / 2>/dev/null
Code Sample | # Set hostname HOSTNAME="$(getbootparam host 2>/dev/null)" [ -n "$HOSTNAME" ] || HOSTNAME="box" rm -f /etc/hostname echo $HOSTNAME >/etc/hostname /etc/init.d/hostname.sh rm -f /etc/hosts cat >/etc/hosts <<EOT 127.0.0.1 $HOSTNAME localhost
# The following lines are desirable for IPv6 capable hosts # (added automatically by netbase upgrade)
::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
EOT |
this is what it does. 1. find the host param from the bootparams 2. remove the old /etc/hostname file with "box" in it. 3. create a new /etc/hostname with the new hostname 4. use the /etc/hostname file to set hostname 5. remove /etc/hosts file with the "127.0.0.1 box localhost" in it 6. create a new /etc/hosts with the new hostname in it
-------------- You have a Q or just want to chat? Come to #damnsmalllinux on irc.freenode.net! Open 24/7
dell latitude c640 p4@1.6Ghz 256Mb DSL0.9.1-remaster asus p4p800-vm p4@2.8Ghz HT / celeron@2.4Ghz 512Mb DSL0.9.1-remaster (alsadebs.dsl) ABit BE6 celeron@466 256Mb DSL0.9.1-remaster (xawtv)
|