Removed make_munki_pkg* scripts; superseded by make_munki_mpkg* scripts.

git-svn-id: http://munki.googlecode.com/svn/trunk@1178 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
Greg Neagle
2011-05-12 17:19:59 +00:00
parent eda80319fb
commit 897fd28383
2 changed files with 0 additions and 367 deletions

View File

@@ -1,224 +0,0 @@
#!/bin/sh
#
# Build script for munki tools package
# Builds an installer package for munki tools
#
# if you are building your own version of munki, you might
# want to change the pkgid to reflect your organization
PKGID=com.googlecode.munki
# set FLAT to YES if you want a flat package
FLAT=NO
# set munkiroot to the root dir of your munki 'source'
munkiroot="/Users/Shared/munki/munki"
if [ ! -d "$munkiroot" ]; then
echo "Please set your munkiroot" 1>&2
exit -1
fi
# set packagedir to whereever you'd like the final package to be created
packagedir="/Users/Shared/pkgs"
if [ ! -d "$packagedir" ]; then
echo "Please set your packagedir" 1>&2
exit -1
fi
# get the version for the package
munkivers=`defaults read "$munkiroot/code/client/munkilib/version" CFBundleShortVersionString`
svnrev=`svnversion $munkiroot | cut -d: -f2 | tr -cd '[:digit:]'`
VERS=$munkivers.$svnrev.0
usage() {
echo "Usage: `basename \"$0\"` [all|Applications|Library|usr]"
echo
echo "By default all components are included in the package."
}
BUILD_APP=
BUILD_LIB=
BUILD_USR=
IDSUFFIX=
FILESUFFIX=
if [ $# -eq 0 ]; then
conf="all"
else
conf="$1"
fi
case "$conf" in
"all")
BUILD_APP=YES
BUILD_LIB=YES
BUILD_USR=YES
;;
"Applications")
BUILD_APP=YES
IDSUFFIX=applications
;;
"Library")
BUILD_LIB=YES
IDSUFFIX=library
;;
"usr")
BUILD_USR=YES
IDSUFFIX=usr
;;
*)
usage
exit -1
;;
esac
if [ ! -z "$IDSUFFIX" ]; then
PKGID="${PKGID}.${IDSUFFIX}"
FILESUFFIX="-${IDSUFFIX}"
fi
if [ ! -x "/Developer/usr/bin/packagemaker" ]; then
echo "PackageMaker is not installed!"
exit -1
fi
if [ $(id -u) -ne 0 ]; then
echo "Please enter your sudo password if prompted."
fi
if [ "$BUILD_APP" == "YES" ]; then
if [ ! -x "/usr/bin/xcodebuild" ]; then
echo "Xcode is not installed!"
exit -1
fi
(
cd "$munkiroot/code/Managed Software Update"
/usr/bin/xcodebuild -project "Managed Software Update.xcodeproj" -alltargets clean
/usr/bin/xcodebuild -project "Managed Software Update.xcodeproj" -alltargets build
XCODEBUILD_RESULT="$?"
if [ "$XCODEBUILD_RESULT" -ne 0 ]; then
echo "Error building Managed Software Update.app: $XCODEBUILD_RESULT"
exit -1
fi
)
if [ ! -e "$munkiroot/code/Managed Software Update/build/Release/Managed Software Update.app" ]; then
echo "Need a release build of Managed Software Update.app!"
echo "Open the Xcode project $munkiroot/code/Managed Software Update/Managed Software Update.xcodeproj and build it."
exit -1
fi
fi
if [ ! -d "$packagedir" ]; then
mkdir -p "$packagedir"
fi
# prerun cleanup
rm -rf "$packagedir/munkitools-$VERS.pkg"
if [ -d /tmp/munkitools ]; then
sudo rm -rf /tmp/munkitools
fi
mkdir /tmp/munkitools
cd /tmp/munkitools
if [ "$BUILD_USR" == "YES" ]; then
mkdir -p ./usr/local/munki/munkilib
chmod -R 755 ./usr
cp "$munkiroot/code/client/"* ./usr/local/munki/ 2>&1 | grep -v "munkilib is a directory"
cp "$munkiroot"/code/client/munkilib/*.py ./usr/local/munki/munkilib/
cp "$munkiroot"/code/client/munkilib/version.plist ./usr/local/munki/munkilib/
echo $svnrev > ./usr/local/munki/munkilib/svnversion
# no pre/postflight scripts in the package, please
rm -f ./usr/local/munki/preflight
rm -f ./usr/local/munki/postflight
fi
if [ "$BUILD_APP" == "YES" ]; then
mkdir -p ./Applications/Utilities
chmod -R 775 ./Applications
cp -R "$munkiroot/code/Managed Software Update/build/Release/Managed Software Update.app" ./Applications/Utilities/
chmod -R o-w ./Applications/Utilities/Managed\ Software\ Update.app
fi
if [ "$BUILD_LIB" == "YES" ]; then
mkdir -m 1775 ./Library
mkdir -m 755 ./Library/LaunchAgents
cp "$munkiroot/launchd/LaunchAgents/"*.plist ./Library/LaunchAgents/
chmod 644 ./Library/LaunchAgents/*
mkdir -m 755 ./Library/LaunchDaemons
cp "$munkiroot/launchd/LaunchDaemons/"*.plist ./Library/LaunchDaemons/
chmod 644 ./Library/LaunchDaemons/*
# create these directories in the package so we have a record
# and they can be removed later
mkdir -m 755 -p ./Library/Managed\ Installs
mkdir -m 750 -p ./Library/Managed\ Installs/Cache
mkdir -m 750 -p ./Library/Managed\ Installs/catalogs
mkdir -m 755 -p ./Library/Managed\ Installs/manifests
fi
chmod 1775 /tmp/munkitools
sudo chown root:admin /tmp/munkitools
sudo chown -hR root:wheel /tmp/munkitools
if [ -d ./Applications ]; then
sudo chown -hR root:admin ./Applications
fi
if [ -d ./Library ]; then
sudo chown root:admin ./Library
sudo chown -hR root:admin ./Library/Managed\ Installs
fi
MAJOR=`echo $VERS | cut -d. -f1`
MINOR=`echo $VERS | cut -d. -f2`
SIZE=`du -sk /tmp/munkitools | cut -f1`
NFILES=$(echo `find /tmp/munkitools/ | wc -l`)
MSUVERS=`defaults read "$munkiroot/code/Managed Software Update/build/Release/Managed Software Update.app/Contents/Info" CFBundleShortVersionString`
INFO=`mktemp -t packageinfo`
if [ "$FLAT" == "YES" ]; then
TARGET=10.5
# create PackageInfo
cat > "$INFO" <<EOF
<pkg-info format-version="2" identifier="$PKGID" version="$VERS" install-location="/" auth="root" postinstall-action="restart">
<payload installKBytes="$SIZE" numberOfFiles="$NFILES"/>
EOF
if [ "$BUILD_APP" == "YES" ]; then
cat >> "$INFO" <<EOF
<bundle id="com.googlecode.munki.ManagedSoftwareUpdate" CFBundleIdentifier="com.googlecode.munki.ManagedSoftwareUpdate" path="./Applications/Utilities/Managed Software Update.app" CFBundleVersion="$MSUVERS"/>
<bundle-version>
<bundle id="com.googlecode.munki.ManagedSoftwareUpdate"/>
</bundle-version>
EOF
fi
cat >> "$INFO" <<EOF
</pkg-info>
EOF
else
TARGET=10.4
# create Info.plist
cat "$munkiroot/code/pkgtemplate/Info.plist" > "$INFO"
/usr/libexec/PlistBuddy -c "set :CFBundleIdentifier $PKGID" "$INFO"
/usr/libexec/PlistBuddy -c "set :CFBundleShortVersionString $VERS" "$INFO"
/usr/libexec/PlistBuddy -c "set :IFMajorVersion $MAJOR" "$INFO"
/usr/libexec/PlistBuddy -c "set :IFMinorVersion $MINOR" "$INFO"
/usr/libexec/PlistBuddy -c "set :IFPkgFlagInstalledSize $SIZE" "$INFO"
/usr/libexec/PlistBuddy -c "set :IFPkgFlagRestartAction RequiredRestart" "$INFO"
fi
/Developer/usr/bin/packagemaker \
--root . \
--info "$INFO" \
--resources "$munkiroot/code/pkgtemplate/Resources" \
--id "$PKGID" \
--version "$VERS" \
--no-recommend \
--no-relocate \
--target $TARGET \
--out "$packagedir/munkitools-${VERS}${FILESUFFIX}.pkg" \
--verbose
rm -f "$INFO"
sudo rm -rf /tmp/munkitools

View File

@@ -1,143 +0,0 @@
#!/bin/sh
#
# Build script for munki tools package
# Builds an installer package for munki tools
# using the source checked out from code.google.com
#
# set PKGDIR to whereever you'd like the final package to be created
PKGDIR="/Users/Shared/pkgs"
if [ $(whoami) != "root" ]; then
echo "You must run this as root or via sudo!"
exit -1
fi
if [ ! -x "/usr/bin/xcodebuild" ]; then
echo "Xcode is not installed!"
exit -1
fi
if [ ! -x "/Developer/usr/bin/packagemaker" ]; then
echo "PackageMaker is not installed!"
exit -1
fi
# temporary storage for items from SVN
TMPDIR="/tmp"
MUNKIDIR="munki-SVN"
MUNKIROOT="$TMPDIR/$MUNKIDIR"
cd "$TMPDIR"
if [ -d "$MUNKIROOT" ] ; then
rm -r "$MUNKIROOT"
fi
svn checkout http://munki.googlecode.com/svn/trunk/ "$MUNKIDIR"
CHECKOUT_RESULT="$?"
if [ "$CHECKOUT_RESULT" != "0" ]; then
echo "Error checking out munki code from SVN: $CHECKOUT_RESULT"
exit -1
fi
# Get the munki version.
MUNKIVERS=`defaults read "$MUNKIROOT/code/client/munkilib/version" CFBundleShortVersionString`
SVNREV=`svnversion "$MUNKIROOT" | cut -d: -f2 | tr -cd '[:digit:]'`
VERS=$MUNKIVERS.$SVNREV.0
echo "Starting build for munki tools version $VERSION"
cd "$MUNKIROOT/code/Managed Software Update"
/usr/bin/xcodebuild -project Managed\ Software\ Update.xcodeproj -alltargets
XCODEBUILD_RESULT="$?"
if [ "$XCODEBUILD_RESULT" != "0" ]; then
echo "Error building Managed Software Update.app: $XCODEBUILD_RESULT"
exit -1
fi
if [ ! -e "$MUNKIROOT/code/Managed Software Update/build/Release/Managed Software Update.app" ]; then
echo "Build of Managed Software Update.app not found at $MUNKIROOT/code/Managed Software Update/build/Release/"
exit -1
fi
if [ ! -d "$PKGDIR" ]; then
mkdir -p "$PKGDIR"
fi
# prerun cleanup
rm -rf "$PKGDIR/munkitools-$VERS.pkg"
rm -rf /tmp/munkitools
mkdir /tmp/munkitools
chown root:wheel /tmp/munkitools
chmod 755 /tmp/munkitools
cd /tmp/munkitools
mkdir -p ./usr/local/munki/munkilib
chown -R root:wheel ./usr
chmod -R 755 ./usr
cp "$MUNKIROOT/code/client/"* ./usr/local/munki/
cp "$MUNKIROOT"/code/client/munkilib/*.py ./usr/local/munki/munkilib/
cp "$MUNKIROOT"/code/client/munkilib/version.plist ./usr/local/munki/munkilib/
echo $SVNREV > ./usr/local/munki/munkilib/svnversion
# no pre/postflight scripts in the package, please
rm -f ./usr/local/munki/preflight
rm -f ./usr/local/munki/postflight
mkdir -p ./Applications/Utilities
chown -R root:admin ./Applications
chmod -R 775 ./Applications
cp -R "$MUNKIROOT/code/Managed Software Update/build/Release/Managed Software Update.app" ./Applications/Utilities/
chmod -R o-w ./Applications/Utilities/Managed\ Software\ Update.app
mkdir -m 755 ./Library
mkdir -m 755 ./Library/LaunchAgents
chown root:wheel ./Library/LaunchAgents
cp "$MUNKIROOT/launchd/LaunchAgents/"*.plist ./Library/LaunchAgents/
chmod 644 ./Library/LaunchAgents/*
mkdir -m 755 ./Library/LaunchDaemons
chown root:wheel ./Library/LaunchDaemons
cp "$MUNKIROOT/launchd/LaunchDaemons/"*.plist ./Library/LaunchDaemons/
chmod 644 ./Library/LaunchDaemons/*
# create these directories in the package so we have a record
# and they can be removed later
mkdir -m 755 -p ./Library/Managed\ Installs
mkdir -m 750 -p ./Library/Managed\ Installs/Cache
mkdir -m 750 -p ./Library/Managed\ Installs/catalogs
mkdir -m 755 -p ./Library/Managed\ Installs/manifests
chown -R root:admin ./Library/Managed\ Installs
PKGID=com.googlecode.munki
/Developer/usr/bin/packagemaker --root . --id "$PKGID" --version "$VERS" --no-recommend --out "$PKGDIR/munkitools-$VERS.pkg" --verbose
rm -f "$PKGDIR/munkitools-$VERS.pkg/Contents/Resources/TokenDefinitions.plist"
defaults delete "$PKGDIR/munkitools-$VERS.pkg/Contents/Info" IFPkgPathMappings
defaults write "$PKGDIR/munkitools-$VERS.pkg/Contents/Info" IFPkgFlagRestartAction "RequiredRestart"
plutil -convert xml1 "$PKGDIR/munkitools-$VERS.pkg/Contents/Info.plist"
chmod 664 "$PKGDIR/munkitools-$VERS.pkg/Contents/Info.plist"
LPROJPATH="$PKGDIR/munkitools-$VERS.pkg/Contents/Resources/en.lproj"
if [ ! -d "$LPROJPATH" ]; then
# insert your own local language here if needed
LPROJPATH="$PKGDIR/munkitools-$VERS.pkg/Contents/Resources/English.lproj"
fi
cat > "$LPROJPATH/Description.plist" <<EOF
<?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>IFPkgDescriptionDescription</key>
<string>Managed software installation tools.</string>
<key>IFPkgDescriptionTitle</key>
<string>munki tools</string>
</dict>
</plist>
EOF
# now clean up
rm -r "$MUNKIROOT"
rm -r /tmp/munkitools