]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | #!/bin/sh |
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.:" | |
5 | echo "" | |
6 | echo " tools/testosx" | |
7 | echo "" | |
8 | exit 1 | |
9 | fi | |
10 | ||
a4d04587 | 11 | # Get the current working copy version... |
12 | rev=`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[a-zA-Z]*//g'` | |
ef416fc2 | 13 | |
14 | # Setup an install directory... | |
15 | user=`whoami` | |
16 | topdir=`pwd` | |
17 | pkgdir="/tmp/cups.pkg-$user" | |
18 | ||
19 | echo Building package using temp directory $pkgdir... | |
20 | rm -rf $pkgdir | |
21 | mkdir -p $pkgdir/Package | |
22 | mkdir -p $pkgdir/Resources | |
23 | ||
ef416fc2 | 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 | |
29 | ||
30 | cat >$pkgdir/Resources/preflight <<EOF | |
31 | #!/bin/sh | |
a4d04587 | 32 | # Stop any running cupsd processes... |
ef416fc2 | 33 | killall cupsd || exit 0 |
34 | EOF | |
35 | chmod 755 $pkgdir/Resources/preflight | |
36 | ||
e00b005a | 37 | if test -x /bin/launchctl; then |
38 | cat >$pkgdir/Resources/postflight <<EOF | |
ef416fc2 | 39 | #!/bin/sh |
e00b005a | 40 | |
41 | # Remove old startup item, we use launchd now... | |
42 | rm -f /System/Library/StartupItems/PrintingServices/PrintingServices | |
43 | ||
44 | # Tell launchd to reload cupsd... | |
a4d04587 | 45 | launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist || exit 0 |
46 | launchctl load /System/Library/LaunchDaemons/org.cups.cupsd.plist | |
ef416fc2 | 47 | EOF |
e00b005a | 48 | else |
49 | cat >$pkgdir/Resources/postflight <<EOF | |
50 | #!/bin/sh | |
51 | ||
52 | # Start cupsd... | |
53 | /usr/sbin/cupsd | |
54 | EOF | |
55 | fi | |
56 | ||
ef416fc2 | 57 | chmod 755 $pkgdir/Resources/postflight |
58 | ||
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 | |
09ec0018 | 68 | sed -e '1,$s/@CUPS_VERSION@/1.2svn-r'$rev'/g' \ |
69 | <templates/header.tmpl.in >templates/header.tmpl | |
70 | ||
71 | # Install CUPS into the Package directory... | |
72 | #make INSTALL=$topdir/install-sh BUILDROOT=$pkgdir/Package install | |
73 | make BUILDROOT=$pkgdir/Package install | |
ef416fc2 | 74 | |
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 | |
78 | else | |
79 | PackageMaker=/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker | |
80 | fi | |
81 | ||
82 | # Create the package... | |
83 | echo Creating MacOS X package... | |
84 | rm -rf cups.pkg | |
85 | echo $PackageMaker -build -v -p cups.pkg \ | |
86 | -f $pkgdir/Package \ | |
87 | -r $pkgdir/Resources \ | |
88 | -d packaging/cups-desc.plist \ | |
89 | -i packaging/cups-info.plist | |
90 | $PackageMaker -build -v -p cups.pkg \ | |
91 | -f $pkgdir/Package \ | |
92 | -r $pkgdir/Resources \ | |
93 | -d packaging/cups-desc.plist \ | |
94 | -i packaging/cups-info.plist | |
95 | ||
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 | |
99 | ||
100 | # Cleanup temp files... | |
101 | echo Removing temporary files... | |
102 | rm -rf $pkgdir |