Homebrew Packaging Guide

From AFP548 Wiki
Jump to: navigation, search

This guide is for setting up homebrew to build individual packages that can be deployed with munki or ARD.

Scripts[edit]

/opt/homebrew/bin/rebuild-homebrew-pkgs

#!/bin/bash
cd /opt/homebrew/Cellar
rm -rf *.pkg
for i in `ls -d *`
do
    sed "s/HOMEBREW_PKG_NAME/$i/" < /opt/homebrew/luggage-templates/Makefile > Makefile
    sed "s/HOMEBREW_PKG_NAME/$i/" < /opt/homebrew/luggage-templates/postinstall > postinstall
    make pkg
done
mv *pkg ../homebrew-pkgs
rm Makefile postinstall

/opt/homebrew/luggage-templates/Makefile

include /usr/local/share/luggage/luggage.make
 
BREWPKG=HOMEBREW_PKG_NAME
TITLE=Homebrew-$(BREWPKG)
REVERSE_DOMAIN=edu.psu.astro
PAYLOAD=pack-homebrew-$(BREWPKG)\
    pack-script-postinstall
 
pack-homebrew-%: %
    @sudo mkdir -p ${WORK_D}/opt/homebrew/Cellar
    @sudo ${CP} -r $< ${WORK_D}/opt/homebrew/Cellar
    @sudo chown root:staff ${WORK_D}

/opt/homebrew/luggage-templates/postinstall

#!/bin/sh
/opt/homebrew/bin/brew link HOMEBREW_PKG_NAME

Usage[edit]

  1. Install homebrew http://mxcl.github.com/homebrew/ to /opt/homebrew
  2. Install The Luggage http://glarizza.posterous.com/an-intro-to-using-the-luggage-for-packaging
  3. Package /opt/homebrew (using Luggage or whatever tool you'd like)
  4. Install your brews using brew install <app>
  5. run /opt/homebrew/bin/rebuild-homebrew-pkgs
  6. copy packages from /opt/homebrew/homebrew-pkgs to your package repository (i.e. munki)