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%system solaris 23 24%postinstall << END 25 26# 27# Need to check diskless service install and make sure use the correct unpkg 28# 29DISKLESS_SRVC=`echo $$BASEDIR | /usr/bin/grep export/Solaris_[1-9][0-9]/usr_$${ARCH}.all` 30if [ "$$DISKLESS_SRVC" ]; then 31 UNOPKG=/export/Solaris_11/usr_`uname -p`.allPRODUCTDIRECTORYNAME/program/unopkg 32 POSTRUN=$$PKG_INSTALL_ROOT/usr_`uname -p`.all/usr/lib/postrun 33 CLIENT_BASEDIR=$$PKG_INSTALL_ROOT/usr_$${ARCH}.all 34else 35 UNOPKG=$$BASEDIR/PRODUCTDIRECTORYNAME/program/unopkg 36 POSTRUN=$$PKG_INSTALL_ROOT/usr/lib/postrun 37fi 38# Use postrun command on Solaris where available (OpenSolaris) 39if [ -x $$POSTRUN ]; then 40( echo "test -x \"$$CLIENT_BASEDIR/PRODUCTDIRECTORYNAME/program/unopkg\" || exit 0" 41 echo "umask 022" 42 echo "\"$$CLIENT_BASEDIR/PRODUCTDIRECTORYNAME/program/unopkg\" sync" 43 echo "find \"$$CLIENT_BASEDIR/PRODUCTDIRECTORYNAME/share/prereg/bundled\" -type f -exec chmod 644 {} \\;" 44) | $$POSTRUN -b -c UNOPKG 45 if [ "$$?" != "0" ]; then 46 echo "\nERROR: Installation of UNO extensions" 47 echo " through $$POSTRUN failed." 48 exit 1 49 fi 50else 51 # No postrun available, try running unopkg directly 52 "$$UNOPKG" sync 53 find "$$BASEDIR/PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \; 54 if [ "$$?" != "0" ]; then 55 echo "\nERROR: Installation of UNO extensions failed." 56 test "$$BASEDIR" = "$$CLIENT_BASEDIR" || echo "ERROR: alternate root install requires SUNWpostrun package to be installed" 57 echo 'ERROR: Make sure the runtime requirements (operating system, patch level, architecture) are met.' 58 exit 1 59 fi 60fi 61 62exit 0 63END 64 65%postremove << END 66 67# Use postrun command on Solaris where available (OpenSolaris) 68if [ -x $$PKG_INSTALL_ROOT/usr/lib/postrun ]; then 69( echo "test -x \"$$CLIENT_BASEDIR/PRODUCTDIRECTORYNAME/program/unopkg\" || exit 0" 70 echo "cd \"$$CLIENT_BASEDIR/PRODUCTDIRECTORYNAME/program\"" 71 echo "umask 022" 72 echo "\"$$CLIENT_BASEDIR/PRODUCTDIRECTORYNAME/program/unopkg\" sync" 73 echo "find \"$$CLIENT_BASEDIR/PRODUCTDIRECTORYNAME/share/prereg/bundled\" -type f -exec chmod 644 {} \\;" 74) | $$PKG_INSTALL_ROOT/usr/lib/postrun -c UNOPKG 75else 76 # No postrun available, try running unopkg directly 77 test -x $$BASEDIR/PRODUCTDIRECTORYNAME/program/unopkg || exit 0 78 "$$BASEDIR/PRODUCTDIRECTORYNAME/program/unopkg" sync 79 echo "find \"$$BASEDIR/PRODUCTDIRECTORYNAME/share/prereg/bundled\" -type f -exec chmod 644 {} \\;" 80 if [ "$$?" != "0" ]; then 81 echo "\nERROR: Removal of UNO extension failed." 82 test "$$BASEDIR" = "$$CLIENT_BASEDIR" || echo "ERROR: alternate root uninstall requires SUNWpostrun package to be installed" 83 echo 'ERROR: Make sure the runtime requirements (operating system, patch level, architecture) are met.' 84 exit 1 85 fi 86fi 87 88 89exit 0 90END 91 92%system linux 93 94%format rpm 95 96%postinstall << END 97 98if [ -x "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" ]; then 99 "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" sync 100 if [ "$$?" != "0" ]; then 101 echo "ERROR: Registration of extensions failed!" 102 exit 1 103 else 104 echo "SUCCESS: unopkg returns successful!" 105 fi 106 find "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \; 107fi 108 109exit 0 110 111END 112 113%postremove << END 114 115if [ -x "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" ]; then 116 "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" sync 117 if [ "$$?" != "0" ]; then 118 echo "ERROR: Registration of extensions failed!" 119 exit 1 120 else 121 echo "SUCCESS: unopkg returns successful!" 122 fi 123 find "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \; 124fi 125 126exit 0 127END 128 129%format deb 130 131%postinstall << END 132 133if [ -x "PRODUCTDIRECTORYNAME/program/unopkg" ]; then 134 "PRODUCTDIRECTORYNAME/program/unopkg" sync 135 if [ "$$?" != "0" ]; then 136 echo "ERROR: Registration of extensions failed!" 137 exit 1 138 else 139 echo "SUCCESS: unopkg returns successful!" 140 fi 141 find "PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \; 142fi 143 144exit 0 145 146END 147 148%postremove << END 149 150if [ -x "PRODUCTDIRECTORYNAME/program/unopkg" ] 151then 152 "PRODUCTDIRECTORYNAME/program/unopkg" sync 153 if [ "$$?" != "0" ]; then 154 echo "ERROR: Registration of extensions failed!" 155 exit 1 156 else 157 echo "SUCCESS: unopkg returns successful!" 158 fi 159 find "PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \; 160fi 161 162exit 0 163END 164 165%system all 166