4 Replies Latest reply on Mar 31, 2009 9:54 AM by egarlepp

    Macintosh - Preferred Package Server?

    egarlepp Employee

      Does anybody know if a preferred package server works with Macintosh agents?  I am running 8.8 sp2a.

        • 1. Re: Macintosh - Preferred Package Server?
          Apprentice

          Bad news, the Mac agent doesn't know anything about package servers.

           

          We rolled our own system by scripting all the installs. Basically every package is just a shell script. Part of the shell script determines where to pull the source install files from and then uses curl or wget to pull down the install files from the local package server and then perform the install.

          1 of 1 people found this helpful
          • 2. Re: Macintosh - Preferred Package Server?
            egarlepp Employee

            Thx Gil!

             

            Would you be willing to share a shell script that you have used that does what you are explaining?  :-)

            • 3. Re: Macintosh - Preferred Package Server?
              Apprentice

              This is the script we use to set the local package server. The script looks at the computers IP addresses and uses the second octet of the address to determine the office by looking up the local server name from that number, and saves it to another plist file stored in /Library/Preferences. That way any other script that runs can simply pull the server name in and use it to download files. Your location may b completely different, you would need to find some way to identify the local package server. Maybe the third octet would work better for some people.

              #!/bin/sh
              # setpps.sh
              # Gil Burns
              # v 1.1
              # 1/25/09
              # set preferred package server
              
              ipaddress=`ifconfig en0 | grep netmask | cut -d' ' -f 2`
              if [[ ${ipaddress} == "" ]]
              then
                   ipaddress=`ifconfig en1 | grep netmask | cut -d' ' -f 2`
              fi
              
              iprange=`echo ${ipaddress} | sed -e "s/^[^.]*[.]//" | sed -e "s/[.].*$//"`
              
              
              curl -s http://coreserver/ldlogon/mac/package_servers.plist -o /private/tmp/package_servers.plist
              location=`defaults read /private/tmp/package_servers ${iprange}`
              
              if [[ ${iprange} != "" ]]
              then
                   defaults write /Library/Preferences/com.domain packageserver "${location}.domain.com"
              fi
              
              exit 0
              

               

               

              The package_servers.plist file looks something like this:

              <?xml version="1.0" encoding="UTF-8"?>
              <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
              <plist version="1.0">
              <dict>
                   <key>20</key>
                   <string>nyc1package01</string>
                   <key>25</key>
                   <string>sea1package01</string>
                   <key>35</key>
                   <string>chi1package01</string>
                   <key>55</key>
                   <string>sfo1package01</string>
                   <key>84</key>
                   <string>lon3package01</string>
              </dict>
              </plist>
              
              

               

               

              So the shell script would look at the IP address of the client computer and find the IP was something like 10.20.19.54. The second octet is 20, so it would do a lookup in the plist and determine that nyc1package01 was the local server for the subnet that the computer was on.

               

               

              A sample install script might look something like this (This is for MS Office):

              #!/bin/sh
              #
              # Gil Burns
              # Install MS Office
              #
              
              # Set/Get defaults
              download0='Office%20Installer.mpkg'
              download01='Office Installer.mpkg'
              packagefolder="/Mac/Applications"
              
              serverbase="/packages"
              landeskbase="/Library/Application Support/LANDesk/sdcache"
              location=`defaults read /Library/Preferences/com.domain packageserver`
              
              # Create the directory if it does not exist
              mkdir -p "${landeskbase}/${packagefolder}"
              
              # Download the file
              curl -s "http://${location}/${serverbase}${packagefolder}/${download0}.zip" -o "${landeskbase}/${packagefolder}${download0}.zip"
              
              # Unzip
              unzip -qq -o "${landeskbase}${packagefolder}/${download0}.zip" -d "${landeskbase}/${packagefolder}"
              
              # Delete zip
              rm "${landeskbase}${packagefolder}/${download0}.zip"
              
              # Install pkg/mpkg
              installer -pkg "${landeskbase}${packagefolder}/${download01}" -target /
              
              exit 0
              

               

              So you would push out a .sh similar to the example, and that would always come from the same location (your core package server?) but the the script itself would pull the larger pkg, dmg, zips, etc from a closer package server.

               

              If you have a need to pull down lots of files, I find wget easier than curl, but wget is not part of the default Mac OS, so we add that to our base image. For example I use wget to pull down all the source files for Adobe CS3 suite and perform that install. But either curl or wget work nice to download from a package server.

               

              Hope that helps. Maybe someday LANDesk will get some parity in their Mac agent. One can only hope.

              • 4. Re: Macintosh - Preferred Package Server?
                egarlepp Employee

                Parity would be very nice, if not by development maybe buy a company.  ;-)

                 

                Thanks again Gil !