Packaging Part 2: Autopkg

Use of Autopkg is mostly done in the command-line. If you are a mostly GUI user then look at the end of this post for AutoPkgr

https://github.com/autopkg/autopkg

Autopkg distributed as an installer package, and it's recommended to also install Git for the purpose of installing and updating community recipes. AutoPkg requires 10.6 or later.

Requirement - the above command requires “git" to be installed. Also, Xcode or use the Xcode command line if you don’t need the full 4.47 GB (as of this writing) application suite.

Installing Xcode command line:
Prompt the system to install them simply by typing the git command, or
xcode-select —install.

Note: You must agree to the Xcode license agreement.

Recipes

Recipes are backbone of autopkg. Recipes can:

  • Find the latest version of a software item.
  • Download pkgs/dmgs.
  • Package (or repackage) downloads).
  • Used to import into software management system (Munki, Jamf Pro, Absolute Manage, etc)

How to find recipes:

https://github.com/autopkg

Browse recipes repositories

How to add Recipes

Default recipes for autopkg

autopkg repo-add <URL>

or

autopkg repo-add recipes

Once Autopkg is installed run the following command.

autopkg repo-add recipes

You will receive something similar. I apologize for the formatting. Getting command-line to format properly can be a challenge.

Attempting git pull...
Updating 8332edc..d49d9fe
Fast-forward
Adium/Adium.download.recipe                        |  17 +-
Adium/Adium.munki.recipe                           |   4 -
AdobeAIR/AdobeAIR.download.recipe                  |   4 +-
AdobeAIR/AdobeAIR.pkg.recipe                       |   4 +-
AdobeAIR/AdobeAir.munki.recipe                     |   4 +-
.../AdobeAcrobatProUpdateInfoProvider.py           |   6 +-
.../AdobeAcrobatProXUpdate.download.recipe         |  11 +-
AdobeFlashPlayer/AdobeFlashPlayer.download.recipe  |   2 +-
AdobeFlashPlayer/AdobeFlashPlayer.install.recipe   |   2 +-
AdobeFlashPlayer/AdobeFlashPlayer.munki.recipe     |   2 +-
AdobeFlashPlayer/AdobeFlashPlayer.pkg.recipe       |   2 +-
AdobeFlashPlayer/AdobeFlashURLProvider.py          |   2 +-
AdobeReader/AdobeReaderDC.pkg.recipe               |  44 ++++-
AdobeReader/AdobeReaderUpdates.download.recipe     |   8 +-
AdobeReader/AdobeReaderUpdates.munki.recipe        |   2 +-
AdobeReader/AdobeReaderUpdatesURLProvider.py       |  41 +++++
Barebones/BBEdit_Scripts/postinstall               |   2 +-
Evernote/Evernote.download.recipe                  |   2 +-
Evernote/Evernote.munki.recipe                     |   2 -
GoogleChrome/GoogleChrome.install.recipe           |   5 +-
GoogleEarth/GoogleEarth.download.recipe            |  19 +-
Handbrake/Handbrake.download.recipe                |   3 +-
MSOfficeUpdates/MSExcel2016.download.recipe        |  13 +-
MSOfficeUpdates/MSExcel2016.munki.recipe           |  16 +-
MSOfficeUpdates/MSOffice2011UpdateInfoProvider.py  |  23 ++-
.../MSOffice2011Updates.download.recipe            |  11 +-
MSOfficeUpdates/MSOffice2011Updates.munki.recipe   |   6 +-
MSOfficeUpdates/MSOffice2011Updates.pkg.recipe     |   9 +-
.../MSOffice2016URLandUpdateInfoProvider.py        | 185 ++++++++++++-------
MSOfficeUpdates/MSOneNote2016.download.recipe      |  13 +-
MSOfficeUpdates/MSOneNote2016.munki.recipe         |  16 +-
MSOfficeUpdates/MSOutlook2016.download.recipe      |  13 +-
MSOfficeUpdates/MSOutlook2016.munki.recipe         |  16 +-
MSOfficeUpdates/MSPowerPoint2016.download.recipe   |  13 +-
MSOfficeUpdates/MSPowerPoint2016.munki.recipe      |  16 +-
MSOfficeUpdates/MSWord2016.download.recipe         |  13 +-
MSOfficeUpdates/MSWord2016.munki.recipe            |  16 +-
Mozilla/Firefox.download.recipe                    |  15 +-
Mozilla/Thunderbird.download.recipe                |  15 +-
OmniGroup/OmniFocus2.download.recipe               |  16 +-
OmniGroup/OmniFocus2.install.recipe                |  42 +++++
OmniGroup/OmniGraffle.download.recipe              |  19 ++
OmniGroup/OmniGraffle.munki.recipe                 |  23 +--
OmniGroup/OmniGraffle.pkg.recipe                   |  23 +--
OmniGroup/OmniGraffle6.download.recipe             |  33 ++++
OmniGroup/OmniGraffle6.munki.recipe                |  23 +--
OmniGroup/OmniGraffle6.pkg.recipe                  |  23 +--
OmniGroup/OmniGrafflePro.download.recipe           |  19 ++
OmniGroup/OmniGrafflePro.munki.recipe              |  23 +--
OmniGroup/OmniGrafflePro.pkg.recipe                |  23 +--
OmniGroup/OmniGraphSketcher.download.recipe        |  19 ++
OmniGroup/OmniGraphSketcher.munki.recipe           |  23 +--
OmniGroup/OmniGraphSketcher.pkg.recipe             |  23 +--
OmniGroup/OmniGroupProduct.download.recipe         |   4 +-
OmniGroup/OmniOutliner.download.recipe             |  21 +++
OmniGroup/OmniOutliner.munki.recipe                |  25 +--
OmniGroup/OmniOutliner.pkg.recipe                  |  25 +--
OmniGroup/OmniOutliner4.download.recipe            |  33 ++++
OmniGroup/OmniOutliner4.munki.recipe               |  50 +++++
OmniGroup/OmniOutliner4.pkg.recipe                 |  85 +++++++++
OmniGroup/OmniOutlinerPro.download.recipe          |  21 +++
OmniGroup/OmniOutlinerPro.munki.recipe             |  23 +--
OmniGroup/OmniOutlinerPro.pkg.recipe               |  23 +--
OmniGroup/OmniPlan.download.recipe                 |  21 +++
OmniGroup/OmniPlan.munki.recipe                    |  25 +--
OmniGroup/OmniPlan.pkg.recipe                      |  25 +--
OmniGroup/OmniPlan3.download.recipe                |  33 ++++
OmniGroup/OmniPlan3.munki.recipe                   |  50 +++++
OmniGroup/OmniPlan3.pkg.recipe                     |  85 +++++++++
OracleJava/OracleJava8.download.recipe             |   5 +-
OracleJava/OracleJava8.munki.recipe                |   5 +-
OracleJava/OracleJava8.pkg.recipe                  |   5 +-
Panic/Coda2.download.recipe                        |   2 +-
Panic/Transmit.download.recipe                     |   2 +-
Puppetlabs/Facter.download.recipe                  |  17 +-
Puppetlabs/Puppet.download.recipe                  |  17 +-
SampleSharedProcessor/SampleSharedProcessor.recipe |   2 +-
.../SassafrasK2Client.download.recipe              |   2 +-
Silverlight/Silverlight.download.recipe            |  19 +-
Silverlight/Silverlight.install.recipe             |   9 +-
Silverlight/Silverlight.munki.recipe               |   6 +-
Silverlight/Silverlight.pkg.recipe                 |  25 +--
Skype/Skype.download.recipe                        |   4 +-
Skype/Skype.install.recipe                         |  11 +-
Skype/Skype.munki.recipe                           |   2 +-
Skype/Skype.pkg.recipe                             |   2 +-
Spotify/Spotify.download.recipe                    |   2 +-
Spotify/Spotify.munki.recipe                       |   2 -
TextMate/TextMate2.download.recipe                 |   2 +-
TextMate/TextMate2.munki.recipe                    |   2 +-
TextMate/TextMateURLProvider.py                    |   2 +-
The Unarchiver/TheUnarchiver.download.recipe       |  72 +++++---
The Unarchiver/TheUnarchiver.munki.recipe          |  17 +-
The Unarchiver/TheUnarchiver.pkg.recipe            |   7 +-
XQuartz/XQuartz.download.recipe                    |   4 +-
munkitools/GitHubReleasesInfoProvider.py           | 192 --------------------
munkitools/MunkitoolsPkgsFinder.py                 |  89 ---------
munkitools/MunkitoolsURLProvider.py                |  99 ----------
munkitools/munkitools.munki.recipe                 | 201 ---------------------
munkitools/munkitools2-autobuild.munki.recipe      |  41 ++++-
munkitools/munkitools2.munki.recipe                |  43 ++++-
101 files changed, 1263 insertions(+), 1125 deletions(-)
create mode 100644 OmniGroup/OmniFocus2.install.recipe
create mode 100644 OmniGroup/OmniGraffle.download.recipe
create mode 100644 OmniGroup/OmniGraffle6.download.recipe
create mode 100644 OmniGroup/OmniGrafflePro.download.recipe
create mode 100644 OmniGroup/OmniGraphSketcher.download.recipe
create mode 100644 OmniGroup/OmniOutliner.download.recipe
create mode 100644 OmniGroup/OmniOutliner4.download.recipe
create mode 100644 OmniGroup/OmniOutliner4.munki.recipe
create mode 100644 OmniGroup/OmniOutliner4.pkg.recipe
create mode 100644 OmniGroup/OmniOutlinerPro.download.recipe
create mode 100644 OmniGroup/OmniPlan.download.recipe
create mode 100644 OmniGroup/OmniPlan3.download.recipe
create mode 100644 OmniGroup/OmniPlan3.munki.recipe
create mode 100644 OmniGroup/OmniPlan3.pkg.recipe
delete mode 100644 munkitools/GitHubReleasesInfoProvider.py
delete mode 100755 munkitools/MunkitoolsPkgsFinder.py
delete mode 100644 munkitools/MunkitoolsURLProvider.py
delete mode 100644 munkitools/munkitools.munki.recipe

