Load cups into easysw/current.
[thirdparty/cups.git] / tools / testosx
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
11 # Update the current working copy...
12 svn up
13 rev=`svnversion . | sed -e '1,$s/[a-zA-Z]//g'`
14
15 # Make everything...
16 make all
17
18 # Setup an install directory...
19 user=`whoami`
20 topdir=`pwd`
21 pkgdir="/tmp/cups.pkg-$user"
22
23 echo Building package using temp directory $pkgdir...
24 rm -rf $pkgdir
25 mkdir -p $pkgdir/Package
26 mkdir -p $pkgdir/Resources
27
28 # Install CUPS into the Package directory...
29 #make INSTALL=$topdir/install-sh BUILDROOT=$pkgdir/Package install
30 make BUILDROOT=$pkgdir/Package install
31
32 # Install resource files into the Resources directory...
33 echo Installing resource files...
34 cp packaging/LICENSE.rtf $pkgdir/Resources/ReadMe.rtf
35 cp packaging/WELCOME.rtf $pkgdir/Resources/Welcome.rtf
36 cp packaging/installer.tif $pkgdir/Resources/background.tif
37
38 cat >$pkgdir/Resources/preflight <<EOF
39 #!/bin/sh
40 killall cupsd || exit 0
41 EOF
42 chmod 755 $pkgdir/Resources/preflight
43
44 cat >$pkgdir/Resources/postflight <<EOF
45 #!/bin/sh
46 /usr/sbin/cupsd
47 EOF
48 chmod 755 $pkgdir/Resources/postflight
49
50 # Tag the current revision in the plist and web interface files...
51 sed -e '1,$s/@CUPS_VERSION@/1.2svn-r'$rev'/g' \
52         -e '1,$s/@CUPS_RELEASE@/1.2.'$rev'/g' \
53         <packaging/cups-desc.plist.in >packaging/cups-desc.plist
54 sed -e '1,$s/@CUPS_VERSION@/1.2svn-r'$rev'/g' \
55         -e '1,$s/@CUPS_RELEASE@/1.2.'$rev'/g' \
56         <packaging/cups-info.plist.in >packaging/cups-info.plist
57 sed -e '1,$s/@CUPS_VERSION@/1.2svn-r'$rev'/g' \
58         <doc/index.html.in >doc/index.html
59
60 # Figure out where PackageMaker is installled...
61 if test -d /Developer/Applications/Utilities/PackageMaker.app; then
62         PackageMaker=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
63 else
64         PackageMaker=/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
65 fi
66
67 # Create the package...
68 echo Creating MacOS X package...
69 rm -rf cups.pkg
70 echo $PackageMaker -build -v -p cups.pkg \
71         -f $pkgdir/Package \
72         -r $pkgdir/Resources \
73         -d packaging/cups-desc.plist \
74         -i packaging/cups-info.plist
75 $PackageMaker -build -v -p cups.pkg \
76         -f $pkgdir/Package \
77         -r $pkgdir/Resources \
78         -d packaging/cups-desc.plist \
79         -i packaging/cups-info.plist
80
81 # Create a disk image...
82 echo Creating MacOS X disk image...
83 hdiutil create -ov -srcfolder cups.pkg cups-1.2svn-r$rev.dmg
84
85 # Cleanup temp files...
86 echo Removing temporary files...
87 rm -rf $pkgdir