blob: 490a71e40d8cee4b7fd32d72ba8d2e5c2c44d9ec [file] [log] [blame]
DRC4666c502011-04-29 22:57:27 +00001# Copyright (C)2009-2011 D. R. Commander
DRCee229f42010-04-12 00:25:14 +00002# Copyright (C)2009 Sun Microsystems, Inc.
3#
4# This library is free software and may be redistributed and/or modified under
5# the terms of the wxWindows Library License, Version 3.1 or (at your option)
6# any later version. The full license is in the LICENSE.txt file included
7# with this distribution.
8#
9# This library is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# wxWindows Library License for more details.
13
14#!/bin/sh
15
16error()
17{
18 echo $1
19 exit -1
20}
21
22if [ ! "`id -u`" = "0" ]; then
23 error "This command must be run as root"
24fi
25
26PKGNAME={__APPNAME}
DRC4666c502011-04-29 22:57:27 +000027MACPKGNAME=com.tigervnc.tigervnc
DRCee229f42010-04-12 00:25:14 +000028RCPT=/Library/Receipts/$PKGNAME.pkg
29
30LSBOM=
31if [ -d $RCPT ]; then
32 LSBOM='lsbom -s -f -l '$RCPT'/Contents/Archive.bom'
33else
34 LSBOM='pkgutil --files '$MACPKGNAME
35fi
36
37echo Removing files ...
38$LSBOM >/dev/null || error "Could not list package contents"
39RETCODE=0
40PWD=`pwd`
41cd /
42$LSBOM | while read line; do
43 if [ ! -d "$line" ]; then rm "$line" 2>&1 || RETCODE=-1; fi
44done
45cd $PWD
46
47echo Removing directories ...
48rmdir /opt/$PKGNAME/bin 2>&1 || RETCODE=-1
DRC6452add2010-07-08 07:12:38 +000049rmdir /opt/$PKGNAME/man/man1 2>&1 || RETCODE=-1
50rmdir /opt/$PKGNAME/man 2>&1 || RETCODE=-1
DRCee229f42010-04-12 00:25:14 +000051rmdir /opt/$PKGNAME 2>&1 || RETCODE=-1
52rmdir /Library/Documentation/$PKGNAME 2>&1 || RETCODE=-1
53
54if [ -d $RCPT ]; then
55 echo Removing package receipt $RCPT ...
56 rm -r $RCPT 2>&1 || RETCODE=-1
57else
58 echo Forgetting package $MACPKGNAME
59 pkgutil --forget $MACPKGNAME
60fi
61
62exit $RETCODE