]> git.ipfire.org Git - thirdparty/cups.git/blame - tools/testosx
Load cups into easysw/current.
[thirdparty/cups.git] / tools / testosx
CommitLineData
ef416fc2 1#!/bin/sh
2# Make sure we are running in the right directory...
3if 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
9fi
10
11if 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
17fi
18
a4d04587 19# Get the current working copy version...
20rev=`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[a-zA-Z]*//g'`
ef416fc2 21
757d2cad 22if test $# = 0; then
f7deaa1a 23 version="1.3svn-r$rev"
757d2cad 24else
25 version=$1
26fi
27
ef416fc2 28# Setup an install directory...
29user=`whoami`
30topdir=`pwd`
31pkgdir="/tmp/cups.pkg-$user"
32
33echo Building package using temp directory $pkgdir...
34rm -rf $pkgdir
35mkdir -p $pkgdir/Package
36mkdir -p $pkgdir/Resources
37
ef416fc2 38# Install resource files into the Resources directory...
39echo Installing resource files...
40cp packaging/LICENSE.rtf $pkgdir/Resources/ReadMe.rtf
e1d6a774 41sed -e '1,$s/@CUPS_VERSION@/'$version'/g' \
42 <packaging/WELCOME.rtf >$pkgdir/Resources/Welcome.rtf
ef416fc2 43cp packaging/installer.tif $pkgdir/Resources/background.tif
44
3d8365b8 45if test -x /bin/launchctl; then
46 cat >$pkgdir/Resources/preflight <<EOF
47#!/bin/sh
bc44d920 48# Tell launchd to stop cupsd...
49if 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
52fi
53killall cupsd || exit 0
3d8365b8 54EOF
55else
56 cat >$pkgdir/Resources/preflight <<EOF
ef416fc2 57#!/bin/sh
a4d04587 58# Stop any running cupsd processes...
ef416fc2 59killall cupsd || exit 0
60EOF
3d8365b8 61fi
62
ef416fc2 63chmod 755 $pkgdir/Resources/preflight
64
e00b005a 65if 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 70rm -f /etc/xinetd.d/cups-lpd
e00b005a 71
72# Tell launchd to reload cupsd...
bc44d920 73if 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
76fi
ef416fc2 77EOF
e00b005a 78else
79 cat >$pkgdir/Resources/postflight <<EOF
80#!/bin/sh
81
82# Start cupsd...
83/usr/sbin/cupsd
84EOF
85fi
86
ef416fc2 87chmod 755 $pkgdir/Resources/postflight
88
bc44d920 89case `uname -r` in
90 8.* | 9.*)
91 cp packaging/InstallationCheck $pkgdir/Resources
92 chmod 755 $pkgdir/Resources/InstallationCheck
93 ;;
94esac
95
ef416fc2 96# Tag the current revision in the plist and web interface files...
e1d6a774 97for 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
104done
09ec0018 105
106# Install CUPS into the Package directory...
107#make INSTALL=$topdir/install-sh BUILDROOT=$pkgdir/Package install
108make BUILDROOT=$pkgdir/Package install
ef416fc2 109
110# Figure out where PackageMaker is installled...
111if test -d /Developer/Applications/Utilities/PackageMaker.app; then
112 PackageMaker=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
113else
114 PackageMaker=/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
115fi
116
117# Create the package...
118echo Creating MacOS X package...
119rm -rf cups.pkg
120echo $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...
132echo Creating MacOS X disk image...
757d2cad 133hdiutil create -ov -srcfolder cups.pkg cups-$version.dmg
ef416fc2 134
135# Cleanup temp files...
136echo Removing temporary files...
137rm -rf $pkgdir