diff options
author | Sol Jerome <solj@ices.utexas.edu> | 2009-11-20 15:31:30 +0000 |
---|---|---|
committer | Sol Jerome <solj@ices.utexas.edu> | 2009-11-20 15:31:30 +0000 |
commit | 0f07fb09115d71990bcf3844782ce4174f2158ff (patch) | |
tree | f11bd619490e8d2a8a6c82bb32c7050aa448829e /osx/Makefile | |
parent | ddc74a543f53d4197e990def51628f961af5b8cd (diff) | |
download | bcfg2-0f07fb09115d71990bcf3844782ce4174f2158ff.tar.gz bcfg2-0f07fb09115d71990bcf3844782ce4174f2158ff.tar.bz2 bcfg2-0f07fb09115d71990bcf3844782ce4174f2158ff.zip |
OSX: New packaging framework
This commit allows you to build both client/server packages for OS X by
changing to the osx directory and running make client/server,
respectively. Hopefully make it easier to setup bcfg2 clients on OS X
since the most current packages I could find were still 0.9.4.
Signed-off-by: Sol Jerome <solj@ices.utexas.edu>
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5584 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'osx/Makefile')
-rw-r--r-- | osx/Makefile | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/osx/Makefile b/osx/Makefile new file mode 100644 index 000000000..698d060ab --- /dev/null +++ b/osx/Makefile @@ -0,0 +1,114 @@ +PYVERSION := $(shell /usr/bin/python -c "import sys; print sys.version[0:3]") +PREFLIGHT = preflight +POSTFLIGHT = postflight +PKGROOT = bcfg2pkg +PKGTMP = bcfg2tmp +FILTERS = --filter Hostbase \ +--filter Reports \ +--filter Server \ +--filter xsd \ +--filter xsl \ +--filter bcfg2-admin \ +--filter bcfg2-build-reports \ +--filter bcfg2-info \ +--filter bcfg2-ping-sweep \ +--filter bcfg2-repo-validate \ +--filter bcfg2-reports \ +--filter bcfg2-server + +CONF = bcfg2.conf +DATADIR = /Library/Frameworks/Python.framework/Versions/Current +LAUNCHD = gov.anl.mcs.bcfg2-daily.plist +PACKAGEMAKER = /Developer/usr/bin/packagemaker +PROTO_PLIST = PackageInfo.plist +SITELIBDIR = /Library/Python/${PYVERSION}/site-packages + +# Symlinks cannot be specified on the command line, therefore, we create +# an Info.plist file for packagemaker to look at for package creation +# and substitute the version strings. Major/Minor versions can only be +# integers (e.g. "1" and "00" for bcfg2 version 1.0.0. +BCFGVER = $(shell /usr/bin/grep version ../setup.py | cut -d\" -f2) +BCFGVER1 = $(shell /bin/echo ${BCFGVER} | /usr/bin/cut -d"." -f1) +BCFGVER2 = $(shell /bin/echo ${BCFGVER} | /usr/bin/cut -d"." -f2) +BCFGVER3 = $(shell /bin/echo ${BCFGVER} | /usr/bin/cut -d"." -f3) +MAJOR = ${BCFGVER1} +MINOR = ${BCFGVER2}${BCFGVER3} + +default: clean client + +install: + echo "Installing Bcfg2 to ${PKGROOT}" + mkdir ${PKGROOT} + cd ../ && /usr/bin/python setup.py install \ + --root="osx/${PKGROOT}" \ + --install-lib="${SITELIBDIR}" \ + --install-data="${DATADIR}" + /usr/sbin/chown -R root:admin "${PKGROOT}" + +prepare: install + mkdir ${PKGTMP} + cp ${PROTO_PLIST} ${PKGTMP} + sed -i '' "s/{SHORTVERSION}/${BCFGVER}/g" "${PKGTMP}/${PROTO_PLIST}" + sed -i '' "s/{MAJORVERSION}/${MAJOR}/g" "${PKGTMP}/${PROTO_PLIST}" + sed -i '' "s/{MINORVERSION}/${MINOR}/g" "${PKGTMP}/${PROTO_PLIST}" + + # create a preflight script to remove traces of previous + # bcfg2 installs due to limitations in Apple's pkg format + mkdir -p "${PKGTMP}/scripts" + cp "${PREFLIGHT}" "${PKGTMP}/scripts" + cp "${POSTFLIGHT}" "${PKGTMP}/scripts" + + # substitute in the {sitelib,data}dir specified above on the assumption that + # this is where any previous bcfg2 install exists that should be cleaned out. + sed -i '' "s|{SITELIBDIR}|${SITELIBDIR}|g" "${PKGTMP}/scripts/${PREFLIGHT}" + sed -i '' "s|{SITELIBDIR}|${SITELIBDIR}|g" "${PKGTMP}/scripts/${POSTFLIGHT}" + sed -i '' "s|{DATADIR}|${DATADIR}|g" "${PKGTMP}/scripts/${PREFLIGHT}" + sed -i '' "s|{DATADIR}|${DATADIR}|g" "${PKGTMP}/scripts/${POSTFLIGHT}" + # substitute in the bindir specified on the assumption that this is where + # any old executables that have moved from bindir->sbindir should be + # cleaned out from. + sed -i '' "s|{BINDIR}|${BINDIR}|g" "${PKGTMP}/scripts/${PREFLIGHT}" + sed -i '' "s|{BINDIR}|${BINDIR}|g" "${PKGTMP}/scripts/${POSTFLIGHT}" + sed -i '' "s|{LAUNCHD}|${LAUNCHD}|g" "${PKGTMP}/scripts/${POSTFLIGHT}" + # {pre,post}flight scripts must be 770 to execute + chmod 0770 "${PKGTMP}/scripts/${PREFLIGHT}" + chmod 0770 "${PKGTMP}/scripts/${POSTFLIGHT}" + + # add in M2Crypto + /bin/expr ${PYVERSION} \< 2.6 && \ + cp "M2Crypto-0.20.2-py2.5-macosx-10.5-ppc.egg" "${PKGROOT}/${SITELIBDIR}" && \ + cp "easy-install.pth" "${PKGROOT}/${SITELIBDIR}" + + # add default bcfg2.conf + mkdir -p "${PKGROOT}/etc" + cp "${CONF}" "${PKGROOT}/etc/${CONF}" + + # add default launchd cron job + mkdir -p "${PKGROOT}/Library/LaunchDaemons" + cp "${LAUNCHD}" "${PKGROOT}/Library/LaunchDaemons/${LAUNCHD}" + +client: prepare + rm -rf `pwd`/bcfg2-${BCFGVER}.pkg + echo "Building package" + echo "Note that packagemaker is reknowned for spurious errors. Don't panic." + "${PACKAGEMAKER}" --root "${PKGROOT}" \ + --info "${PKGTMP}/${PROTO_PLIST}" \ + --scripts "${PKGTMP}/scripts" \ + ${FILTERS} \ + --verbose \ + --title "bcfg2" \ + --out `pwd`/bcfg2-${BCFGVER}.pkg + +server: prepare + rm -rf `pwd`/bcfg2-${BCFGVER}.pkg + echo "Building package" + echo "Note that packagemaker is reknowned for spurious errors. Don't panic." + "${PACKAGEMAKER}" --root "${PKGROOT}" \ + --info "${PKGTMP}/${PROTO_PLIST}" \ + --scripts "${PKGTMP}/scripts" \ + --verbose \ + --title "bcfg2" \ + --out `pwd`/bcfg2-${BCFGVER}.pkg + +clean: + rm -rf bcfg2tmp bcfg2pkg |