1184e05d2SAndrew Rist# *************************************************************
2184e05d2SAndrew Rist#
3184e05d2SAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
4184e05d2SAndrew Rist#  or more contributor license agreements.  See the NOTICE file
5184e05d2SAndrew Rist#  distributed with this work for additional information
6184e05d2SAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
7184e05d2SAndrew Rist#  to you under the Apache License, Version 2.0 (the
8184e05d2SAndrew Rist#  "License"); you may not use this file except in compliance
9184e05d2SAndrew Rist#  with the License.  You may obtain a copy of the License at
10184e05d2SAndrew Rist#
11184e05d2SAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
12184e05d2SAndrew Rist#
13184e05d2SAndrew Rist#  Unless required by applicable law or agreed to in writing,
14184e05d2SAndrew Rist#  software distributed under the License is distributed on an
15184e05d2SAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16184e05d2SAndrew Rist#  KIND, either express or implied.  See the License for the
17184e05d2SAndrew Rist#  specific language governing permissions and limitations
18184e05d2SAndrew Rist#  under the License.
19184e05d2SAndrew Rist#
20184e05d2SAndrew Rist# *************************************************************
21184e05d2SAndrew Rist
22cdf0e10cSrcweir%preinstall << END
23cdf0e10cSrcweirEND
24cdf0e10cSrcweir
25cdf0e10cSrcweir%postinstall << END
26cdf0e10cSrcweir
27cdf0e10cSrcweir# echo Command after installing
28cdf0e10cSrcweir# searching for the PRODUCTINSTALLLOCATION for the different platforms
29cdf0e10cSrcweirplatform=`uname -s`
30cdf0e10cSrcweircase $$platform in
31cdf0e10cSrcweirSunOS)
32ff3f4ebcSOliver-Rainer Wittmann  BASISPACKAGE=apacheopenoffice-core01
33cdf0e10cSrcweir  BASISDIR=`pkginfo -r $$BASISPACKAGE`
34cdf0e10cSrcweir  PRODUCTINSTALLLOCATION="$$BASEDIR"
35cdf0e10cSrcweir  ;;
36cdf0e10cSrcweirLinux)
37ff3f4ebcSOliver-Rainer Wittmann  BASISPACKAGE=apacheopenoffice-core01
38cdf0e10cSrcweir  BASISDIR=`rpm -q --queryformat "%{INSTALLPREFIX}" $$BASISPACKAGE`
39cdf0e10cSrcweir  PRODUCTINSTALLLOCATION="$$RPM_INSTALL_PREFIX"
40cdf0e10cSrcweir  ;;
41cdf0e10cSrcweir*)
42cdf0e10cSrcweir  PRODUCTINSTALLLOCATION="$$BASEDIR"
43cdf0e10cSrcweir  ;;
44cdf0e10cSrcweiresac
45cdf0e10cSrcweir
46cdf0e10cSrcweir# creating link to basis layer
47*599cc5b4SOliver-Rainer Wittmannif [ -d $$BASISDIR/openoffice/basisBASISDIRECTORYVERSION ]
48cdf0e10cSrcweirthen
49*599cc5b4SOliver-Rainer Wittmann      ln -s $$BASISDIR/openoffice/basisBASISDIRECTORYVERSION $$PRODUCTINSTALLLOCATION/PRODUCTDIRECTORYNAME/basis-link >/dev/null 2>&1
50cdf0e10cSrcweirelse
51*599cc5b4SOliver-Rainer Wittmann      ln -s ../openoffice/basisBASISDIRECTORYVERSION $$PRODUCTINSTALLLOCATION/PRODUCTDIRECTORYNAME/basis-link >/dev/null 2>&1
52cdf0e10cSrcweirfi
53cdf0e10cSrcweir
54cdf0e10cSrcweirexit 0
55cdf0e10cSrcweirEND
56cdf0e10cSrcweir
57cdf0e10cSrcweir%preremove << END
58cdf0e10cSrcweirEND
59cdf0e10cSrcweir
60cdf0e10cSrcweir%postremove << END
61cdf0e10cSrcweir# echo Command after removing
62cdf0e10cSrcweir
63cdf0e10cSrcweirLASTUNINSTALL=1	# important for RPM deinstallation
64cdf0e10cSrcweir
65cdf0e10cSrcweir# searching for the PRODUCTINSTALLLOCATION for the different platforms
66cdf0e10cSrcweirplatform=`uname -s`
67cdf0e10cSrcweircase $$platform in
68cdf0e10cSrcweirSunOS)
69cdf0e10cSrcweir  PRODUCTINSTALLLOCATION="$$BASEDIR"
70cdf0e10cSrcweir  ;;
71cdf0e10cSrcweirLinux)
72cdf0e10cSrcweir  PRODUCTINSTALLLOCATION="$$RPM_INSTALL_PREFIX"
73cdf0e10cSrcweir  if [ "$$1" = 1 ]	# one package left after deinstallation -> update
74cdf0e10cSrcweir  then
75cdf0e10cSrcweir    LASTUNINSTALL=0
76cdf0e10cSrcweir  fi
77cdf0e10cSrcweir  ;;
78cdf0e10cSrcweir*)
79cdf0e10cSrcweir  PRODUCTINSTALLLOCATION="$$BASEDIR"
80cdf0e10cSrcweir  ;;
81cdf0e10cSrcweiresac
82cdf0e10cSrcweir
83cdf0e10cSrcweirif [ -h $$PRODUCTINSTALLLOCATION/PRODUCTDIRECTORYNAME/basis-link -a $$LASTUNINSTALL -eq 1 ]
84cdf0e10cSrcweirthen
85cdf0e10cSrcweir  rm -f $$PRODUCTINSTALLLOCATION/PRODUCTDIRECTORYNAME/basis-link 2>/dev/null
86cdf0e10cSrcweir  rmdir $$PRODUCTINSTALLLOCATION/PRODUCTDIRECTORYNAME 2>/dev/null
87cdf0e10cSrcweirfi
88cdf0e10cSrcweir
89cdf0e10cSrcweirexit 0
90cdf0e10cSrcweirEND
91