Home › Forums › Software › InstaDMG › some commands from firstboot and postflight scripts do not execute
- This topic has 13 replies, 3 voices, and was last updated 14 years, 4 months ago by
elvisizer.
-
AuthorPosts
-
December 7, 2010 at 11:58 pm #380105
elvisizer
ParticipantHey everyone, I’m hoping I can get some help here with a few annoying problems i’m having with the firstboot and postflight scripts. . . .
I’ve got the scripts running successfully, not all the commands in the scripts seem to be taking effect First, i’ve got these 2 commands in my firstboot script to disable airport and turn on wake on LAN:
[code]#Disable Airport
$networksetup -setnetworkserviceenabled AirPort off# Activate WakeOnLAN.
$systemsetup -setwakeonnetworkaccess on[/code]the network setup and system setup variables have been left as they were in the template:
[code]
systemsetup=”/usr/sbin/systemsetup”
networksetup=”/usr/sbin/networksetup”
[/code]Everything else in firstboot works except for them. For the airport command, the log shows an error saying “AirPort is not a recognized network service” so I’m guessing I need to specify the service in some other way. For the wake on LAN command, it returns “Wake On Network access: Not supported on this machine”.
2nd, I need to suppress the creation of .DS_Store files on network shares, so I’ve added
[code]
$defaults write “${PREFS_DIR}/com.apple.desktopservices” DSDontWriteNetworkStores true
[/code]
to my postflight script. Here’s the definitions of the variables:
[code]
# Declare ‘defaults’and ‘PlistBuddy’.defaults=”/usr/bin/defaults”
PlistBuddy=”/usr/libexec/PlistBuddy”# Declare directory variables.
PKG_DIR=”$1/Contents/Resources”
SCRIPTS_DIR=”$3/Library/Scripts/Purchase”
LAUNCHD_DIR=”$3/Library/LaunchDaemons”
PRIVETC_DIR=”$3/private/etc”
PREFS_DIR=”$3/Library/Preferences”
USERPREFS_DIR=”$3/System/Library/User Template/English.lproj/Library/Preferences”
ROOT=”$3/”
[/code]
But, accounts created on a machine with that image still leave the DS files on the network until I run the defaults write command from the terminal. Any ideas? The DS store file issue is the most important . . . .December 8, 2010 at 12:22 am #380107dead2sin
ParticipantIs this for a 10.6 image, or another version of OS X? I assume OS X client as well? Also, is the machine you are building the image on the same as the version of the image you are building?
Nate
December 8, 2010 at 12:29 am #380109elvisizer
Participantit’s a 10.6 image that includes the 10.6.5 update (and a whole boatload of other software). I’m building it on a machine running OS X Server 10.6.5.
December 8, 2010 at 1:10 am #380111tristan_mason
ParticipantHi There
That’s the problem. Build on a client OS machine only. No one has any good experience with the server OS.
Cheers
Tristan
December 8, 2010 at 3:57 pm #380117elvisizer
Participantok, i can easily run the same process on a regular 10.6.5 machine. I’ll give that a try and then post results . . . .
thanks!
elvisizerDecember 8, 2010 at 8:27 pm #380120elvisizer
Participantok, the DS Store files are now being suppressed, so that’s an improvement, but the other commands are still failing with the same errors in the log.
I also added some new commands that aren’t working either:
[code]
#Set system autoproxy and activate
$networksetup -setautoproxyurl Ethernet http://proxy.XXXXXXX.com
$networksetup -setautoproxystate Ethernet on#Turns off softwareupdates schedule
$softwareupdate –schedule off
[/code]
I’ve got those in the firstboot script- is that appropriate or should they go in postflight?And then these 2 are now in postflight and are not being executed:
[code]
#sets screensaver to prompt for password with no delay after starting
$defaults write “${PREFS_DIR}/com.apple.screensaver” askForPassword -int 1
$defaults write “${PREFS_DIR}/com.apple.screensaver” askForPasswordDelay -int 0
[/code]any other ideas for these?
December 10, 2010 at 11:38 pm #380130elvisizer
ParticipantI just realized all my current non-working commands were in the postflight script, so I tried moving them over to firstboot instead. still not working.
December 11, 2010 at 2:22 am #380132dead2sin
ParticipantCurious. If you run them manually, do they work?
Nate
December 13, 2010 at 5:09 pm #380134elvisizer
Participantyeah, they do.
I just realized, though, that most of these commands (screensaver, proxy, and softwareupdate) are ByHost prefs. Can you work with ByHost managed perferences in the firstboot/postflight scripts?December 13, 2010 at 10:41 pm #380137tristan_mason
ParticipantI am fiddling with this also and finding problems with ByHost. As ByHost is machine specific i’m guessing we have to make the required changes using another mechanism.
I’m onto chapter 7 of the book recommended to me here in the forum but it hasn’t got to work arounds for ByHost prefs and issues yet. So much to learn, so little time!
The book is: Enterprise Managed Mac Prefs: Mac Managed Prefs, MCX and sheds much light on this whole subject. Get it.
Tristan
December 13, 2010 at 11:03 pm #380138elvisizer
Participantwell, i know you can get the UUID that will be in the ByHost filename from IOReg by using
[code]
ioreg -rd1 -c IOPlatformExpertDevice | grep -i “UUID” | cut -c51-62
[/code]so I was thinking of just putting that in the script and saving the uuid as a variable that could be inserted into the commands as needed. haven’t had time today to try that out, though.
December 13, 2010 at 11:24 pm #380139tristan_mason
Participantor just get it from “System Profiler”, a little easier but yes, that looks like a plan. I’m not really a coder so I follow as opposed to lead on the scripting front. Let me know how it goes? I guess you could do a find and replace for the ID in PackageMaker before packaging up the prefs but i’m not sure of the implications (if any).
Cheers
Tristan
December 14, 2010 at 12:03 am #380140elvisizer
Participanti’ll let you know how it goes, I just don’t have time to work on that today, too many break fix tickets to work on.
December 17, 2010 at 2:09 am #380168elvisizer
Participantok, still no luck with defaults commands in the firstboot script. I bought the MCX book you mentioned and read it last night. Now, I’ve got a script that creates a local\MCX set up like the examples in the book with laptop and desktop groups. They’re working pretty well- I got the screensaver preference to work pretty much right away. i’m still having trouble setting the proxy, though- the preference is set in my computer’s group, mcxquery reports it’s being applied, but the actual setting never takes effect. bah. Anyway, that’s not really the same issue as this thread, so we don’t need to go into it here.
-
AuthorPosts
- You must be logged in to reply to this topic.
Comments are closed