Updated search path:
  '.'
  '~/Library/AutoPkg/Recipes'
  '/Library/AutoPkg/Recipes'
  '/Users/daniel/Library/AutoPkg/RecipeRepos/com.github.autopkg.recipes'
  '/Users/daniel/Library/AutoPkg/RecipeRepos/com.github.autopkg.scriptingosx-recipes'
  '/Users/daniel/Library/AutoPkg/RecipeRepos/com.github.autopkg.jss-recipes'

If we know the recipe name we are looking for then we don’t need to browse the repos. In this example, I am searching for a recipe you will probably use later: fetch

 

daniel$ autopkg search fetch


If we know the recipe name we are looking for then we don’t need to browse the repos. In this example, I am searching for a recipe you will probably use later: fetch
daniel$ autopkg search fetch
 

I broke down and took a screenshot.

I broke down and took a screenshot.

Notice the command comes back with different names often referred to as recipe variants

Examples:

Fetch.install.recipe    -   To fetch and install the searched for recipe

screenFetch.munki.recipe   -  Specific to using Munki

Fetch.jss.recipe    -   you guessed it. Specific to using Jamf’s JSS

Fetch.pkg.recipe   - I often use this to to extract/create/recreate an Installer package

At this stage it’s becoming obvious that we can download and recreate packages in various ways. However, it’s important to have a common place to store these packages to retrieve for later use. It’s important to have a repo for this purpose. Munki is a great option for cost and support purposes. It’s open source and has a large community supporting it. If your organization has the money to roll with JAMF then autopkg has progressively improved their support for Casper.

