Build app pkg with preinstall script

This commit is contained in:
Greg Neagle
2014-05-28 12:18:32 -07:00
parent 88199f2f0f
commit f58fdd7a2c
3 changed files with 39 additions and 14 deletions
@@ -3,8 +3,8 @@
<plist version="1.0">
<dict>
<key>IFPkgDescriptionTitle</key>
<string>Managed Software Update</string>
<string>Managed Software Center</string>
<key>IFPkgDescriptionDescription</key>
<string>Managed Software Update application.</string>
<string>Managed Software Center application.</string>
</dict>
</plist>
+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
# remove any Managed Software Update.app bundle since the installer
# won't replace a bundle with a symlink, leading to yucky stuff like
# "/Applications/Utilities/Managed Software Update.app 1"
if [ -d "$3/Applications/Utilities/Managed Software Update.app" ] ; then
/bin/rm -r "$3/Applications/Utilities/Managed Software Update.app"
fi
if [ -d "$3/Applications/Utilities/Managed Software Update.app 1" ] ; then
/bin/rm -r "$3/Applications/Utilities/Managed Software Update.app 1"
fi
+24 -12
View File
@@ -501,18 +501,19 @@ for pkg in core admin app launchd; do
case $pkg in
"app")
ver="$MSUVERSION"
scripts="--scripts \"${MUNKIROOT}/code/pkgtemplate/Scripts_app\""
SCRIPTS="${MUNKIROOT}/code/pkgtemplate/Scripts_app"
;;
"launchd")
ver="$LAUNCHDVERSION"
scripts=""
SCRIPTS=""
;;
*)
ver="$VERSION"
scripts=""
SCRIPTS=""
;;
esac
echo "Packaging munkitools_$pkg-$ver.pkg"
echo "$SCRIPTS"
# Use pkgutil --analyze to build a component property list
# then turn off bundle relocation
sudo /usr/bin/pkgbuild \
@@ -527,15 +528,26 @@ for pkg in core admin app launchd; do
fi
# use sudo here so pkgutil doesn't complain when it tries to
# descend into root/Library/Managed Installs/*
sudo /usr/bin/pkgbuild \
--root "$PKGTMP/munki_$pkg" \
--identifier "$PKGID.$pkg" \
--version "$ver" \
--ownership preserve \
--info "$PKGTMP/info_$pkg" \
--component-plist "${PKGTMP}/munki_${pkg}_component.plist" \
${scripts} \
"$PKGDEST/munkitools_$pkg-$ver.pkg"
if [ "$SCRIPTS" != "" ]; then
sudo /usr/bin/pkgbuild \
--root "$PKGTMP/munki_$pkg" \
--identifier "$PKGID.$pkg" \
--version "$ver" \
--ownership preserve \
--info "$PKGTMP/info_$pkg" \
--component-plist "${PKGTMP}/munki_${pkg}_component.plist" \
--scripts "$SCRIPTS" \
"$PKGDEST/munkitools_$pkg-$ver.pkg"
else
sudo /usr/bin/pkgbuild \
--root "$PKGTMP/munki_$pkg" \
--identifier "$PKGID.$pkg" \
--version "$ver" \
--ownership preserve \
--info "$PKGTMP/info_$pkg" \
--component-plist "${PKGTMP}/munki_${pkg}_component.plist" \
"$PKGDEST/munkitools_$pkg-$ver.pkg"
fi
if [ "$?" -ne 0 ]; then
echo "Error packaging munkitools_$pkg-$ver.pkg before rebuilding it."