1*184e05d2SAndrew Rist# *************************************************************
2*184e05d2SAndrew Rist#
3*184e05d2SAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
4*184e05d2SAndrew Rist#  or more contributor license agreements.  See the NOTICE file
5*184e05d2SAndrew Rist#  distributed with this work for additional information
6*184e05d2SAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
7*184e05d2SAndrew Rist#  to you under the Apache License, Version 2.0 (the
8*184e05d2SAndrew Rist#  "License"); you may not use this file except in compliance
9*184e05d2SAndrew Rist#  with the License.  You may obtain a copy of the License at
10*184e05d2SAndrew Rist#
11*184e05d2SAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
12*184e05d2SAndrew Rist#
13*184e05d2SAndrew Rist#  Unless required by applicable law or agreed to in writing,
14*184e05d2SAndrew Rist#  software distributed under the License is distributed on an
15*184e05d2SAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*184e05d2SAndrew Rist#  KIND, either express or implied.  See the License for the
17*184e05d2SAndrew Rist#  specific language governing permissions and limitations
18*184e05d2SAndrew Rist#  under the License.
19*184e05d2SAndrew Rist#
20*184e05d2SAndrew Rist# *************************************************************
21*184e05d2SAndrew Rist
22cdf0e10cSrcweir%system solaris
23cdf0e10cSrcweir
24cdf0e10cSrcweir%postinstall << END
25cdf0e10cSrcweir
26cdf0e10cSrcweir#
27cdf0e10cSrcweir# Need to check diskless service install and make sure use the correct unpkg
28cdf0e10cSrcweir#
29cdf0e10cSrcweirDISKLESS_SRVC=`echo $$BASEDIR | /usr/bin/grep export/Solaris_[1-9][0-9]/usr_$${ARCH}.all`
30cdf0e10cSrcweirif [  "$$DISKLESS_SRVC" ]; then
31cdf0e10cSrcweir	UNOPKG=/export/Solaris_11/usr_`uname -p`.allPRODUCTDIRECTORYNAME/program/unopkg
32cdf0e10cSrcweir	POSTRUN=$$PKG_INSTALL_ROOT/usr_`uname -p`.all/usr/lib/postrun
33cdf0e10cSrcweir	CLIENT_BASEDIR=$$PKG_INSTALL_ROOT/usr_$${ARCH}.all
34cdf0e10cSrcweirelse
35cdf0e10cSrcweir	UNOPKG=$$BASEDIR/PRODUCTDIRECTORYNAME/program/unopkg
36cdf0e10cSrcweir	POSTRUN=$$PKG_INSTALL_ROOT/usr/lib/postrun
37cdf0e10cSrcweirfi
38cdf0e10cSrcweir# Use postrun command on Solaris where available (OpenSolaris)
39cdf0e10cSrcweirif [ -x $$POSTRUN ]; then
40cdf0e10cSrcweir( echo "test -x \"$$CLIENT_BASEDIR/PRODUCTDIRECTORYNAME/program/unopkg\" || exit 0"
41cdf0e10cSrcweir  echo "umask 022"
42cdf0e10cSrcweir  echo "\"$$CLIENT_BASEDIR/PRODUCTDIRECTORYNAME/program/unopkg\" sync"
43cdf0e10cSrcweir  echo  "find \"$$CLIENT_BASEDIR/PRODUCTDIRECTORYNAME/share/prereg/bundled\" -type f -exec chmod 644 {} \\;"
44cdf0e10cSrcweir) | $$POSTRUN -b -c UNOPKG
45cdf0e10cSrcweir  if [ "$$?" != "0" ]; then
46cdf0e10cSrcweir    echo "\nERROR: Installation of UNO extensions"
47cdf0e10cSrcweir    echo " through $$POSTRUN failed."
48cdf0e10cSrcweir    exit 1
49cdf0e10cSrcweir  fi
50cdf0e10cSrcweirelse
51cdf0e10cSrcweir  # No postrun available, try running unopkg directly
52cdf0e10cSrcweir  "$$UNOPKG" sync
53cdf0e10cSrcweir find "$$BASEDIR/PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \;
54cdf0e10cSrcweir  if [ "$$?" != "0" ]; then
55cdf0e10cSrcweir    echo "\nERROR: Installation of UNO extensions failed."
56cdf0e10cSrcweir    test "$$BASEDIR" = "$$CLIENT_BASEDIR" || echo "ERROR: alternate root install requires SUNWpostrun package to be installed"
57cdf0e10cSrcweir    echo 'ERROR: Make sure the runtime requirements (operating system, patch level, architecture) are met.'
58cdf0e10cSrcweir    exit 1
59cdf0e10cSrcweir  fi
60cdf0e10cSrcweirfi
61cdf0e10cSrcweir
62cdf0e10cSrcweirexit 0
63cdf0e10cSrcweirEND
64cdf0e10cSrcweir
65cdf0e10cSrcweir%postremove << END
66cdf0e10cSrcweir
67cdf0e10cSrcweir# Use postrun command on Solaris where available (OpenSolaris)
68cdf0e10cSrcweirif [ -x $$PKG_INSTALL_ROOT/usr/lib/postrun ]; then
69cdf0e10cSrcweir( echo "test -x \"$$CLIENT_BASEDIR/PRODUCTDIRECTORYNAME/program/unopkg\" || exit 0"
70cdf0e10cSrcweir  echo "cd \"$$CLIENT_BASEDIR/PRODUCTDIRECTORYNAME/program\""
71cdf0e10cSrcweir  echo "umask 022"
72cdf0e10cSrcweir  echo "\"$$CLIENT_BASEDIR/PRODUCTDIRECTORYNAME/program/unopkg\" sync"
73cdf0e10cSrcweir  echo  "find \"$$CLIENT_BASEDIR/PRODUCTDIRECTORYNAME/share/prereg/bundled\" -type f -exec chmod 644 {} \\;"
74cdf0e10cSrcweir) | $$PKG_INSTALL_ROOT/usr/lib/postrun -c UNOPKG
75cdf0e10cSrcweirelse
76cdf0e10cSrcweir  # No postrun available, try running unopkg directly
77cdf0e10cSrcweir  test -x $$BASEDIR/PRODUCTDIRECTORYNAME/program/unopkg || exit 0
78cdf0e10cSrcweir  "$$BASEDIR/PRODUCTDIRECTORYNAME/program/unopkg" sync
79cdf0e10cSrcweir  echo  "find \"$$BASEDIR/PRODUCTDIRECTORYNAME/share/prereg/bundled\" -type f -exec chmod 644 {} \\;"
80cdf0e10cSrcweir  if [ "$$?" != "0" ]; then
81cdf0e10cSrcweir    echo "\nERROR: Removal of UNO extension failed."
82cdf0e10cSrcweir    test "$$BASEDIR" = "$$CLIENT_BASEDIR" || echo "ERROR: alternate root uninstall requires SUNWpostrun package to be installed"
83cdf0e10cSrcweir    echo 'ERROR: Make sure the runtime requirements (operating system, patch level, architecture) are met.'
84cdf0e10cSrcweir    exit 1
85cdf0e10cSrcweir  fi
86cdf0e10cSrcweirfi
87cdf0e10cSrcweir
88cdf0e10cSrcweir
89cdf0e10cSrcweirexit 0
90cdf0e10cSrcweirEND
91cdf0e10cSrcweir
92cdf0e10cSrcweir%system linux
93cdf0e10cSrcweir
94cdf0e10cSrcweir%format rpm
95cdf0e10cSrcweir
96cdf0e10cSrcweir%postinstall << END
97cdf0e10cSrcweir
98cdf0e10cSrcweirif [ -x "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" ]; then
99cdf0e10cSrcweir  "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" sync
100cdf0e10cSrcweir  if [ "$$?" != "0" ]; then
101cdf0e10cSrcweir    echo "ERROR: Registration of extensions failed!"
102cdf0e10cSrcweir    exit 1
103cdf0e10cSrcweir  else
104cdf0e10cSrcweir    echo "SUCCESS: unopkg returns successful!"
105cdf0e10cSrcweir  fi
106cdf0e10cSrcweir  find "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \;
107cdf0e10cSrcweirfi
108cdf0e10cSrcweir
109cdf0e10cSrcweirexit 0
110cdf0e10cSrcweir
111cdf0e10cSrcweirEND
112cdf0e10cSrcweir
113cdf0e10cSrcweir%postremove << END
114cdf0e10cSrcweir
115cdf0e10cSrcweirif [ -x "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" ]; then
116cdf0e10cSrcweir  "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" sync
117cdf0e10cSrcweir  if [ "$$?" != "0" ]; then
118cdf0e10cSrcweir    echo "ERROR: Registration of extensions failed!"
119cdf0e10cSrcweir    exit 1
120cdf0e10cSrcweir  else
121cdf0e10cSrcweir    echo "SUCCESS: unopkg returns successful!"
122cdf0e10cSrcweir  fi
123cdf0e10cSrcweir  find "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \;
124cdf0e10cSrcweirfi
125cdf0e10cSrcweir
126cdf0e10cSrcweirexit 0
127cdf0e10cSrcweirEND
128cdf0e10cSrcweir
129cdf0e10cSrcweir%format deb
130cdf0e10cSrcweir
131cdf0e10cSrcweir%postinstall << END
132cdf0e10cSrcweir
133cdf0e10cSrcweirif [ -x "PRODUCTDIRECTORYNAME/program/unopkg" ]; then
134cdf0e10cSrcweir  "PRODUCTDIRECTORYNAME/program/unopkg" sync
135cdf0e10cSrcweir  if [ "$$?" != "0" ]; then
136cdf0e10cSrcweir    echo "ERROR: Registration of extensions failed!"
137cdf0e10cSrcweir    exit 1
138cdf0e10cSrcweir  else
139cdf0e10cSrcweir    echo "SUCCESS: unopkg returns successful!"
140cdf0e10cSrcweir  fi
141cdf0e10cSrcweir  find "PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \;
142cdf0e10cSrcweirfi
143cdf0e10cSrcweir
144cdf0e10cSrcweirexit 0
145cdf0e10cSrcweir
146cdf0e10cSrcweirEND
147cdf0e10cSrcweir
148cdf0e10cSrcweir%postremove << END
149cdf0e10cSrcweir
150cdf0e10cSrcweirif [ -x "PRODUCTDIRECTORYNAME/program/unopkg" ]
151cdf0e10cSrcweirthen
152cdf0e10cSrcweir  "PRODUCTDIRECTORYNAME/program/unopkg" sync
153cdf0e10cSrcweir  if [ "$$?" != "0" ]; then
154cdf0e10cSrcweir    echo "ERROR: Registration of extensions failed!"
155cdf0e10cSrcweir    exit 1
156cdf0e10cSrcweir  else
157cdf0e10cSrcweir    echo "SUCCESS: unopkg returns successful!"
158cdf0e10cSrcweir  fi
159cdf0e10cSrcweir find "PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \;
160cdf0e10cSrcweirfi
161cdf0e10cSrcweir
162cdf0e10cSrcweirexit 0
163cdf0e10cSrcweirEND
164cdf0e10cSrcweir
165cdf0e10cSrcweir%system all
166