dscl scripts – revisited
I'm still having some issues with my script. I've simplified things in hopes of figuring out where it's going wrong.
The launchd works. The script works if I run it from command line with launchctl. My env is EXACTLY the same, both from command line and the launchd.
If I remove the "ENetAddress $macAddress", the computer group gets added, without any problem, either from the launchd or command line, just no Ethernet address.
If I add the "ENetAddress $macAddress" it fails at the launchd, even though Console will show that it has read the record correctly and that it is there:
Here are the players:
Script:
**********
#!/bin/sh
macAddress=`/sbin/ifconfig en0 | /usr/bin/grep 'ether' | /usr/bin/sed "s/^[[:space:]]ether //" | cut -f1 -d " "`
echo "$macAddress"
/usr/bin/dscl . -create /Computers/Desktop ENetAddress $macAddress
/usr/bin/dscl . -read /Computers/Desktop
Launchd:
*************
[code]
Label
sh.attrsetup
Program
/Library/Scripts/Custom/attrsetup.sh
RunAtLoad
[/code]
Console after the launchd has run:
5/17/10 2:09:06 PM sh.attrsetup[51] 00:1f:5b:ea:90:89
5/17/10 2:09:06 PM sh.attrsetup[51] AppleMetaNodeLocation: /Local/Default
5/17/10 2:09:06 PM sh.attrsetup[51] ENetAddress: 00:1f:5b:ea:90:89
5/17/10 2:09:06 PM sh.attrsetup[51] GeneratedUID: 5B5D58EA-6FCC-4E8A-A99E-673A7B734F52
5/17/10 2:09:06 PM sh.attrsetup[51] RecordName: Desktop
5/17/10 2:09:06 PM sh.attrsetup[51] RecordType: dsRecTypeStandard:Computers
No errors are reported, but when I start up WGM, that Computer "Desktop" isn't there and going to /var/db/dslocal/nodes/default/computers, shows it isn't there either.