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 " tools/testosx [version]"
11 # Get the current working copy version...
12 rev=`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[a-zA-Z]*//g'`
15 version
="1.3svn-r$rev"
20 # Setup an install directory...
23 pkgdir
="/tmp/cups.pkg-$user"
25 echo Building package using temp directory
$pkgdir...
27 mkdir
-p $pkgdir/Package
28 mkdir
-p $pkgdir/Resources
30 # Install resource files into the Resources directory...
31 echo Installing resource files...
32 cp packaging
/LICENSE.rtf
$pkgdir/Resources
/ReadMe.rtf
33 sed -e '1,$s/@CUPS_VERSION@/'$version'/g' \
34 <packaging
/WELCOME.rtf
>$pkgdir/Resources
/Welcome.rtf
35 cp packaging
/installer.tif
$pkgdir/Resources
/background.tif
37 cat >$pkgdir/Resources
/preflight
<<EOF
39 # Stop any running cupsd processes...
40 killall cupsd || exit 0
42 chmod 755 $pkgdir/Resources
/preflight
44 if test -x /bin
/launchctl
; then
45 cat >$pkgdir/Resources
/postflight
<<EOF
48 # Remove old startup item and xinetd config file, we use launchd now...
49 rm -f /System/Library/StartupItems/PrintingServices/PrintingServices
50 rm -f /etc/xinetd.d/cups-lpd
52 # Tell launchd to reload cupsd...
53 launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist || exit 0
54 launchctl unload /System/Library/LaunchDaemons/org.cups.cups-lpd.plist || exit 0
55 launchctl load /System/Library/LaunchDaemons/org.cups.cupsd.plist
56 launchctl load /System/Library/LaunchDaemons/org.cups.cupsd-lpd.plist || exit 0
59 cat >$pkgdir/Resources
/postflight
<<EOF
67 chmod 755 $pkgdir/Resources
/postflight
69 # Tag the current revision in the plist and web interface files...
70 for file in packaging
/cups-desc.plist packaging
/cups-info.plist \
71 doc
/index.html
doc
/ja
/index.html templates
/header.tmpl
; do
72 echo Updating
$file...
73 sed -e '1,$s/@CUPS_VERSION@/'$version'/g' \
74 -e '1,$s/@CUPS_REVISION@//g' \
75 -e '1,$s/@CUPS_RELEASE@/1.3.'$rev'/g' \
79 # Install CUPS into the Package directory...
80 #make INSTALL=$topdir/install-sh BUILDROOT=$pkgdir/Package install
81 make BUILDROOT
=$pkgdir/Package
install
83 # Figure out where PackageMaker is installled...
84 if test -d /Developer
/Applications
/Utilities
/PackageMaker.app
; then
85 PackageMaker
=/Developer
/Applications
/Utilities
/PackageMaker.app
/Contents
/MacOS
/PackageMaker
87 PackageMaker
=/Developer
/Applications
/PackageMaker.app
/Contents
/MacOS
/PackageMaker
90 # Create the package...
91 echo Creating MacOS X package...
93 echo $PackageMaker -build -v -p cups.pkg \
95 -r $pkgdir/Resources \
96 -d packaging
/cups-desc.plist \
97 -i packaging
/cups-info.plist
98 $PackageMaker -build -v -p cups.pkg \
100 -r $pkgdir/Resources \
101 -d packaging
/cups-desc.plist \
102 -i packaging
/cups-info.plist
104 # Create a disk image...
105 echo Creating MacOS X disk image...
106 hdiutil create
-ov -srcfolder cups.pkg cups-
$version.dmg
108 # Cleanup temp files...
109 echo Removing temporary files...