]> git.ipfire.org Git - thirdparty/cups.git/blob - tools/testosx
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 # Get the current working copy version...
12 rev=`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[a-zA-Z]*//g'`
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
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
32 # Stop any running cupsd processes...
33 killall cupsd || exit 0
34 EOF
35 chmod 755 $pkgdir/Resources/preflight
36
37 if test -x /bin/launchctl; then
38 cat >$pkgdir/Resources/postflight <<EOF
39 #!/bin/sh
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...
45 launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist || exit 0
46 launchctl load /System/Library/LaunchDaemons/org.cups.cupsd.plist
47 EOF
48 else
49 cat >$pkgdir/Resources/postflight <<EOF
50 #!/bin/sh
51
52 # Start cupsd...
53 /usr/sbin/cupsd
54 EOF
55 fi
56
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
67 # Install CUPS into the Package directory...
68 #make INSTALL=$topdir/install-sh BUILDROOT=$pkgdir/Package install
69 make BUILDROOT=$pkgdir/Package install
70
71 # Figure out where PackageMaker is installled...
72 if test -d /Developer/Applications/Utilities/PackageMaker.app; then
73 PackageMaker=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
74 else
75 PackageMaker=/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
76 fi
77
78 # Create the package...
79 echo Creating MacOS X package...
80 rm -rf cups.pkg
81 echo $PackageMaker -build -v -p cups.pkg \
82 -f $pkgdir/Package \
83 -r $pkgdir/Resources \
84 -d packaging/cups-desc.plist \
85 -i packaging/cups-info.plist
86 $PackageMaker -build -v -p cups.pkg \
87 -f $pkgdir/Package \
88 -r $pkgdir/Resources \
89 -d packaging/cups-desc.plist \
90 -i packaging/cups-info.plist
91
92 # Create a disk image...
93 echo Creating MacOS X disk image...
94 hdiutil create -ov -srcfolder cups.pkg cups-1.2svn-r$rev.dmg
95
96 # Cleanup temp files...
97 echo Removing temporary files...
98 rm -rf $pkgdir