For Munki, it’s recommended you have macOS Server app purchased/installed. Documentation for setup is at https://github.com/munki/munki/wiki/Demonstration-Setup

Keep it simple and demonstrate creating a package:

Ok. I hear you. To receive the latest package of Firefox type the following in Terminal.

autopkg run Firefox.pkg

Processing Firefox.pkg...

The following packages were built:

    Identifier               Version  Pkg Path                                                                                  

    ----------               -------  --------                                                                                  

org.mozilla.firefox.pkg  49.0.2   /Users/daniel/Library/AutoPkg/Cache/com.github.autopkg.pkg.Firefox_EN/Firefox-49.0.2.pkg  

The following new items were downloaded:

    Download Path                                                                                

    -------------                                                                               /Users/daniel/Library/AutoPkg/Cache/com.github.autopkg.pkg.Firefox_EN/downloads/Firefox.dmg

Using Finder I can follow the path to view the package that was built:

/Users/daniel/Library/AutoPkg/Cache/com.github.autopkg.pkg.Firefox_EN/Firefox-49.0.2.pkg 

Firefox-49.0.2.pkg - is a flat package that we can use for deployment.


If you prefer to use .dmg for deployment purposes then look in “downloads”

AutoPkgr

 

Too much command-line for you? Ok. Let's talk about using the a tool created by The Linde Group. 

