Home Forums Software InstaDMG some commands from firstboot and postflight scripts do not execute

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #380105
    elvisizer
    Participant

    Hey 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 . . . .

    #380107
    dead2sin
    Participant

    Is 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

    #380109
    elvisizer
    Participant

    it’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.

    #380111
    tristan_mason
    Participant

    Hi There

    That’s the problem. Build on a client OS machine only. No one has any good experience with the server OS.

    Cheers

    Tristan

    #380117
    elvisizer
    Participant

    ok, 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!
    elvisizer

    #380120
    elvisizer
    Participant

    ok, 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?

    #380130
    elvisizer
    Participant

    I 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.

    #380132
    dead2sin
    Participant

    Curious. If you run them manually, do they work?

    Nate

    #380134
    elvisizer
    Participant

    yeah, 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?

    #380137
    tristan_mason
    Participant

    I 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

    #380138
    elvisizer
    Participant

    well, 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.

    #380139
    tristan_mason
    Participant

    or 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

    #380140
    elvisizer
    Participant

    i’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.

    #380168
    elvisizer
    Participant

    ok, 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.

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.

Comments are closed