7 USAGE
="Usage: $0 [-a,--add] [-l,--link] [-U,--update] [-h,--help] <rpm-source-dir> <office-installation-dir>"
12 echo "User Mode Installation script for developer and knowledgeable early access tester"
14 echo "This installation method is not intended for use in a production environment!"
15 echo "Using this script is unsupported and completely at your own risk"
17 echo "Usage:" $0 [-lU] "<rpm-source-dir> <office-installation-dir>"
18 echo " <rpm-source-dir>: directory *only* containing the Linux rpm packages to be installed"
19 echo " or language pack shell script containing the rpm packages"
20 echo " <office-installation-dir>: directory to where the office will get installed into"
22 echo "Optional Parameter:"
23 echo " -a,--add: add to an existing <office-installation-dir>"
24 echo " -l,--link: create a link \"soffice\" in $HOME"
25 echo " -U,--update: update without asking"
26 echo " -h,--help: output this help"
30 try_to_unpack_languagepack_file
()
32 FILENAME
=$PACKAGE_PATH
34 # Checking, if $FILENAME is a language pack.
35 # String "language package" has to exist in the shell script file.
36 # If this is no language pack, the installation is not supported
38 SEARCHSTRING
=`head --lines=10 $FILENAME | grep "language package"`
40 if [ ! -z "$SEARCHSTRING" ]
42 echo "First parameter $FILENAME is a language pack";
44 printf "\nERROR: First parameter $FILENAME is a file, but no language pack shell script.\n"
49 echo "Unpacking shell script $FILENAME"
50 TAILLINE
=`head --lines=20 $FILENAME | sed --quiet 's/linenum=//p'`
52 UNPACKDIR
=/var
/tmp
/install_$$
54 # UNPACKDIR=`mktemp -d`
55 tail -n +$TAILLINE $FILENAME | gunzip |
(cd $UNPACKDIR; tar xvf
-)
57 # Setting the new package path, in which the packages exist
58 PACKAGE_PATH
=$UNPACKDIR
60 # Setting variable UPDATE, because an Office installation has to exist, if a language pack shall be installed
65 # this script is for userland not for root
70 printf "\nThis script is for installation without administrative rights only\nPlease use rpm to install as root\n"
75 set -- `getopt -u -o 'alhU' -l 'add,link,help,update' -- $*`
86 -a|
--add) ADD
="yes"; shift;;
87 -h|
--help) help; exit 0;;
88 -l|
--link) LINK
="yes"; shift;;
89 -U|
--update) UPDATE
="yes"; shift;;
103 # If the first parameter is a shell script (download installation set), the packages have to
104 # be unpacked into temp directory
107 if [ -f "$PACKAGE_PATH" ]
109 try_to_unpack_languagepack_file
113 # Check and get the list of packages to install
116 RPMLIST
=`find $PACKAGE_PATH -maxdepth 2 -type f -name "*.rpm" ! -name "*-menus-*" ! -name "*-desktop-integration-*" ! -name "jre*" ! -name "*-userland-*" -print`
120 printf "\n$0: No packages found in $PACKAGE_PATH\n"
124 # #163256# check if we are on a debian system...
125 if rpm
--help |
grep debian
>/dev
/null
;
127 DEBIAN_FLAGS
="--force-debian --nodeps"
133 # Determine whether this should be an update or a fresh install
137 RPM_DB_PATH
=${INSTALLDIR}/var
/lib
/rpm
139 # Check for versionrc
140 if [ -f ${INSTALLDIR}/program
/versionrc
]; then VERSIONRC
=versionrc
; fi
142 if [ "$UPDATE" = "ask" ]
144 PRODUCT
=`sed --silent -e "
146 s/buildid=\(.*\)/ [\1]/
153 }" ${INSTALLDIR}/program/${VERSIONRC:-bootstraprc} 2>/dev/null | tr -d "\012"`
155 if [ ! -z "$PRODUCT" ]
158 echo "Found an installation of $PRODUCT in $INSTALLDIR"
160 while [ "$UPDATE" != "yes" ]
162 read -a UPDATE
-p "Do you want to update this installation (yes/no)? "
163 if [ "$UPDATE" = "no" ]
168 elif [ -d $RPM_DB_PATH -a "$ADD" = "no" ]
171 echo "The following packages are already installed in $INSTALLDIR"
173 rpm
--dbpath `cd $RPM_DB_PATH; pwd` --query --all
175 while [ "$UPDATE" != "yes" ]
177 read -a UPDATE
-p "Do you want to continue with this installation (yes/no)? "
178 if [ "$UPDATE" = "no" ]
189 # Check/Create installation directory
192 if [ "$UPDATE" = "yes" ]
194 # restore original bootstraprc
195 mv -f ${INSTALLDIR}/program
/bootstraprc.orig
${INSTALLDIR}/program
/bootstraprc
2>/dev
/null
197 # the RPM_DB_PATH must be absolute
198 if [ ! "${RPM_DB_PATH:0:1}" = "/" ]; then
199 RPM_DB_PATH
=`cd ${RPM_DB_PATH}; pwd`
202 # we should use --freshen for updates to not add languages with patches, but this will break
203 # language packs, so leave it for now ..
207 rmdir ${INSTALLDIR} 2>/dev
/null
209 if [ -d ${INSTALLDIR} -a "$ADD" = "no" ]
211 printf "\n$0: ${INSTALLDIR} exists and is not empty.\n"
215 mkdir
-p $RPM_DB_PATH ||
exit 2
217 chmod 700 $RPM_DB_PATH
219 # the RPM_DB_PATH must be absolute
220 if [ ! "${RPM_DB_PATH:0:1}" = "/" ]; then
221 RPM_DB_PATH
=`cd ${RPM_DB_PATH}; pwd`
224 # Creating RPM database and initializing
225 if [ "$ADD" = "no" ]; then
226 rpm
--initdb --dbpath $RPM_DB_PATH
229 # Default install command
233 # populate the private rpm database with the dependencies needed
234 FAKEDBRPM
=/tmp
/fake-db-1.0
-$$.noarch.rpm
236 tail -n +$linenum $0 > $FAKEDBRPM
238 rpm
${DEBIAN_FLAGS} --upgrade --ignoresize --dbpath $RPM_DB_PATH $FAKEDBRPM
242 echo "Packages found:"
243 for i
in $RPMLIST ; do
248 # Perform the installation
252 echo "####################################################################"
253 echo "# Installation of the found packages #"
254 echo "####################################################################"
256 echo "Path to the database: " $RPM_DB_PATH
257 echo "Path to the packages: " $PACKAGE_PATH
258 echo "Path to the installation: " $INSTALLDIR
260 echo "Installing the RPMs"
262 ABSROOT
=`cd ${INSTALLDIR}; pwd`
263 RELOCATIONS
=`rpm -qp --qf "--relocate %{PREFIXES}=${ABSROOT}%{PREFIXES} \n" $RPMLIST | sort -u | tr -d "\012"`
264 UserInstallation
=\
$BRAND_BASE_DIR/..
/UserInstallation rpm
${DEBIAN_FLAGS} $RPMCMD --ignoresize -vh $RELOCATIONS --dbpath $RPM_DB_PATH $RPMLIST
267 # Create a link into the users home directory
270 if [ "$LINK" = "yes" ]
272 find `cd "$INSTALLDIR" && pwd` -name soffice
-type f
-perm /u
+x
-exec /bin
/bash
-ce 'ln -sf "$0" "$HOME/soffice" && echo "Creating link from $0 to $HOME/soffice"' {} \
;
275 if [ "$UPDATE" = "yes" -a ! -f $INSTALLDIR/program
/bootstraprc
]
278 echo "Update failed due to a bug in RPM, uninstalling .."
279 rpm
${DEBIAN_FLAGS} --erase -v --nodeps --dbpath $RPM_DB_PATH `rpm --query --queryformat "%{NAME} " --package $RPMLIST --dbpath $RPM_DB_PATH`
281 echo "Now re-installing new packages .."
283 rpm
${DEBIAN_FLAGS} --install --nodeps --ignoresize -vh $RELOCATIONS --dbpath $RPM_DB_PATH $RPMLIST
287 # patch the "bootstraprc" to create a self-containing installation
288 find "$INSTALLDIR" -type f
-name bootstraprc
-exec /bin
/bash
-ce 'test ! -e "$0".orig && mv "$0" "$0".orig && sed '\''s,^UserInstallation=$SYSUSERCONFIG.*,UserInstallation=$BRAND_BASE_DIR/../UserInstallation,'\'' "$0".orig > "$0"' {} \
;
290 # if an unpack directory exists, it can be removed now
291 if [ ! -z "$UNPACKDIR" ]
295 echo "Removed temporary directory $UNPACKDIR"
299 echo "Installation done ..."