Home > Mac administration, Packaging, Scripting > Building an automated KBox 1000 agent installer

Building an automated KBox 1000 agent installer

I’ve historically had problems with deploying the Mac agent installer for our Dell Kace KBox 1000 to our Macs. Installing the package as part of our existing DeployStudio workflows has generally resulted in a broken installation. As a result, installing the agent has been a manual step done by our techs as part of setting up new or reimaged Macs for deployment. We recently upgraded to K1000 5.3 though and this KBase article came to my attention.

With some modification, you can use the commands listed in the KBase article along with the methodology referenced in this post, to repackage a KBox 1000 agent so that it’s deployable as part of an automated workflow. See below the jump for the procedure.

Set up a new Iceberg project. Since we’ll need to run this installer with root privileges, I recommend setting the project type to Darwin: Package. That will open the project with the installation privileges automatically set to root. In this case, I’m naming the project KBox Agent Installer.

Screen shot 2011-06-24 at 10.35.04 AM

Download your KBox 1000 agent installer from your KBox appliance.

Screen shot 2012-03-05 at 5.09.26 PM

Select AMPAgent.pkg and drag it into the Additional Resources section of your Iceberg project.

Screen shot 2012-03-05 at 5.12.55 PM

The last piece is telling your Mac which address the KBox is at and having the the AMPAgent installed. For this, you’ll need a postflight script. Here’s the one I’m using:

—–


#!/bin/sh
 
# Create the /Library/Application Support/Dell/KACE/data on the boot drive
 
mkdir -p "/Library/Application Support/Dell/KACE/data"
 
# Add the server address of the KBox 1000 to /Library/Application Support/Dell/KACE/data/amp.conf
 
echo "host=server.address.here" > "/Library/Application Support/Dell/KACE/data/amp.conf"
 
# Wait 15 seconds
 
sleep 15
 
# Install the KBox agent
 
/usr/sbin/installer -dumplog -verbose -pkg "$1/Contents/Resources/AMPAgent.pkg" -target /

—–

Once you’ve got the postflight script built, run the following command to make the script executable:


sudo chmod a+x /path/to/postflight

Last step, go ahead and build the package. (If you don’t know to build, check the Help menu for the Iceberg User Guide. The information you need is in Chapter 3 – Creating a package.)

Once the package has been built, test it by taking it to a test machine that doesn’t have your KBox agent installed and install it. The end result should be that your KBox agent should install and check in with the server without needing additional configuration.

  1. Peter Langone
    July 9, 2013 at 5:43 pm

    I think the semicolon in the echo line breaks it. At least it did for me.

    Printf would probably work just as well (instead of echo).

  2. July 26, 2013 at 8:14 pm

    When adding the postflight script using Iceberg, you may find that changing the “Ref.” from “Absolute Path” to “Project Relative” works better.

    Remove the semicolon in the echo statements in the script above to get the script to work.

    Additional configuration lines can be appended to amp.conf using the double greater than symbol “>>”.
    Example: echo “webport=443” >> “/Library/Application/Support/Dell/KACE/data/amp.conf”

    If the install fails, check /var/log/install.log for the more specific error (thanks Apple for your lack of verbosity grrr).

  3. April 17, 2014 at 6:48 pm

    Rich,

    I tried applying this for Kbox Agent 5.5.3.0275 but I wasnt able to deploy it. I followed your instructions point by point, but when I run the installer after its done verifying the scripts it errors out.

    I tried looking into the install.log but there was no useful information to work on. I have tried to implement different postflight scripts but I get the same result.

    Any help would be appreciated.

    • April 18, 2014 at 12:11 pm

      UniMis,

      Can you post the install log somewhere, like on http://pastebin.com, then post the link? That may help me figure out where the problem is.

      • April 18, 2014 at 3:31 pm

        This is strange… Maybe a good night sleep cleared my head. As I was building the new package to capture the install.log it worked. Still I am including it here just in case: http://pastebin.com/BHAACLrf

        Another question I wanted to ask, which I guess its one of the things I was trying to accomplish with this install, is if there was a way to hard code into the postflight, forcing a check in with KACE1000.

        Is there any way to do it without sudo runkbot?

      • April 18, 2014 at 5:28 pm

        Actually I spoke to soon… I ran it on another user’s computer and it broke the installation: http://pastebin.com/EHzEhydV

  4. April 18, 2014 at 3:55 pm

    Here is another paste bin of another test I did… It’s working now… http://pastebin.com/Jcg87NYy

    • April 18, 2014 at 5:51 pm

      Would you please paste your script? I can see there’s an error running it from the logs, but I’ll need to see the script to figure out what the problem is.

      • April 18, 2014 at 5:54 pm

        It’s your script:

        #!/bin/sh

        # Create the /Library/Application Support/Dell/KACE/data on the boot drive

        mkdir -p “/Library/Application Support/Dell/KACE/data”

        # Add the server address of the KBox 1000 to /Library/Application Support/Dell/KACE/data/amp.conf

        echo “host=kace01.utg.uvn.net” > “/Library/Application Support/Dell/KACE/data/amp.conf”

        # Wait 15 seconds

        sleep 15

        # Install the KBox agent

        /usr/sbin/installer -dumplog -verbose -pkg “$1/Contents/Resources/AMPAgent.pkg” -target /

  5. April 18, 2014 at 6:11 pm

    UniMis,

    Sorry, not sure what to tell you. I’m using an almost-identical script to deploy the latest KBox agent. The main difference these days is that I’m using Packages to create installer packages, instead of Iceberg.

    My script has some changes as a result of moving to using Packages, but here’s what it looks like currently:

    http://pastebin.com/aSCNFBrp

    Here’s a post I did on re-packaging packages using Packages:

    Re-packaging installer packages with Packages

    • April 18, 2014 at 6:15 pm

      its strange on some machines the packager works and in others it just breaks. I am going to try to do this again with Packages to see if I have a different result. I appreciate you trying to help me…

      Lastly, do you know a good way I could inject in the code forcing a runkbot 2 0 ?

      • April 18, 2014 at 8:40 pm

        Sorry, don’t know the answer to that one.

  6. May 12, 2014 at 4:00 pm

    I figured it out, here is the full script (using your uninstaller + deployment + forcing kace inventory) works great: http://pastebin.com/enZgydDH

    Thanks for all your help, couldn’t have done it without your input.

  7. Sam A
    February 3, 2016 at 7:27 pm

    I have not been able to make this work on Kace agent 6.4.180. Any new scripts?

  1. No trackbacks yet.

Leave a comment