http://www.lindegroup.com/autopkgr

To use AutoPkgr, you will need to have the following pre-requisites:

1. OS X 10.9.x or higher

2. Xcode and/or the Xcode Command Line Tools installed

3. Acceptance of the Xcode license agreement.

4. A logged-in user to run the AutoPkgr application in. This user can be a standard user or have admin rights. As of macOS 10.12.1, AutoPkgr will not install properly when double-clicking to launch the app. This is mostly likely due to Apple's tightening control of what is able to be launched using System Integrity Protection. If you are an admin, simply right-click the application and select "Open". However, it may be the VM I'm working on.

"Install" You can (it's required) to install "git" and the latest version of Autopkg.

"Repos & Recipes" search in specific repos for recipes you want to include. It the repo is not pre-populated in the list then you add in manually.

In "Schedule" you can select how you want to check and install for the most up-to-date packages. This is very important and keep you from having to manually search each application's site for the latest version. Also, allow the app using autopkg to notify you via email when the newest packages are available.

"Folders & Integration". I recommend you stick with the default folders unless you have good reasons not to. This pane allows you to select "Munki" integration. Also, you will see the ability to integrate using "Casper Suite Integration" recently renamed "JAMF Pro". Select which "Distribution Point" you need to use. As a side note, you must have either an on-site JSS or cloud-based JSS set-up for this to be an option.

My sincere hope is this helps you on the journey to understand the power of packaging and some great tools created to better manage them. Check back for a dive into macOS default tool "pkgutil".

 

What a Git

Git has been an industry buzz word for several years. What is “Git”? If you have read British books such as the Harry Potter series then the word will be familiar. It’s a noun for an unpleasant or contemptible person. Of course, that is not what I am referring to.

The Git I am referring to is a modern version control system that is incredibly popular. It’s a open-source tool used for tracking changes to projects big and small. Git’s function is to provide a framework for developers/script writers to collaborate on project. I will not go into the specifics. Needless to say there is a reason for it’s popularity.

I learned and continue to use Git from the command line. Once you understand how it works then the procedures for installation and use are workable. However, what if you are intimidated by the command line? You may a visual oriented individual that prefers a graphic based design. This is for you.

The following are GUI based front-ends for Git. Perhaps one of these will help you learn and implement Git into your organization or workflow.

GitKraken

Release the kraken! If you find yourself in a cross-platform environment such as Windows, macOS and Linux then GitKraken is a good client to start. It’s has one of the nicest design for a Git client.

GitKraken.png

Touted features include: 

  • Visual interaction and hints
  • 100% standalone
  • Supports multiple profiles
  • Supports single-click undo and redo functions
  • Built-in merge tool
  • A fast and intuitive search tool
  • Easily adapts to a user’s workspace and also supports submodules and Gitflow
  • Integrates with a user’s GitHub or Bitbucket account
  • Keyboard shortcuts plus lots more.

SmartGit

smartgit.png

Another popular client for macOS, Windows, and Linux. Users can use it with their own repos or other providers. Features include:

  • Supports Git pull requests and comments
  • Supports SVN repositories
  • Comes with Git-flow, SSH-client and file compare/merge tools
  • Integrates strongly with GitHub, BitBucket and Atlassian Stash
  • Supports Git pull requests and comments
  • Supports SVN repositories
  • Comes with Git-flow, SSH-client and file compare/merge tools
  • Integrates strongly with GitHub, BitBucket and Atlassian Stash

GitForce

For Linux and Windows, GitForce is a dead simple design that will allow you to manage projects without needing to drop into the command line. Be aware that GitForce requires having .NET support (or Mono runtime on Unix) and the actual git command line tool.

GitForce.png
Giggle.png

Giggle isn’t that attractive and has limited functionality at first look. It supports most Linux distros. Be aware Giggle has moved to GNOME infrastructure. This client is good at tracking Git content. It’s worth a look.

If you are looking for more then check out Techmint's article "11 Best Graphical Git Clients and Git Repository Viewers for Linux".