- This topic has 3 replies, 4 voices, and was last updated 12 years, 11 months ago by foilpan.
-
AuthorPosts
-
March 8, 2011 at 11:54 am #380510solcaParticipant
Hi
I was trying to extend the firstboot script with the function “set Computer & Local Hostname” as you can see in the script below.
[code]#Script to change Computer & Local Hostname
# ConsoleMessage
echo “set Computer & Local Hostname”ip=`ifconfig en0 inet | grep inet | sed ‘s/.*inet *//; s/ .*//’`
echo “$ip”ip4=`echo $ip | sed ‘s/\./-/g’`
echo “$ip4”scutil –set ComputerName “stud $ip”
scutil –set LocalHostName “stud$ip4″[/code]After creating an image with InstaUp2Date and distribute it with DeployStudioServer the imaged machine produces the following error message
3/4/11 2:01:45 PM ch.uzh.ifi.firstboot[52] set Computer & Local Hostname
3/4/11 2:01:45 PM ch.uzh.ifi.firstboot[52] 2011-03-04 14:01:45.418 writeconfig[225:903] *** -[NSMachPort handlePortMessage:]: dropping incoming DO message because the connection or ports are invalid
3/4/11 2:01:45 PM ch.uzh.ifi.firstboot[52] ifconfig: interface en0 does not existIf I test “ifconfig en0” after reboot it works as expected.
Any idea how to solve this?
thanks enrico
March 8, 2011 at 3:59 pm #380513Allister BanksParticipantWhich version of DS? What’s calling the firstboot script?
There are workflow options in DS to name the computer for you, but your issue is the fact your script is running before the network interfaces are initialized, which is why it works after a reboot. Instead of a LaunchDaemon you may want to use a LaunchAgent and have it rename the machine after first user login/some other trigger that relies on networking.Allister
March 9, 2011 at 2:33 am #380515knowmadParticipantyou can also, if you dont want to do it after user login, do one of two other things:
Have your script check for IP address and if its not there, kill itself and respawn after 30 seconds.
OR
create a file as counter.
If the file is not there, create the file and reboot the machine
If the file is there, set the computer and host name
done
If you need examples on how to do this stuff, i can go drag it up from wherever I last left it all.March 10, 2011 at 1:55 pm #380519foilpanParticipantyou might also try adding a “networksetup -detectnewhardware” and a short sleep interval before attempting to set the name.
-
AuthorPosts
- You must be logged in to reply to this topic.
Comments are closed