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