2 # Make sure we are running in the right directory...
3 if test ! -f tools
/testosx
; then
4 echo "Run this script from the top-level CUPS source directory, e.g.:"
6 echo " sudo tools/testosx [version]"
11 if test `whoami` != root
; then
12 echo "Run this script with sudo, e.g.:"
14 echo " sudo tools/testosx [version]"
19 # Get the current working copy version...
20 rev=`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[a-zA-Z]*//g'`
23 version
="1.5svn-r$rev"
28 # Setup an install directory...
31 pkgdir
="/tmp/cups.pkg-$user"
33 echo Building package using temp directory
$pkgdir...
35 mkdir
-p $pkgdir/Package
36 mkdir
-p $pkgdir/Resources
38 # Install resource files into the Resources directory...
39 echo Installing resource files...
40 cp packaging
/LICENSE.rtf
$pkgdir/Resources
/ReadMe.rtf
41 sed -e '1,$s/@CUPS_VERSION@/'$version'/g' \
42 <packaging
/WELCOME.rtf
>$pkgdir/Resources
/Welcome.rtf
43 cp packaging
/installer.tif
$pkgdir/Resources
/background.tif
45 if test -x /bin
/launchctl
; then
46 cat >$pkgdir/Resources
/preflight
<<EOF
48 # Tell launchd to stop cupsd...
49 if test "x`whoami`" = xroot; then
50 sudo launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist || exit 0
51 sudo launchctl unload /System/Library/LaunchDaemons/org.cups.cups-lpd.plist || exit 0
53 killall cupsd || exit 0
56 cat >$pkgdir/Resources
/preflight
<<EOF
58 # Stop any running cupsd processes...
59 killall cupsd || exit 0
63 chmod 755 $pkgdir/Resources
/preflight
65 if test -x /bin
/launchctl
; then
66 cat >$pkgdir/Resources
/postflight
<<EOF
69 # Remove old xinetd config file, we use launchd now...
70 rm -f /etc/xinetd.d/cups-lpd
72 # Tell launchd to reload cupsd...
73 if test "x`whoami`" = xroot; then
74 sudo launchctl load /System/Library/LaunchDaemons/org.cups.cupsd.plist
75 sudo launchctl load /System/Library/LaunchDaemons/org.cups.cupsd-lpd.plist || exit 0
79 cat >$pkgdir/Resources
/postflight
<<EOF
87 chmod 755 $pkgdir/Resources
/postflight
91 cp packaging
/InstallationCheck
$pkgdir/Resources
92 chmod 755 $pkgdir/Resources
/InstallationCheck
96 # Tag the current revision in the plist and web interface files...
97 for file in packaging
/cups-desc.plist packaging
/cups-info.plist \
98 doc
/index.html templates
/header.tmpl
; do
99 echo Updating
$file...
100 sed -e '1,$s/@CUPS_VERSION@/'$version'/g' \
101 -e '1,$s/@CUPS_REVISION@//g' \
102 -e '1,$s/@CUPS_RELEASE@/1.5.'$rev'/g' \
106 # Install CUPS into the Package directory...
107 #make INSTALL=$topdir/install-sh BUILDROOT=$pkgdir/Package install
108 make BUILDROOT
=$pkgdir/Package
install ||
exit 1
110 # Figure out where PackageMaker is installled...
111 if test -d /Developer
/Applications
/Utilities
/PackageMaker.app
; then
112 PackageMaker
=/Developer
/Applications
/Utilities
/PackageMaker.app
/Contents
/MacOS
/PackageMaker
114 PackageMaker
=/Developer
/Applications
/PackageMaker.app
/Contents
/MacOS
/PackageMaker
117 # Create the package...
118 echo Creating MacOS X package...
120 echo $PackageMaker -build -v -p cups.pkg \
122 -r $pkgdir/Resources \
123 -d packaging
/cups-desc.plist \
124 -i packaging
/cups-info.plist
125 $PackageMaker -build -v -p cups.pkg \
127 -r $pkgdir/Resources \
128 -d packaging
/cups-desc.plist \
129 -i packaging
/cups-info.plist
131 # Create a disk image...
132 echo Creating MacOS X disk image...
133 hdiutil create
-ov -srcfolder cups.pkg cups-
$version.dmg
135 # Cleanup temp files...
136 echo Removing temporary files...