]>
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 "" | |
bc44d920 | 6 | echo " sudo tools/testosx [version]" |
7 | echo "" | |
8 | exit 1 | |
9 | fi | |
10 | ||
11 | if test `whoami` != root; then | |
12 | echo "Run this script with sudo, e.g.:" | |
13 | echo "" | |
14 | echo " sudo tools/testosx [version]" | |
ef416fc2 | 15 | echo "" |
16 | exit 1 | |
17 | fi | |
18 | ||
a4d04587 | 19 | # Get the current working copy version... |
20 | rev=`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[a-zA-Z]*//g'` | |
ef416fc2 | 21 | |
757d2cad | 22 | if test $# = 0; then |
f7deaa1a | 23 | version="1.3svn-r$rev" |
757d2cad | 24 | else |
25 | version=$1 | |
26 | fi | |
27 | ||
ef416fc2 | 28 | # Setup an install directory... |
29 | user=`whoami` | |
30 | topdir=`pwd` | |
31 | pkgdir="/tmp/cups.pkg-$user" | |
32 | ||
33 | echo Building package using temp directory $pkgdir... | |
34 | rm -rf $pkgdir | |
35 | mkdir -p $pkgdir/Package | |
36 | mkdir -p $pkgdir/Resources | |
37 | ||
ef416fc2 | 38 | # Install resource files into the Resources directory... |
39 | echo Installing resource files... | |
40 | cp packaging/LICENSE.rtf $pkgdir/Resources/ReadMe.rtf | |
e1d6a774 | 41 | sed -e '1,$s/@CUPS_VERSION@/'$version'/g' \ |
42 | <packaging/WELCOME.rtf >$pkgdir/Resources/Welcome.rtf | |
ef416fc2 | 43 | cp packaging/installer.tif $pkgdir/Resources/background.tif |
44 | ||
3d8365b8 | 45 | if test -x /bin/launchctl; then |
46 | cat >$pkgdir/Resources/preflight <<EOF | |
47 | #!/bin/sh | |
bc44d920 | 48 | # Tell launchd to stop cupsd... |
49 | if test "x`whoami`" = xroot; then | |
50 | sudo launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist || exit 0 | |
51 | sudo launchctl unload /System/Library/LaunchDaemons/org.cups.cups-lpd.plist || exit 0 | |
52 | fi | |
53 | killall cupsd || exit 0 | |
3d8365b8 | 54 | EOF |
55 | else | |
56 | cat >$pkgdir/Resources/preflight <<EOF | |
ef416fc2 | 57 | #!/bin/sh |
a4d04587 | 58 | # Stop any running cupsd processes... |
ef416fc2 | 59 | killall cupsd || exit 0 |
60 | EOF | |
3d8365b8 | 61 | fi |
62 | ||
ef416fc2 | 63 | chmod 755 $pkgdir/Resources/preflight |
64 | ||
e00b005a | 65 | if test -x /bin/launchctl; then |
66 | cat >$pkgdir/Resources/postflight <<EOF | |
ef416fc2 | 67 | #!/bin/sh |
e00b005a | 68 | |
3d8365b8 | 69 | # Remove old xinetd config file, we use launchd now... |
d09495fa | 70 | rm -f /etc/xinetd.d/cups-lpd |
e00b005a | 71 | |
72 | # Tell launchd to reload cupsd... | |
bc44d920 | 73 | if test "x`whoami`" = xroot; then |
74 | sudo launchctl load /System/Library/LaunchDaemons/org.cups.cupsd.plist | |
75 | sudo launchctl load /System/Library/LaunchDaemons/org.cups.cupsd-lpd.plist || exit 0 | |
76 | fi | |
ef416fc2 | 77 | EOF |
e00b005a | 78 | else |
79 | cat >$pkgdir/Resources/postflight <<EOF | |
80 | #!/bin/sh | |
81 | ||
82 | # Start cupsd... | |
83 | /usr/sbin/cupsd | |
84 | EOF | |
85 | fi | |
86 | ||
ef416fc2 | 87 | chmod 755 $pkgdir/Resources/postflight |
88 | ||
bc44d920 | 89 | case `uname -r` in |
90 | 8.* | 9.*) | |
91 | cp packaging/InstallationCheck $pkgdir/Resources | |
92 | chmod 755 $pkgdir/Resources/InstallationCheck | |
93 | ;; | |
94 | esac | |
95 | ||
ef416fc2 | 96 | # Tag the current revision in the plist and web interface files... |
e1d6a774 | 97 | for file in packaging/cups-desc.plist packaging/cups-info.plist \ |
98 | doc/index.html doc/ja/index.html templates/header.tmpl; do | |
99 | echo Updating $file... | |
100 | sed -e '1,$s/@CUPS_VERSION@/'$version'/g' \ | |
101 | -e '1,$s/@CUPS_REVISION@//g' \ | |
f7deaa1a | 102 | -e '1,$s/@CUPS_RELEASE@/1.3.'$rev'/g' \ |
e1d6a774 | 103 | <$file.in >$file |
104 | done | |
09ec0018 | 105 | |
106 | # Install CUPS into the Package directory... | |
107 | #make INSTALL=$topdir/install-sh BUILDROOT=$pkgdir/Package install | |
108 | make BUILDROOT=$pkgdir/Package install | |
ef416fc2 | 109 | |
110 | # Figure out where PackageMaker is installled... | |
111 | if test -d /Developer/Applications/Utilities/PackageMaker.app; then | |
112 | PackageMaker=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker | |
113 | else | |
114 | PackageMaker=/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker | |
115 | fi | |
116 | ||
117 | # Create the package... | |
118 | echo Creating MacOS X package... | |
119 | rm -rf cups.pkg | |
120 | echo $PackageMaker -build -v -p cups.pkg \ | |
121 | -f $pkgdir/Package \ | |
122 | -r $pkgdir/Resources \ | |
123 | -d packaging/cups-desc.plist \ | |
124 | -i packaging/cups-info.plist | |
125 | $PackageMaker -build -v -p cups.pkg \ | |
126 | -f $pkgdir/Package \ | |
127 | -r $pkgdir/Resources \ | |
128 | -d packaging/cups-desc.plist \ | |
129 | -i packaging/cups-info.plist | |
130 | ||
131 | # Create a disk image... | |
132 | echo Creating MacOS X disk image... | |
757d2cad | 133 | hdiutil create -ov -srcfolder cups.pkg cups-$version.dmg |
ef416fc2 | 134 | |
135 | # Cleanup temp files... | |
136 | echo Removing temporary files... | |
137 | rm -rf $pkgdir |