DRC | 4666c50 | 2011-04-29 22:57:27 +0000 | [diff] [blame] | 1 | # Copyright (C)2009-2011 D. R. Commander |
DRC | ee229f4 | 2010-04-12 00:25:14 +0000 | [diff] [blame] | 2 | # 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 | |
| 16 | error() |
| 17 | { |
| 18 | echo $1 |
| 19 | exit -1 |
| 20 | } |
| 21 | |
| 22 | if [ ! "`id -u`" = "0" ]; then |
| 23 | error "This command must be run as root" |
| 24 | fi |
| 25 | |
| 26 | PKGNAME={__APPNAME} |
DRC | 4666c50 | 2011-04-29 22:57:27 +0000 | [diff] [blame] | 27 | MACPKGNAME=com.tigervnc.tigervnc |
DRC | ee229f4 | 2010-04-12 00:25:14 +0000 | [diff] [blame] | 28 | RCPT=/Library/Receipts/$PKGNAME.pkg |
| 29 | |
| 30 | LSBOM= |
| 31 | if [ -d $RCPT ]; then |
| 32 | LSBOM='lsbom -s -f -l '$RCPT'/Contents/Archive.bom' |
| 33 | else |
| 34 | LSBOM='pkgutil --files '$MACPKGNAME |
| 35 | fi |
| 36 | |
| 37 | echo Removing files ... |
| 38 | $LSBOM >/dev/null || error "Could not list package contents" |
| 39 | RETCODE=0 |
| 40 | PWD=`pwd` |
| 41 | cd / |
| 42 | $LSBOM | while read line; do |
| 43 | if [ ! -d "$line" ]; then rm "$line" 2>&1 || RETCODE=-1; fi |
| 44 | done |
| 45 | cd $PWD |
| 46 | |
| 47 | echo Removing directories ... |
| 48 | rmdir /opt/$PKGNAME/bin 2>&1 || RETCODE=-1 |
DRC | 6452add | 2010-07-08 07:12:38 +0000 | [diff] [blame] | 49 | rmdir /opt/$PKGNAME/man/man1 2>&1 || RETCODE=-1 |
| 50 | rmdir /opt/$PKGNAME/man 2>&1 || RETCODE=-1 |
DRC | ee229f4 | 2010-04-12 00:25:14 +0000 | [diff] [blame] | 51 | rmdir /opt/$PKGNAME 2>&1 || RETCODE=-1 |
| 52 | rmdir /Library/Documentation/$PKGNAME 2>&1 || RETCODE=-1 |
| 53 | |
| 54 | if [ -d $RCPT ]; then |
| 55 | echo Removing package receipt $RCPT ... |
| 56 | rm -r $RCPT 2>&1 || RETCODE=-1 |
| 57 | else |
| 58 | echo Forgetting package $MACPKGNAME |
| 59 | pkgutil --forget $MACPKGNAME |
| 60 | fi |
| 61 | |
| 62 | exit $RETCODE |