summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2009-11-20 15:31:30 +0000
committerSol Jerome <solj@ices.utexas.edu>2009-11-20 15:31:30 +0000
commit0f07fb09115d71990bcf3844782ce4174f2158ff (patch)
treef11bd619490e8d2a8a6c82bb32c7050aa448829e
parentddc74a543f53d4197e990def51628f961af5b8cd (diff)
downloadbcfg2-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
-rw-r--r--osx/M2Crypto-0.20.2-py2.5-macosx-10.5-ppc.eggbin0 -> 417080 bytes
-rw-r--r--osx/Makefile114
-rw-r--r--osx/PackageInfo.plist36
-rw-r--r--osx/bcfg2.conf8
-rw-r--r--osx/easy-install.pth3
-rw-r--r--osx/gov.anl.mcs.bcfg2-daily.plist24
-rw-r--r--osx/postflight14
-rw-r--r--osx/preflight11
8 files changed, 210 insertions, 0 deletions
diff --git a/osx/M2Crypto-0.20.2-py2.5-macosx-10.5-ppc.egg b/osx/M2Crypto-0.20.2-py2.5-macosx-10.5-ppc.egg
new file mode 100644
index 000000000..3e07b92dd
--- /dev/null
+++ b/osx/M2Crypto-0.20.2-py2.5-macosx-10.5-ppc.egg
Binary files differ
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
diff --git a/osx/PackageInfo.plist b/osx/PackageInfo.plist
new file mode 100644
index 000000000..cb553576c
--- /dev/null
+++ b/osx/PackageInfo.plist
@@ -0,0 +1,36 @@
+<?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>CFBundleIdentifier</key>
+ <string>gov.anl.mcs</string>
+ <key>CFBundleShortVersionString</key>
+ <string>{SHORTVERSION}</string>
+ <key>IFMajorVersion</key>
+ <integer>{MAJORVERSION}</integer>
+ <key>IFMinorVersion</key>
+ <integer>{MINORVERSION}</integer>
+ <key>IFPkgFlagAllowBackRev</key>
+ <false/>
+ <key>IFPkgFlagAuthorizationAction</key>
+ <string>RootAuthorization</string>
+ <key>IFPkgFlagDefaultLocation</key>
+ <string>/</string>
+ <key>IFPkgFlagFollowLinks</key>
+ <true/>
+ <key>IFPkgFlagInstallFat</key>
+ <false/>
+ <key>IFPkgFlagIsRequired</key>
+ <false/>
+ <key>IFPkgFlagOverwritePermissions</key>
+ <false/>
+ <key>IFPkgFlagRelocatable</key>
+ <false/>
+ <key>IFPkgFlagRestartAction</key>
+ <string>None</string>
+ <key>IFPkgFlagRootVolumeOnly</key>
+ <true/>
+ <key>IFPkgFlagUpdateInstalledLanguages</key>
+ <false/>
+</dict>
+</plist>
diff --git a/osx/bcfg2.conf b/osx/bcfg2.conf
new file mode 100644
index 000000000..cac424576
--- /dev/null
+++ b/osx/bcfg2.conf
@@ -0,0 +1,8 @@
+[communication]
+protocol = xmlrpc/ssl
+password = foobat
+# certificate = /etc/bcfg2.key
+# key = /etc/bcfg2.key
+
+[components]
+bcfg2 = https://localhost:6789
diff --git a/osx/easy-install.pth b/osx/easy-install.pth
new file mode 100644
index 000000000..c0c4d11e5
--- /dev/null
+++ b/osx/easy-install.pth
@@ -0,0 +1,3 @@
+import sys; sys.__plen = len(sys.path)
+./M2Crypto-0.20.2-py2.5-macosx-10.5-ppc.egg
+import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)
diff --git a/osx/gov.anl.mcs.bcfg2-daily.plist b/osx/gov.anl.mcs.bcfg2-daily.plist
new file mode 100644
index 000000000..8c2d07d24
--- /dev/null
+++ b/osx/gov.anl.mcs.bcfg2-daily.plist
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Label</key>
+ <string>gov.anl.mcs.bcfg2-daily</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>/usr/local/bin/bcfg2</string>
+ <string>-n</string>
+ </array>
+ <key>LowPriorityIO</key>
+ <true/>
+ <key>Nice</key>
+ <integer>1</integer>
+ <key>StartCalendarInterval</key>
+ <dict>
+ <key>Hour</key>
+ <integer>3</integer>
+ <key>Minute</key>
+ <integer>15</integer>
+ </dict>
+</dict>
+</plist>
diff --git a/osx/postflight b/osx/postflight
new file mode 100644
index 000000000..52a948a2a
--- /dev/null
+++ b/osx/postflight
@@ -0,0 +1,14 @@
+#!/bin/bash
+#
+# ${3} is the destination volume so that this works correctly
+# when being installed to volumes other than the current OS.
+
+# set proper perms
+/usr/bin/find "${3}"{SITELIBDIR}/Bcfg2* -type f -exec chmod 0644 {} \;
+chmod 0644 "${3}"{DATADIR}/share/man/man1/bcfg2.1
+chmod 0644 "${3}"{DATADIR}/share/man/man5/bcfg2.conf.5
+chmod 0644 "${3}"/Library/LaunchDaemons/{LAUNCHD}
+chmod 0755 "${3}"/usr/local/bin/bcfg2
+
+# add the launchd script
+/bin/launchctl load -w "${3}"/Library/LaunchDaemons/{LAUNCHD}
diff --git a/osx/preflight b/osx/preflight
new file mode 100644
index 000000000..169551b35
--- /dev/null
+++ b/osx/preflight
@@ -0,0 +1,11 @@
+#!/bin/bash
+#
+# Remove old bcfg2 cruft
+#
+# ${3} is the destination volume so that this works correctly
+# when being installed to volumes other than the current OS.
+
+/bin/rm -Rvf "${3}"{SITELIBDIR}/Bcfg2*
+/bin/rm -Rvf "${3}"/usr/local/bin/bcfg2*
+/bin/rm -Rvf "${3}{DATADIR}/share/bcfg2"
+/bin/rm -Rvf "${3}{DATADIR}/share/man/man8/bcfg2*"