6 USAGE
="Usage: $0 [-a] [-l] [-h] <pkg-source-dir> <office-installation-dir>"
11 echo "User Mode Installation script for developer and knowledgeable early access tester"
13 echo "This installation method is not intended for use in a production environment!"
14 echo "Using this script is unsupported and completely at your own risk"
16 echo "Usage:" $0 "<pkg-source-dir> <office-installation-dir> [-l]"
17 echo " <pkg-source-dir>: directory *only* containing the Solaris pkg packages to be installed"
18 echo " or language pack shell script containing the Solaris pkg packages"
19 echo " <office-installation-dir>: directory to where the office and the pkg database will get installed into"
21 echo "Optional Parameter:"
22 echo " -a : add to an existing <office-installation-dir>"
23 echo " -l : create a link \"soffice\" in $HOME"
24 echo " -h : output this help"
27 try_to_unpack_languagepack_file
()
29 FILENAME
=$PACKAGE_PATH
31 # Checking, if $FILENAME is a language pack.
32 # String "language package" has to exist in the shell script file.
33 # If this is no language pack, the installation is not supported
35 SEARCHSTRING
=`head -n 10 $FILENAME | grep "language package"`
37 if [ ! -z "$SEARCHSTRING" ]
39 echo "First parameter $FILENAME is a language pack";
41 printf "\nERROR: First parameter $FILENAME is a file, but no language pack shell script.\n"
46 echo "Unpacking shell script $FILENAME"
47 # TAILLINE=`head -n 20 $FILENAME | sed --quiet 's/linenum=//p'`
48 TAILLINE
=`head -n 20 $FILENAME | sed -n 's/linenum=//p'`
50 if [ -x "/usr/bin/mktemp" ] # available in Solaris 10
54 UNPACKDIR
=/var
/tmp
/install_$$
59 tail +$TAILLINE $FILENAME | gunzip |
(cd $UNPACKDIR; tar xvf
-)
61 # Setting the new package path, in which the packages exist
62 PACKAGE_PATH
=$UNPACKDIR
64 # Setting variable UPDATE, because an Office installation has to exist, if a language pack shall be installed
70 # pkg command failed, check for admin log and report help
71 if [ -f /tmp
/.ai.pkg.zone.lock-afdb66cf-1dd1-11b2-a049-000d560ddc3e
]
73 echo "####################################################################"
74 echo "# Installation failed due to stale administrative lock #"
75 echo "####################################################################"
76 printf "\nERROR: please remove the following file first:\n"
77 ls -l /tmp
/.ai.pkg.zone.lock-afdb66cf-1dd1-11b2-a049-000d560ddc3e
89 # this script is for userland not for root
94 printf "\nThis script is for installation without administrative rights only\nPlease use pkgadd/patchadd to install as root\n"
99 while getopts "alh" VALUE
103 a
) ADD
="yes"; break;;
105 l
) LINK
="yes"; break;;
106 ?
) echo $USAGE; exit 2;;
109 shift `expr $OPTIND - 1`
117 # Determine whether this is a patch or a regular install set ..
118 /bin
/bash
-c "ls $1/*/patchinfo >/dev/null 2>&1"
123 PATCH_INFO_LIST
=`/bin/bash -c "cd $1; ls */patchinfo"`
124 PATCH_LIST
=`for i in ${PATCH_INFO_LIST}; do dirname $i; done`
125 elif [ -f "$1/patchinfo" ]
128 PATCH_PATH
=`dirname "$1"`
129 PATCH_LIST
=`basename "$1"`
131 if [ -d "$1/packages" ]
133 PACKAGE_PATH
="$1/packages"
139 # If the first parameter is a shell script (download installation set), the packages have to
140 # be unpacked into temp directory
142 if [ -f "$PACKAGE_PATH" ]
144 try_to_unpack_languagepack_file
148 # Create sed filter script for unwanted packages
151 cat > /tmp
/userinstall_filer.$$
<< EOF
159 # Do not install gnome-integration package on systems without GNOME
160 pkginfo
-q SUNWgnome-vfs
164 echo '/-gnome/d' >> /tmp
/userinstall_filer.$$
167 # pkgdep sorts the packages based on their dependencies
168 PKGDEP
="`dirname $0`/pkgdep"
169 if [ ! -x $PKGDEP ]; then
170 PKGDEP
="get_pkg_list"
174 # Get the list of packages to install
177 PKG_LIST
=`$PKGDEP $PACKAGE_PATH | sed -f /tmp/userinstall_filer.$$`
178 rm -f /tmp
/userinstall_filer.$$
180 if [ -z "$PKG_LIST" ]
182 printf "\n$0: No packages found in $PACKAGE_PATH\n"
186 echo "Packages found:"
187 for i
in $PKG_LIST ; do
193 if [ "$UPDATE" = "yes" ]
195 if [ ! -d ${INSTALL_ROOT}/var
/sadm
/install
/admin
]
197 printf "\n$0: No package database in ${INSTALL_ROOT}.\n"
203 rmdir ${INSTALL_ROOT} 2>/dev
/null
204 if [ -d ${INSTALL_ROOT} ]
206 printf "\n$0: ${INSTALL_ROOT} exists and is not empty.\n"
210 mkdir
-p ${INSTALL_ROOT}/var
/sadm
/install
/admin
213 # Previous versions of this script did not write this file
214 if [ ! -f ${INSTALL_ROOT}/var
/sadm
/install
/admin
/default
]
216 cat > ${INSTALL_ROOT}/var
/sadm
/install
/admin
/default
<< EOF
225 if [ ! "${INSTALL_ROOT:0:1}" = "/" ]; then
226 INSTALL_ROOT
=`cd ${INSTALL_ROOT}; pwd`
229 # This script must exist to make extension registration work
230 # always overwrite to get the latest version.
231 mkdir
-p ${INSTALL_ROOT}/usr
/lib
232 cat > ${INSTALL_ROOT}/usr
/lib
/postrun
<< \EOF
236 # Override UserInstallation in bootstraprc for unopkg ..
237 UserInstallation
='$BRAND_BASE_DIR/../UserInstallation'
238 export UserInstallation
240 if [ -x /usr
/bin
/mktemp
]
242 CMD
=`/usr/bin/mktemp /tmp/userinstall.XXXXXX`
244 CMD
=/tmp
/userinstall.$$
; echo "" > $CMD
247 sed -e 's|"/|"${PKG_INSTALL_ROOT}/|g' > $CMD
251 chmod +x
${INSTALL_ROOT}/usr
/lib
/postrun
2>/dev
/null
253 # create local tmp directory to install on S10
255 if [ -x /usr
/bin
/mktemp
]
257 LOCAL_TMP
=`mktemp -d`
258 rmdir ${INSTALL_ROOT}/tmp
2>/dev
/null
259 ln -s ${LOCAL_TMP} ${INSTALL_ROOT}/tmp
263 # the tail of the script contains a shared object for overloading the getuid()
264 # and a few other calls
267 GETUID_SO
=/tmp
/getuid.so.$$
269 tail +$linenum $0 > $GETUID_SO
272 # Perform the installation
274 if [ "$UPDATE" = "yes" ]
276 # restore original "bootstraprc" prior to patching
277 for i
in ${PKG_LIST}; do
278 my_dir
=${INSTALL_ROOT}`pkgparam -d ${PACKAGE_PATH} "$i" BASEDIR`
279 find "$my_dir" -type f
-name bootstraprc.orig
-exec sh
-ce 'mv "$0" `dirname "$0"`/bootstraprc' {} \
;
282 # copy INST_RELEASE file
283 if [ ! -f ${INSTALL_ROOT}/var
/sadm
/system
/admin
/INST_RELEASE
]
285 mkdir
-p ${INSTALL_ROOT}/var
/sadm
/system
/admin
2>/dev
/null
286 cp -f /var
/sadm
/system
/admin
/INST_RELEASE
${INSTALL_ROOT}/var
/sadm
/system
/admin
/INST_RELEASE
289 # The case UPDATE="yes" is valid for patch installation and for language packs.
290 # For patches the variable PKG_LIST is empty, for language packs it is not empty.
291 # Patches have to be installed with patchadd, language packs with pkgadd
293 if [ -z "${PKG_LIST}" ]
295 LD_PRELOAD_32
=$GETUID_SO /usr
/sbin
/patchadd
-R ${INSTALL_ROOT} -M ${PATCH_PATH} ${PATCH_LIST} 2>&1 |
grep -v '/var/sadm/patch' || pkg_error
297 LD_PRELOAD_32
=$GETUID_SO /usr
/sbin
/pkgadd
-d ${PACKAGE_PATH} -R ${INSTALL_ROOT} ${PKG_LIST} >/dev
/null || pkg_error
302 # Create BASEDIR directories to avoid manual user interaction
303 for i
in ${PKG_LIST}; do
304 mkdir
-m 0755 -p ${INSTALL_ROOT}`pkgparam -d ${PACKAGE_PATH} $i BASEDIR` 2>/dev
/null
307 if [ ! "${INSTALL_ROOT:0:1}" = "/" ]; then
308 INSTALL_ROOT
=`cd ${INSTALL_ROOT}; pwd`
311 echo "####################################################################"
312 echo "# Installation of the found packages #"
313 echo "####################################################################"
315 echo "Path to the packages : " $PACKAGE_PATH
316 echo "Path to the installation : " $INSTALL_ROOT
318 LD_PRELOAD_32
=$GETUID_SO /usr
/sbin
/pkgadd
-d ${PACKAGE_PATH} -R ${INSTALL_ROOT} ${PKG_LIST} >/dev
/null || pkg_error
322 rm -f /tmp
/.ai.pkg.zone.lock
*
324 # remove local tmp directory
325 if [ ! -z ${LOCAL_TMP} ]
327 rm -f ${LOCAL_TMP}/.ai.pkg.zone.lock
*
329 rm -f ${INSTALL_ROOT}/tmp
330 mkdir
${INSTALL_ROOT}/tmp
334 # Create a link into the users home directory
337 if [ "$LINK" = "yes" ]
339 rm -f $HOME/soffice
2>/dev
/null
340 find `cd "$INSTALL_ROOT" && pwd` -name soffice
-type f
-perm -u+x
-exec /bin
/sh
-ce 'ln -sf "$0" "$HOME/soffice" && echo "Creating link from $0 to $HOME/soffice"' {} \
;
343 # patch the "bootstraprc" to create a self-containing installation
344 for i
in ${PKG_LIST}; do
345 my_dir
=${INSTALL_ROOT}`pkgparam -d ${PACKAGE_PATH} "$i" BASEDIR`
346 find "$my_dir" -type f
-name bootstraprc
-exec sh
-ce 'test ! -f "$0".orig && mv "$0" "$0".orig && sed '\''s,^UserInstallation=$SYSUSERCONFIG.*,UserInstallation=$BRAND_BASE_DIR/../UserInstallation,'\'' "$0".orig > "$0"' {} \
;
349 # if an unpack directory exists, it can be removed now
350 if [ ! -z "$UNPACKDIR" ]
352 # for i in ${PKG_LIST}; do
353 # cd $UNPACKDIR; rm -rf $i
358 echo "Removed temporary directory $UNPACKDIR"
362 echo "Installation done ..."