]> git.ipfire.org Git - thirdparty/cups.git/blame - tools/testosx
Rename "List Available Printers" button to "Find New Printers" (STR #2453)
[thirdparty/cups.git] / tools / testosx
CommitLineData
cfea6818 1#!/bin/sh
2# Make sure we are running in the right directory...
a0145748 3if test ! -f tools/testosx; then
cfea6818 4 echo "Run this script from the top-level CUPS source directory, e.g.:"
5 echo ""
86f7eb8e 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]"
cfea6818 15 echo ""
16 exit 1
17fi
18
00a1fad8 19# Get the current working copy version...
20rev=`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[a-zA-Z]*//g'`
cfea6818 21
b3b3771e 22if test $# = 0; then
0470455a 23 version="1.3svn-r$rev"
b3b3771e 24else
25 version=$1
26fi
27
cfea6818 28# Setup an install directory...
29user=`whoami`
30topdir=`pwd`
2a042370 31pkgdir="/tmp/cups.pkg-$user"
cfea6818 32
33echo Building package using temp directory $pkgdir...
34rm -rf $pkgdir
35mkdir -p $pkgdir/Package
36mkdir -p $pkgdir/Resources
37
cfea6818 38# Install resource files into the Resources directory...
39echo Installing resource files...
2a042370 40cp packaging/LICENSE.rtf $pkgdir/Resources/ReadMe.rtf
20f4db14 41sed -e '1,$s/@CUPS_VERSION@/'$version'/g' \
42 <packaging/WELCOME.rtf >$pkgdir/Resources/Welcome.rtf
2a042370 43cp packaging/installer.tif $pkgdir/Resources/background.tif
3f0f2882 44
fd59c148 45if test -x /bin/launchctl; then
46 cat >$pkgdir/Resources/preflight <<EOF
47#!/bin/sh
fdcdb604 48# Tell launchd to stop cupsd...
86f7eb8e 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
fdcdb604 53killall cupsd || exit 0
fd59c148 54EOF
55else
56 cat >$pkgdir/Resources/preflight <<EOF
3f0f2882 57#!/bin/sh
5db6985b 58# Stop any running cupsd processes...
22271458 59killall cupsd || exit 0
3f0f2882 60EOF
fd59c148 61fi
62
3f0f2882 63chmod 755 $pkgdir/Resources/preflight
64
938dca1f 65if test -x /bin/launchctl; then
66 cat >$pkgdir/Resources/postflight <<EOF
3f0f2882 67#!/bin/sh
938dca1f 68
fd59c148 69# Remove old xinetd config file, we use launchd now...
865ae39d 70rm -f /etc/xinetd.d/cups-lpd
938dca1f 71
72# Tell launchd to reload cupsd...
86f7eb8e 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
938dca1f 77EOF
09a48dfa 78else
938dca1f 79 cat >$pkgdir/Resources/postflight <<EOF
80#!/bin/sh
09a48dfa 81
938dca1f 82# Start cupsd...
83/usr/sbin/cupsd
3f0f2882 84EOF
938dca1f 85fi
86
3f0f2882 87chmod 755 $pkgdir/Resources/postflight
cfea6818 88
86f7eb8e 89case `uname -r` in
90 8.* | 9.*)
91 cp packaging/InstallationCheck $pkgdir/Resources
92 chmod 755 $pkgdir/Resources/InstallationCheck
93 ;;
94esac
95
cfea6818 96# Tag the current revision in the plist and web interface files...
20f4db14 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' \
0470455a 102 -e '1,$s/@CUPS_RELEASE@/1.3.'$rev'/g' \
20f4db14 103 <$file.in >$file
104done
6dc66910 105
106# Install CUPS into the Package directory...
107#make INSTALL=$topdir/install-sh BUILDROOT=$pkgdir/Package install
108make BUILDROOT=$pkgdir/Package install
cfea6818 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...
53d0dd1b 119rm -rf cups.pkg
120echo $PackageMaker -build -v -p cups.pkg \
a0145748 121 -f $pkgdir/Package \
122 -r $pkgdir/Resources \
2a042370 123 -d packaging/cups-desc.plist \
124 -i packaging/cups-info.plist
53d0dd1b 125$PackageMaker -build -v -p cups.pkg \
cfea6818 126 -f $pkgdir/Package \
127 -r $pkgdir/Resources \
2a042370 128 -d packaging/cups-desc.plist \
129 -i packaging/cups-info.plist
cfea6818 130
131# Create a disk image...
132echo Creating MacOS X disk image...
b3b3771e 133hdiutil create -ov -srcfolder cups.pkg cups-$version.dmg
cfea6818 134
135# Cleanup temp files...
136echo Removing temporary files...
3f0f2882 137rm -rf $pkgdir