DRC | 4578953 | 2013-04-24 23:39:37 +0000 | [diff] [blame] | 1 | # Copyright (C)2009-2011, 2013 D. R. Commander. All Rights Reserved. |
DRC | 7f73d9b | 2011-05-25 03:51:29 +0000 | [diff] [blame] | 2 | # |
| 3 | # Redistribution and use in source and binary forms, with or without |
| 4 | # modification, are permitted provided that the following conditions are met: |
| 5 | # |
| 6 | # - Redistributions of source code must retain the above copyright notice, |
| 7 | # this list of conditions and the following disclaimer. |
| 8 | # - Redistributions in binary form must reproduce the above copyright notice, |
| 9 | # this list of conditions and the following disclaimer in the documentation |
| 10 | # and/or other materials provided with the distribution. |
| 11 | # - Neither the name of the libjpeg-turbo Project nor the names of its |
| 12 | # contributors may be used to endorse or promote products derived from this |
| 13 | # software without specific prior written permission. |
| 14 | # |
| 15 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", |
| 16 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 17 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 18 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE |
| 19 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 20 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 21 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 22 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 23 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 24 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 25 | # POSSIBILITY OF SUCH DAMAGE. |
DRC | 6533b6e | 2010-02-15 14:57:18 +0000 | [diff] [blame] | 26 | |
| 27 | #!/bin/sh |
| 28 | |
DRC | 6533b6e | 2010-02-15 14:57:18 +0000 | [diff] [blame] | 29 | if [ ! "`id -u`" = "0" ]; then |
DRC | 81f5f7c | 2011-05-24 13:59:14 +0000 | [diff] [blame] | 30 | echo "ERROR: This script must be executed as root" |
| 31 | exit -1 |
DRC | 6533b6e | 2010-02-15 14:57:18 +0000 | [diff] [blame] | 32 | fi |
| 33 | |
DRC | 4578953 | 2013-04-24 23:39:37 +0000 | [diff] [blame] | 34 | PACKAGE=@PKGNAME@ |
DRC | 81f5f7c | 2011-05-24 13:59:14 +0000 | [diff] [blame] | 35 | MACPACKAGE=com.$PACKAGE.$PACKAGE |
| 36 | RECEIPT=/Library/Receipts/$PACKAGE.pkg |
DRC | 6533b6e | 2010-02-15 14:57:18 +0000 | [diff] [blame] | 37 | |
| 38 | LSBOM= |
DRC | 81f5f7c | 2011-05-24 13:59:14 +0000 | [diff] [blame] | 39 | if [ -d $RECEIPT ]; then |
| 40 | LSBOM='lsbom -s -f -l '$RECEIPT'/Contents/Archive.bom' |
DRC | 6533b6e | 2010-02-15 14:57:18 +0000 | [diff] [blame] | 41 | else |
DRC | 81f5f7c | 2011-05-24 13:59:14 +0000 | [diff] [blame] | 42 | LSBOM='pkgutil --files '$MACPACKAGE |
DRC | 6533b6e | 2010-02-15 14:57:18 +0000 | [diff] [blame] | 43 | fi |
| 44 | |
DRC | 7f73d9b | 2011-05-25 03:51:29 +0000 | [diff] [blame] | 45 | mylsbom() |
| 46 | { |
| 47 | $LSBOM || (echo "ERROR: Could not list package contents"; exit -1) |
| 48 | } |
| 49 | |
DRC | 81f5f7c | 2011-05-24 13:59:14 +0000 | [diff] [blame] | 50 | echo Removing package files ... |
| 51 | EXITSTATUS=0 |
| 52 | pushd / |
DRC | 7f73d9b | 2011-05-25 03:51:29 +0000 | [diff] [blame] | 53 | mylsbom | while read file; do |
DRC | 81f5f7c | 2011-05-24 13:59:14 +0000 | [diff] [blame] | 54 | if [ ! -d "$file" ]; then rm "$file" 2>&1 || EXITSTATUS=-1; fi |
DRC | 6533b6e | 2010-02-15 14:57:18 +0000 | [diff] [blame] | 55 | done |
DRC | 81f5f7c | 2011-05-24 13:59:14 +0000 | [diff] [blame] | 56 | popd |
DRC | 6533b6e | 2010-02-15 14:57:18 +0000 | [diff] [blame] | 57 | |
DRC | 81f5f7c | 2011-05-24 13:59:14 +0000 | [diff] [blame] | 58 | echo Removing package directories ... |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 59 | PREFIX=%{__prefix} |
| 60 | BINDIR=%{__bindir} |
| 61 | DATADIR=%{__datadir} |
| 62 | INCLUDEDIR=%{__includedir} |
| 63 | LIBDIR=%{__libdir} |
| 64 | MANDIR=%{__mandir} |
| 65 | |
| 66 | if [ -d $BINDIR ]; then |
| 67 | rmdir $BINDIR 2>&1 || EXITSTATUS=-1 |
DRC | 995c831 | 2010-06-05 01:20:35 +0000 | [diff] [blame] | 68 | fi |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 69 | if [ -d $LIBDIR ]; then |
| 70 | rmdir $LIBDIR 2>&1 || EXITSTATUS=-1 |
DRC | 6533b6e | 2010-02-15 14:57:18 +0000 | [diff] [blame] | 71 | fi |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 72 | if [ -d $INCLUDEDIR ]; then |
| 73 | rmdir $INCLUDEDIR 2>&1 || EXITSTATUS=-1 |
DRC | 6533b6e | 2010-02-15 14:57:18 +0000 | [diff] [blame] | 74 | fi |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 75 | if [ "$PREFIX" = "/opt/libjpeg-turbo" -a "$LIBDIR" = "/opt/libjpeg-turbo/lib" ]; then |
| 76 | if [ -h $LIBDIR\32 ]; then |
| 77 | rm $LIBDIR\32 2>&1 || EXITSTATUS=-1 |
| 78 | fi |
| 79 | if [ -h $LIBDIR\64 ]; then |
| 80 | rm $LIBDIR\64 2>&1 || EXITSTATUS=-1 |
| 81 | fi |
DRC | 995c831 | 2010-06-05 01:20:35 +0000 | [diff] [blame] | 82 | fi |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 83 | if [ -d $MANDIR/man1 ]; then |
| 84 | rmdir $MANDIR/man1 2>&1 || EXITSTATUS=-1 |
DRC | 995c831 | 2010-06-05 01:20:35 +0000 | [diff] [blame] | 85 | fi |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 86 | if [ -d $MANDIR ]; then |
| 87 | rmdir $MANDIR 2>&1 || EXITSTATUS=-1 |
DRC | f2602ce | 2011-04-01 00:20:33 +0000 | [diff] [blame] | 88 | fi |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 89 | if [ -d $DATADIR/classes ]; then |
| 90 | rmdir $DATADIR/classes 2>&1 || EXITSTATUS=-1 |
| 91 | fi |
| 92 | if [ -d $DATADIR -a "$DATADIR" != "$PREFIX" ]; then |
| 93 | rmdir $DATADIR 2>&1 || EXITSTATUS=-1 |
| 94 | fi |
| 95 | if [ "$PREFIX" = "/opt/libjpeg-turbo" -a -h "$PREFIX/doc" ]; then |
| 96 | rm $PREFIX/doc 2>&1 || EXITSTATUS=-1 |
| 97 | fi |
| 98 | rmdir $PREFIX 2>&1 || EXITSTATUS=-1 |
DRC | 81f5f7c | 2011-05-24 13:59:14 +0000 | [diff] [blame] | 99 | rmdir /Library/Documentation/$PACKAGE 2>&1 || EXITSTATUS=-1 |
DRC | 6533b6e | 2010-02-15 14:57:18 +0000 | [diff] [blame] | 100 | |
DRC | 81f5f7c | 2011-05-24 13:59:14 +0000 | [diff] [blame] | 101 | if [ -d $RECEIPT ]; then |
| 102 | echo Removing package receipt ... |
| 103 | rm -r $RECEIPT 2>&1 || EXITSTATUS=-1 |
DRC | 6533b6e | 2010-02-15 14:57:18 +0000 | [diff] [blame] | 104 | else |
DRC | 81f5f7c | 2011-05-24 13:59:14 +0000 | [diff] [blame] | 105 | echo Forgetting package $MACPACKAGE ... |
| 106 | pkgutil --forget $MACPACKAGE |
DRC | 6533b6e | 2010-02-15 14:57:18 +0000 | [diff] [blame] | 107 | fi |
| 108 | |
DRC | 81f5f7c | 2011-05-24 13:59:14 +0000 | [diff] [blame] | 109 | exit $EXITSTATUS |