home *** CD-ROM | disk | FTP | other *** search
- #!/bin/bash -x
- ##########################################################################
- #
- # $RCSfile: preflight,v $
- #
- # $Revision: 1.27 $
- #
- # last change: $Author: pluby $ $Date: 2008/01/26 07:01:18 $
- #
- # The Contents of this file are made available subject to the terms of
- # either of the following licenses
- #
- # - GNU General Public License Version 2.1
- #
- # Patrick Luby, June 2003
- #
- # GNU General Public License Version 2.1
- # =============================================
- # Copyright 2003 Planamesa Inc.
- #
- # This library is free software; you can redistribute it and/or
- # modify it under the terms of the GNU General Public
- # License version 2.1, as published by the Free Software Foundation.
- #
- # This library is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- # General Public License for more details.
- #
- # You should have received a copy of the GNU General Public
- # License along with this library; if not, write to the Free Software
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- # MA 02111-1307 USA
- #
- ##########################################################################
-
- PATH=/bin:/sbin:/usr/bin:/usr/sbin
- export PATH
-
- umask 022
-
- if [ -d "$2" ] ; then
-
- # Fix Apple installer bug described in bug 1373
- if [ "$2" = "/" -o "$2" = "$3" -o `cd "$2" ; pwd` = "/" -o `cd "$2" ; pwd` = "$3" ]; then
- exit 1;
- fi
-
- fi
-
- if [ -d "$2/Contents" ] ; then
-
- # Save dictionary files for postflight scripts
- if [ -d "$2/Contents/share/dict/ooo" -a ! -e "$2/ooo" ]; then
- mv -f "$2/Contents/share/dict/ooo" "$2" || exit 1
- fi
-
- # Save jar files for postflight scripts
- if [ -d "$2/Contents/MacOS/classes" -a ! -e "$2/classes" ]; then
- mv -f "$2/Contents/MacOS/classes" "$2" || exit 1
- fi
-
- # Save font files for postflight scripts
- if [ -d "$2/Contents/share/fonts/truetype" -a ! -e "$2/truetype" ]; then
- mv -f "$2/Contents/share/fonts/truetype" "$2" || exit 1
- fi
-
- scriptdir=`dirname "$0"`
- if [ -d "$scriptdir" -a -f "$scriptdir/installutils" ] ; then
-
- . "$scriptdir/installutils"
-
- if check_installation "$2" ; then
- # Save help files for postflight scripts
- if [ -d "$2/Contents/help" -a ! -e "$2/help" ]; then
- mv -f "$2/Contents/help" "$2" || exit 1
- fi
-
- # Save resource files for postflight scripts
- if [ -d "$2/Contents/MacOS/resource" -a ! -e "$2/resource" ]; then
- mv -f "$2/Contents/MacOS/resource" "$2" || exit 1
- fi
-
- # Save localization files
- if [ -d "$2/Contents/share" -a ! -e "$2/share" ]; then
- mv -f "$2/Contents/share" "$2" || exit 1
- fi
- else
- if [ -e "$2/help" ]; then
- rm -Rf "$2/help" || exit 1
- fi
-
- if [ -e "$2/resource" ]; then
- rm -Rf "$2/resource" || exit 1
- fi
-
- if [ -e "$2/share" ]; then
- rm -Rf "$2/share" || exit 1
- fi
- fi
-
- fi
-
- rm -Rf "$2/Contents" || exit 1
-
- fi
-
- exit 0
-