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  UREPACKAGE=SOLSUREPACKAGEPREFIX-ure
33  UREDIR=`pkginfo -r $$UREPACKAGE`
34  PRODUCTINSTALLLOCATION="$$BASEDIR"
35  ;;
36Linux)
37  UREPACKAGE=UREPACKAGEPREFIX-ure
38  UREDIR=`rpm -q --queryformat "%{INSTALLPREFIX}" $$UREPACKAGE`
39  PRODUCTINSTALLLOCATION="$$RPM_INSTALL_PREFIX"
40  ;;
41*)
42  PRODUCTINSTALLLOCATION="$$BASEDIR"
43  ;;
44esac
45
46# creating link to ure
47if [ -d $$UREDIR/openoffice/ure ]
48then
49      ln -s $$UREDIR/openoffice/ure $$PRODUCTINSTALLLOCATION/openoffice/basisBASISDIRECTORYVERSION/ure-link >/dev/null 2>&1
50else
51      ln -s ../ure $$PRODUCTINSTALLLOCATION/openoffice/basisBASISDIRECTORYVERSION/ure-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/openoffice/basisBASISDIRECTORYVERSION/ure-link -a $$LASTUNINSTALL -eq 1 ]
84then
85  rm -f $$PRODUCTINSTALLLOCATION/openoffice/basisBASISDIRECTORYVERSION/ure-link 2>/dev/null
86  rmdir $$PRODUCTINSTALLLOCATION/openoffice/basisBASISDIRECTORYVERSION 2>/dev/null
87  rmdir $$PRODUCTINSTALLLOCATION/openoffice 2>/dev/null
88fi
89
90exit 0
91END
92