Set Hostname from boot paramsForum: Other Help Topics Topic: Set Hostname from boot params started by: henk1955 Posted by henk1955 on 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
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 Posted by Caspar_s on Dec. 18 2004,15:14
Ummm, so where do you put this?
Posted by clacker on Dec. 18 2004,16:41
henk1955, very nice work. I like how you pulled the new name right off the boot prompt. I think you might consider skipping over your code if the user doesn't enter a hostname at the prompt with an if statement. That way if anything changes in DSL your script will be OK.
|