Home Forums Software InstaDMG Launch agent problems with Mountain Lion

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #385363
    typofonic
    Participant

    Hi,

    I am experiencing a problem with Mountain Lion and Insta DMG. Creating a launch agent using a specific bash script used to work just fine on Lion and older, but on Mountain Lion it doesn’t create the launch agent properly. The result created a through Mountain Lion is different from the one created through Lion and earlier.

    Also I can’t get it to run, despite giving it execute permission (chmod +x). Any ideas on how to fix that?

    The script is attached below, the resulting launch agent from Mountain Lion is yet further below and the result that I get under Lion is in the end (but it still doesn’t work when created manually):
    ——–
    #!/bin/sh

    # Install startup settings Launchd item and corresponding script.
    # Script by Walter Meyer

    # Declare 'defaults'and 'PlistBuddy'.
    defaults="/usr/bin/defaults"
    PlistBuddy="/usr/libexec/PlistBuddy"

    # Define directory variables.
    PKG_DIR="$1/Contents/Resources"
    SCRIPTS_DIR="$3/Library/Typofonic"
    LAUNCHD_DIR="$3/Library/LaunchDaemons"

    # Create scripts directory.
    mkdir "${SCRIPTS_DIR}"

    # Copy startupssettings.sh scripts to the scripts directory.
    cp "${PKG_DIR}/startupsettings.sh" "${SCRIPTS_DIR}"
    cp "${PKG_DIR}/startupsettings.sh" "${SCRIPTS_DIR}"

    # Install Launchd item to /Library/LaunchDaemons. Change com.typofonic.startupsettings to your orginization.

    $defaults write "${LAUNCHD_DIR}/com.typofonic.startupsettings" Label com.typofonic.startupsettings
    $defaults write "${LAUNCHD_DIR}/com.typofonic.startupsettings" ProgramArguments -array
    $PlistBuddy -c "Add :ProgramArguments: string /Library/Scripts/startupsettings.sh" "${LAUNCHD_DIR}/com.typofonic.startupsettings.plist"
    $defaults write "${LAUNCHD_DIR}/com.typofonic.startupsettings" RunAtLoad -bool YES

    # Give Launchd item correct permissions.

    chown root:wheel "${LAUNCHD_DIR}/com.typofonic.startupsettings.plist"
    chmod 644 "${LAUNCHD_DIR}/com.typofonic.startupsettings.plist"

    exit 0

    Here’s the launchagent from Mountain Lion:

    Label
    com.typofonic.startupsettings
    ProgramArguments
    RunAtLoad

    I would have expected something like this, but despite manually creating this Mountain Lion still doesn’t execute it on boot:

    Label
    com.typofonic.startupsettings
    ProgramArguments

    /Library/Typofonic/startupsettings.sh

    RunAtLoad

    Hope someone might have some ideas! Have a great weekend!

    Anders

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.

Comments are closed