1# *************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20# *************************************************************
21
22%preinstall << END
23END
24
25%postinstall << END
26
27# echo Command after installing
28# searching for the PRODUCTINSTALLLOCATION for the different platforms
29platform=`uname -s`
30case $$platform in
31SunOS)
32  BASISPACKAGE=openofficeorg-core01
33  BASISDIR=`pkginfo -r $$BASISPACKAGE`
34  PRODUCTINSTALLLOCATION="$$BASEDIR"
35  ;;
36Linux)
37  BASISPACKAGE=openoffice.org-core01
38  BASISDIR=`rpm -q --queryformat "%{INSTALLPREFIX}" $$BASISPACKAGE`
39  PRODUCTINSTALLLOCATION="$$RPM_INSTALL_PREFIX"
40  ;;
41*)
42  PRODUCTINSTALLLOCATION="$$BASEDIR"
43  ;;
44esac
45
46# creating link to basis layer
47if [ -d $$BASISDIR/openoffice.org/basisBASISDIRECTORYVERSION ]
48then
49      ln -s $$BASISDIR/openoffice.org/basisBASISDIRECTORYVERSION $$PRODUCTINSTALLLOCATION/PRODUCTDIRECTORYNAME/basis-link >/dev/null 2>&1
50else
51      ln -s ../openoffice.org/basisBASISDIRECTORYVERSION $$PRODUCTINSTALLLOCATION/PRODUCTDIRECTORYNAME/basis-link >/dev/null 2>&1
52fi
53
54exit 0
55END
56
57%preremove << END
58END
59
60%postremove << END
61# echo Command after removing
62
63LASTUNINSTALL=1	# important for RPM deinstallation
64
65# searching for the PRODUCTINSTALLLOCATION for the different platforms
66platform=`uname -s`
67case $$platform in
68SunOS)
69  PRODUCTINSTALLLOCATION="$$BASEDIR"
70  ;;
71Linux)
72  PRODUCTINSTALLLOCATION="$$RPM_INSTALL_PREFIX"
73  if [ "$$1" = 1 ]	# one package left after deinstallation -> update
74  then
75    LASTUNINSTALL=0
76  fi
77  ;;
78*)
79  PRODUCTINSTALLLOCATION="$$BASEDIR"
80  ;;
81esac
82
83if [ -h $$PRODUCTINSTALLLOCATION/PRODUCTDIRECTORYNAME/basis-link -a $$LASTUNINSTALL -eq 1 ]
84then
85  rm -f $$PRODUCTINSTALLLOCATION/PRODUCTDIRECTORYNAME/basis-link 2>/dev/null
86  rmdir $$PRODUCTINSTALLLOCATION/PRODUCTDIRECTORYNAME 2>/dev/null
87fi
88
89exit 0
90END
91