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.:"
11 # Get the current working copy version...
12 rev=`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[a-zA-Z]*//g'`
14 # Setup an install directory...
17 pkgdir
="/tmp/cups.pkg-$user"
19 echo Building package using temp directory
$pkgdir...
21 mkdir
-p $pkgdir/Package
22 mkdir
-p $pkgdir/Resources
24 # Install resource files into the Resources directory...
25 echo Installing resource files...
26 cp packaging
/LICENSE.rtf
$pkgdir/Resources
/ReadMe.rtf
27 cp packaging
/WELCOME.rtf
$pkgdir/Resources
/Welcome.rtf
28 cp packaging
/installer.tif
$pkgdir/Resources
/background.tif
30 cat >$pkgdir/Resources
/preflight
<<EOF
32 # Stop any running cupsd processes...
33 killall cupsd || exit 0
35 chmod 755 $pkgdir/Resources
/preflight
37 if test -x /bin
/launchctl
; then
38 cat >$pkgdir/Resources
/postflight
<<EOF
41 # Remove old startup item, we use launchd now...
42 rm -f /System/Library/StartupItems/PrintingServices/PrintingServices
44 # Tell launchd to reload cupsd...
45 launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist || exit 0
46 launchctl load /System/Library/LaunchDaemons/org.cups.cupsd.plist
49 cat >$pkgdir/Resources
/postflight
<<EOF
57 chmod 755 $pkgdir/Resources
/postflight
59 # Tag the current revision in the plist and web interface files...
60 sed -e '1,$s/@CUPS_VERSION@/1.2svn-r'$rev'/g' \
61 -e '1,$s/@CUPS_RELEASE@/1.2.'$rev'/g' \
62 <packaging
/cups-desc.plist.
in >packaging
/cups-desc.plist
63 sed -e '1,$s/@CUPS_VERSION@/1.2svn-r'$rev'/g' \
64 -e '1,$s/@CUPS_RELEASE@/1.2.'$rev'/g' \
65 <packaging
/cups-info.plist.
in >packaging
/cups-info.plist
66 sed -e '1,$s/@CUPS_VERSION@/1.2svn-r'$rev'/g' \
67 <doc
/index.html.
in >doc
/index.html
68 sed -e '1,$s/@CUPS_VERSION@/1.2svn-r'$rev'/g' \
69 <templates
/header.tmpl.
in >templates
/header.tmpl
71 # Install CUPS into the Package directory...
72 #make INSTALL=$topdir/install-sh BUILDROOT=$pkgdir/Package install
73 make BUILDROOT
=$pkgdir/Package
install
75 # Figure out where PackageMaker is installled...
76 if test -d /Developer
/Applications
/Utilities
/PackageMaker.app
; then
77 PackageMaker
=/Developer
/Applications
/Utilities
/PackageMaker.app
/Contents
/MacOS
/PackageMaker
79 PackageMaker
=/Developer
/Applications
/PackageMaker.app
/Contents
/MacOS
/PackageMaker
82 # Create the package...
83 echo Creating MacOS X package...
85 echo $PackageMaker -build -v -p cups.pkg \
87 -r $pkgdir/Resources \
88 -d packaging
/cups-desc.plist \
89 -i packaging
/cups-info.plist
90 $PackageMaker -build -v -p cups.pkg \
92 -r $pkgdir/Resources \
93 -d packaging
/cups-desc.plist \
94 -i packaging
/cups-info.plist
96 # Create a disk image...
97 echo Creating MacOS X disk image...
98 hdiutil create
-ov -srcfolder cups.pkg cups-1.2svn-r
$rev.dmg
100 # Cleanup temp files...
101 echo Removing temporary files...