OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Linux: Automated OOo User Installation

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Code Snippets
View previous topic :: View next topic  
Author Message
jbotte
Power User
Power User


Joined: 27 Jan 2004
Posts: 57
Location: NC, USA

PostPosted: Wed Mar 10, 2004 7:43 am    Post subject: Linux: Automated OOo User Installation Reply with quote

This is Part 1 of 4... the remaining parts are posted as replies to this post so they are all together...

Introduction

As part of the integration of OpenOffice.org into our application environment, we needed to be able to be able to automatically install OpenOffice.org for a large number of users on our servers when we built them, and we also needed to install OpenOffice.org on a per user basis on workstations without having the user be presented with any form of setup screens. Also, in both cases, the users should not be prompted for registration. So... I used a combination of the Virtual Frame Buffer X Server and the OpenOffice.org "setup" program with a response file to do the install -- as per the "StarOffice 7 Office Suite -- Administration Guide", Sun Microsystems, P/N 817-1820-10.

OOo Standard Server Installation

The first thing to do is download the version of OpenOffice.org (OOo) that you want to use. In my case, I will discuss using OOo 1.1.2 (so I can discuss upgrading to 1.1.3 later Cool). The downloaded file can go anywhere that's convenient. In my case, I used my home directory "/home/jbotte". The file as distributed from the OOo main download site was "OOo_1.1.2_LinuxIntel_install.tar.gz". In the directory where you want the temporary files to be stored (I was still running as user "jbotte" and working from my home directory), untar the downloaded file with the command (this assumes GNU tar so I can use the "-z" option to handle the compression at the same time):
Code:
tar -zxvf OOo_1.1.2_LinuxIntel_install.tar.gz

This creates a sub-directory called "OOo_1.1.2_LinuxIntel_install". Change directory into that sub-directory and then "su" to root to do the actuall OOo installation (you will need to remain as root for most of the operations discussed here...). From there, run the OOo Setup program to do a "network" installation (that will be useable by all users on the server or workstation):
Code:
cd OOo_1.1.2_LinuxIntel_install
su
./setup -net

When doing the installs, I select the "Standard Installation" option since I haven't needed anything other than that so far... When it asks what directory to install to, answer what makes sense for your installation (the default for OOo 1.1.2 is "/opt/OpenOffice.org1.1.2"); however, for the purposes of my system's setup, I use the directory "/usr/local/OpenOffice.org1.1.2", and I will use this location for the rest of my discussion.

Once the installation is done, the "OOo_1.1.2_LinuxIntel_install" sub-directory can be deleted as these files will not be needed again. Then, create a symlink from "/usr/local/OpenOffice.org1.1.2" to "/usr/local/OOo":
Code:
ln -s /usr/local/OpenOffice.org1.1.2 /usr/local/OOo

This will assist later when it's time to upgrade to a newer version (since multiple versions can exist at the same time on the machine). At this point, you will also need to decide how the OOo program(s) will be invoked (i.e. what strategy will be used to allow the user to find the executable(s)). Because the OOo installation takes care of setting up the KDE and Gnome environments, if the command line is not used or absolute paths will always be employed from the command line or scripts, then you don't have to worry about this. What I did was created a symbolic link to a path that we already have in our PATH environment variable for all users: "/usr/local/bin". We only needed access to the "soffice" executable, and use command line parameters to select Writer, Impress, etc. and didn't need access to all of the shortcuts provided in the OOo directory. So we just used:
Code:
ln -s /usr/local/OOo/program/soffice /usr/local/bin/soffice

Another way of approaching it is to add "/usr/local/OOo/program" to everyone's PATH environment variable. Note that both methods use the "/usr/local/OOo" link so we can replace the version of OOo invoked just by changing the symbolic link without having to worry about any scripts that access OOo executables (any time I use absolute paths, I invoke OOo with the path "/usr/local/OOo/program/soffice" for the same reason).

OOo Server Configuration:

Once the OOo installation in place, it needs to be customized for the application and for "headless" installation. The next thing I do is install our macro library into "/usr/local/OOo/share/basic/Medformix" so it will be available to all users (without copying it to their local directories -- done with the link="true" setting). The directory contains our FlatMerge module in the "FlatMerge.xba" basic file and related "script.xlb" and "dialog.xlb" files. The "dialog.xlb" file is generated automatically as we create the macro, but I modified it to be readonly="true":
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Medformix" library:readonly="true" library:passwordprotected="false"/>

The script.xlb file is also automatically generated, but I modified it to be readonly="true":
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Medformix" library:readonly="true" library:passwordprotected="false">
 <library:element library:name="FlatMerge"/>
</library:library>

I then updated the files "/usr/local/OOo/user/basic/script.xlc" and "/usr/local/OOo/usr/basic/dialog.xlc" to include the following line in each (as the last entry in the file, right before the "</library:libraries>" line):
Code:
 <library:library library:name="Medformix" library:link="true"/>

The last change we needed to make to the OOo installation was to disable the pop-up request for the user to register. This is done by editing the file "/usr/local/OOo/share/registry/data/org/openoffice/Office/Common.xcu". The context diff is:
Code:
*** Common.xcu.orig     Tue Mar  9 14:00:18 2004
--- Common.xcu  Wed Mar 10 10:29:54 2004
***************
*** 314,319 ****
--- 314,325 ----
     <prop oor:name="URL" oor:type="xs:string">
      <value>http://www.openoffice.org/welcome/registration.html</value>
     </prop>
+    <prop oor:name="ReminderDate" oor:type="xs:string">
+     <value xsi:nil="true"/>
+    </prop>
+    <prop oor:name="RequestDialog" oor:type="xs:int">
+     <value>0</value>
+    </prop>
    </node>
   </node>
   <node oor:name="I18N">

If you want to do the editing by hand, just look for the node oor:name="Registration", then insert the six lines with the plusses beside them (remove the plusses first though!!!) below the three prop oor:name="URL" lines and before the </node> line for the oor:name="Registration" node. Now, when a user installs, they will not be prompted to register when they run it for the first time. Note: The Help->Registration menu is still enabled and you can instruct them to register at their convenience if desired; however, because we run OOo on our servers "unattended" (i.e. no human around), the pop-up was not a feasible way of doing things.


Last edited by jbotte on Tue Oct 05, 2004 9:21 pm; edited 11 times in total
Back to top
View user's profile Send private message
jbotte
Power User
Power User


Joined: 27 Jan 2004
Posts: 57
Location: NC, USA

PostPosted: Wed Mar 10, 2004 8:24 am    Post subject: Linux: Automated OOo User Installation -- 2/4 Reply with quote

Now that the OOo installation and configuration is done, we can get the rest of the system ready...

Setting Up The "Headless" X Server...

Because we want to be able to run OOo without having anybody around, and possibly without even an X Server running on our monitor (our servers are accessed from the Linux consoles... usually as root... with no X Server running for the display; whereas our workstations always have KDE running and users log in with Kdm), we needed to have a way of running OOo no matter what the environment. We did this by using the "Virtual Frame Buffer" X Server (Xvfb). Xvfb runs on our servers all the time, but is only invoked on our workstations when we are doing the OOo installation (it is turned off right afterwards). To start the Xvfb, I created the script "/etc/rc.d/rc.xvfb" (Note: We use a Slackware base, you will need to figure out how your distribution's startup is done...):
Code:
#!/bin/sh
#
#**************************************************************************
#
#   Medformix OpenOffice "Headless Install" Package: Xvfb Startup Script
#
#     Start/stop/restart the virtual frame buffer based X Server (Xvfb)
#
#**************************************************************************
#
# Copyright (c) 2004 Crowell Systems -- http://www.crowellsystems.com/
#
# This file is part of the Medformix OpenOffice "Headless Install" Package.
#
# The Medformix OpenOffice "Headless Install" Package is free software; you
# can redistribute it and/or modify it under the terms of the GNU General
# Public License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# The Medformix OpenOffice "Headless Install" Package is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with the Medformix OpenOffice "Headless Install" Package; if not, write to
# the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA or view it at "http://www.gnu.org/licenses/gpl.html".
#
#**************************************************************************
# Contributors:
#   volkerdi: Patrick J. Volkerding, volkerdi@slackware.com
#   jbotte:   James Botte, jbotte@crowellsystems.com
#
# Changelog:
#   N/A:   unknown: volkerdi: Wrote rc.syslog for Slackware 9.0. No license
#     was included in the file; however, I have received permission from
#     volkerdi to distribute this derivative work under the GPL.
#   1.0.0: 09mar04: jbotte: Created based on volkerdi's rc.syslog
#     start/stop/restart framework written for Slackware.
#   1.0.1: 05oct04: jbotte: Put in full path for killall in xvfb_stop().
#     Got rid of xvfb_restart() function and just inlined the code in
#     the main case statement. Updated help, added more error checking.
#**************************************************************************

xvfb_start() {
  if [ -x /usr/X11/bin/Xvfb ]; then
    echo "Starting Virtual Frame Buffer X Server (Xvfb) as local display :1.0"
    echo "  /usr/X11/bin/Xvfb :1 -screen 0 800x600x16 -fbdir /usr/local/mfx/etc"
    /usr/X11/bin/Xvfb :1 -screen 0 800x600x16 -fbdir /usr/local/mfx/etc &
  else
    echo "Error: Could not find /usr/X11/bin/Xvfb. Cannot start Xvfb."
  fi
}

xvfb_stop() {
  if [ -x /bin/killall ]; then
    echo "Stopping Virtual Frame Buffer X Server (Xvfb) for local display :1.0"
    /bin/killall Xvfb 2> /dev/null
  else
    echo "Error: Could not find /bin/killall. Cannot stop Xvfb."
  fi
}

case "$1" in
  'start')
    xvfb_start
    ;;
  'stop')
    xvfb_stop
    ;;
  'restart')
    xvfb_stop
    sleep 1
    xvfb_start
    ;;
  *)
    if [ -x /usr/bin/basename ]; then
      echo "usage: `/usr/bin/basename $0` start|stop|restart"
    else
      echo "usage: $0 start|stop|restart"
    fi
esac

Note: I did get Patrick Volkerding's written permission to release this derivative work of his rc.syslog script (from the Slackware 9.1 distribution) under the GPL.

Also note: I run Xvfb as display :1... if you have more than one X Server running, you may need to set the Xvfb display number to something else. I also use the "memory mapped file" method of running Xvfb so we do not use up the machine's virtual memory running it. I put the frame buffer file in "/usr/local/mfx/etc" ... I suspect you'll probably want to find another location for it, since "/usr/local/mfx" is part of our application infrastructure and won't be on your system (unless you're already running our software Wink). FYI, I decided to use "/var/state/xvfb" on my home system (it can have permissions 700 and be owned by root since the frame buffer file is created as root since the Xvfb Server is invoked from the system startup scripts).

I then modified the "/etc/rc.d/rc.M" script to start the Xvfb if the "rc.xvfb" script is executable (on the server it's executable, on the workstation it's not, but it's on all of our systems). The key is to start it after the X Font Server (xfs) is started (if it is used):
Code:
# This was already in our rc.M file...
if [ -x /usr/X11R6/bin/xfs ]; then
    /usr/X11R6/bin/xfs -daemon
fi

# Now we can start the virtual frame buffer X server so we
#   can run X applications "headless"
if [ -x /etc/rc.d/rc.xvfb ]; then
   /etc/rc.d/rc.xvfb start
fi

This also ensures that the Xvfb is running as "root" and is a child of the init process. Now there are two more things that need to be done to allow any user to use the Xvfb Server and not be fouled up by the <explitive deleted> Xauth/Xhost authentication schemes for X Clients running on the same machine as the X Server. First... make sure that root's ".Xauthority" file is empty! Two ways to do this... either log in from the Linux console as root (i.e. with no X Server running on the display) or log in to X Windows as a different user and "su" to root from an Xterm (you might want to do a "cd" command first, just to make sure the home directory that is changed to really is root's... never can be too safe...). Then, run the following commands:
Code:
cd; rm -f .Xauthority; touch .Xauthority; chmod 600 .Xauthority

This will create an empty ".Xauthority" file with the correct permissions in root's home directory. Next, you will need to create an "/etc/X1.hosts" file with two entries: the hostname of your machine and "localhost". Presuming your machine is named "pebbles", the file would contain the following:
Code:
pebbles
localhost

As long as there are no entries for display :1 in root's ".Xauthority" file, any user will be able to run X Clients with the Xvfb Server. FYI, it's perfectly fine to run Xvfb and the regular X Server at the same time (or more than one if that's what turns your crank). They do not interfere with each other... even if you're logged in as root and Xdm/Kdm/startx/whatever creates an entry in root's .Xauthority file for that display... because there's no entry for the Xvfb display, it will not lock down that Server.

So... when you reboot your machine, Xvfb will either be running or not depending on whether or not you set the /etc/rc.d/rc.xvfb script to have execute permissions for root. FYI, don't worry about rebooting your machine to start OOo installs... it doesn't matter as long as the "/etc/rc.d/rc.xvfb" script is in place -- hey, this isn't Windoze and we don't need to reboot every time we want to do something Shocked...

As an aside, one other advantage of using a memory mapped file for the buffer space for the Xvfb is it can be viewed. To do this, use the "xwud" command like this:
Code:
/usr/X11/bin/xwud -in /usr/local/mfx/etc/Xvfb_screen0 -display localhost:0.0

This can be useful in debugging as it takes a snapshot of what is going on on the "display" and show it on a real display. This can be especially useful if OOo forgets it's supposed to be running "headless" and tries to display a dialogue box.


Last edited by jbotte on Wed Oct 06, 2004 10:57 am; edited 6 times in total
Back to top
View user's profile Send private message
jbotte
Power User
Power User


Joined: 27 Jan 2004
Posts: 57
Location: NC, USA

PostPosted: Wed Mar 10, 2004 9:46 am    Post subject: Linux: Automated OOo User Installation -- 3/4 Reply with quote

The OOo "Server" installation is configured the way we want it and we have the Xvfb facility available for installation, now all we need to do is install...

The OOo Installation Script:

I put this script in "/usr/local/mfx/bin/mfxooosetup"... but you can find another happy home for it (and call it something that makes sense to you). We have two scripts that call it: one that sets up all users on our server and installs OOo for every one of them, and one that installs and configures a single user on a workstation (including an OOo installation for them). It can be invoked by hand quite easily. If you type "mfxooosetup" with no parameters or with the "--help" option, you get the help message:
Code:
mfxooosetup: Usage: mfxooosetup <userName> [<userInfo>] | --help
mfxooosetup: Usage: mfxooosetup [ --help | --version | --license ]
  Where <userName> is the Linux username of the user to perform the
  OpenOffice.org installation for (the user must already exist), and
  <userInfo> is an optional data file that contains the user
  information to be set. The <userInfo> file is a collection of
  <tag>=<value> pairs, one per line. Spaces should not be in the
  <tag>, but may be included within the <value>; leading and trailing
  whitespace is acceptable around both the <tag> and <value>. Recognized
  <tag>s are currently: "FirstName", "LastName", "UserID" (usually just
  the person's full set of initials), "Company", "WorkAddress",
  "WorkCity" (usually "City, State"), "WorkZipCode", and "PrimaryEmail".
  All other <tag>s will be silently ignored. "--help", "--version", and
  "--license" display the help (this message), version, and license info
  respectively, as you would expect...

And there's all you need to know to run it Wink... One of the funny (in a very unamusing way) about OOo-1.1.x is the facilities that are available as part of the "response" file (see below) are only a very small subset of the tags that can be set in the UserInfo registry. I will be investigating what can be done about that...

The "mfxooosetup" script is as follows (***Critical Note: It seems that the forum software strips tabs out of the posted text and replaces them with spaces... or at least that's the way it looks to me... all instances of regular expressions that seem to be a number of spaces between two square braces should actually be a space followed by a tab!!! These must be fixed after you've pasted the text for this script to work properly!):
Code:
#!/bin/bash
#
#**************************************************************************
#
#   Medformix OpenOffice "Headless Install" Package: Invocation Script
#
#**************************************************************************
#
# Copyright (c) 2004 Crowell Systems -- http://www.crowellsystems.com/
#
# This file is part of the Medformix OpenOffice "Headless Install" Package.
#
# The Medformix OpenOffice "Headless Install" Package is free software; you
# can redistribute it and/or modify it under the terms of the GNU General
# Public License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# The Medformix OpenOffice "Headless Install" Package is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with the Medformix OpenOffice "Headless Install" Package; if not, write to
# the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA or view it at "http://www.gnu.org/licenses/gpl.html".
#
#**************************************************************************
# Contributors:
#   jbotte: James Botte, jbotte@crowellsystems.com
#
# Changelog:
#   1.0.0: 09mar04: jbotte: Created.
#   1.0.1: 12mar04: jbotte: Added test for and used full path for "su".
#   1.1.0: 20jul04: jbotte: Modified to allow for user setup before
#     the symbolic link is switched over. Also did some cleanup and
#     better error checking.
#   1.1.1: 23jul04: jbotte: Added check to make sure that OOo link and
#     the mfxOOoResp version numbers match.
#   1.1.2: 23jul04: jbotte: Deleted /tmp/hsperfdata_<username> directories
#     created by the OOo setup program and not cleared. This has been
#     reported in a low priority OOo issue #32021.
#   1.1.3: 30jul04: jbotte: Fixed file deletion added in 1.1.2. Oops.
#   1.1.4: 06oct04: jbotte: Added indirection for base directory so it's
#     easier to install in places other than "/usr/local".
#**************************************************************************

MFX_VERSION="1.1.4"
MFX_COPYRIGHT_DATE="2004"

# Set to "1" for the output of debug and status information as it runs
#   (otherwise, just check the exit code for success[0] or failure[1])
MFX_DEBUG_ON="0"

# If any paths change, here's where to fix it...
MFX_SU=/bin/su
MFX_PS=/bin/ps
MFX_LS=/bin/ls
MFX_ID=/usr/bin/id
MFX_SED=/bin/sed
MFX_CUT=/bin/cut
MFX_CAT=/bin/cat
MFX_BASH=/bin/bash
MFX_GREP=/bin/grep
MFX_BASENAME=/usr/bin/basename

MFX_XVFB_RCD=/etc/rc.d/rc.xvfb

MFX_OOO_BASE=/usr/local

MFX_OOO_LINK=$MFX_OOO_BASE/OOo
MFX_OOO_RESP_FILE=$MFX_OOO_BASE/mfx/etc/mfxOOoResp

# Start off with an empty environment string to pass
MFX_SETUP_ENV=""

if [ ! -x $MFX_BASENAME ]; then
  if [ ! -e $MFX_BASENAME ]; then
    echo "$0: ERROR: Cannot find required program: $MFX_BASENAME..."
  else
    echo "$0: ERROR: No permission to execute required program: $MFX_BASENAME..."
  fi
  echo
  exit 1
fi

MFX_PROGNAME=`$MFX_BASENAME $0`

MFX_INFO="$MFX_PROGNAME: INFO"
MFX_ERROR="$MFX_PROGNAME: ERROR"
MFX_NOTICE="$MFX_PROGNAME: NOTICE"
MFX_WARNING="$MFX_PROGNAME: WARNING"

if [ ! -x $MFX_ID ]; then
  if [ ! -e $MFX_ID ]; then
    echo "$MFX_ERROR: Cannot find required program: $MFX_ID..."
  else
    echo "$MFX_ERROR: No permission to execute required program: $MFX_ID..."
  fi
  echo
  exit 1
fi

if [ ! -x $MFX_CUT ]; then
  if [ ! -e $MFX_CUT ]; then
    echo "$MFX_ERROR: Cannot find required program: $MFX_CUT..."
  else
    echo "$MFX_ERROR: No permission to execute required program: $MFX_CUT..."
  fi
  echo
  exit 1
fi

# Verify that we are running as root
MFX_USERNAME=`$MFX_ID | $MFX_CUT -d "(" -f2 | $MFX_CUT -d ")" -f1`

if [ $MFX_USERNAME != "root" ]; then
  echo "$MFX_ERROR: You must be user \"root\" to run this program..."
  exit 1
fi

# Make sure we are basically invoked okay
if [[ $# != 1 && $# != 2 || $1 == "--help" ]]; then
  echo "$MFX_PROGNAME: Usage: $MFX_PROGNAME <userName> [<userInfo>] | --help"
  echo "$MFX_PROGNAME: Usage: $MFX_PROGNAME [ --help | --version | --license ]"
  echo "  Where <userName> is the Linux username of the user to perform the"
  echo "  OpenOffice.org installation for (the user must already exist), and"
  echo "  <userInfo> is an optional data file that contains the user"
  echo "  information to be set. The <userInfo> file is a collection of"
  echo "  <tag>=<value> pairs, one per line. Spaces should not be in the"
  echo "  <tag>, but may be included within the <value>; leading and trailing"
  echo "  whitespace is acceptable around both the <tag> and <value>. Recognized"
  echo "  <tag>s are currently: \"FirstName\", \"LastName\", \"UserID\" (usually just"
  echo "  the person's full set of initials), \"Company\", \"WorkAddress\","
  echo "  \"WorkCity\" (usually \"City, State\"), \"WorkZipCode\", and \"PrimaryEmail\"."
  echo "  All other <tag>s will be silently ignored. \"--help\", \"--version\", and
  echo "  \"--license\"" display the help (this message), version, and license info"
  echo "  respectively, as you would expect..."
  exit 0
fi

if [[ $# != 1 && $# != 2 || $1 == "--version" ]]; then
  echo "$MFX_PROGNAME: This is $MFX_PROGNAME version $MFX_VERSION"
  echo "$MFX_PROGNAME: (c) $MFX_COPYRIGHT_DATE Crowell Systems. Please type the"
  echo "$MFX_PROGNAME: command \"$MFX_PROGNAME --license\" for license info."
  exit 0
fi

if [[ $# != 1 && $# != 2 || $1 == "--license" ]]; then
  echo "Copyright (c) 2004 Crowell Systems -- http://www.crowellsystems.com/"
  echo
  echo "This file is part of the Medformix OpenOffice \"Headless Install\" Package."
  echo
  echo "The Medformix OpenOffice \"Headless Install\" Package is free software; you"
  echo "can redistribute it and/or modify it under the terms of the GNU General"
  echo "Public License as published by the Free Software Foundation; either"
  echo "version 2 of the License, or (at your option) any later version."
  echo
  echo "The Medformix OpenOffice \"Headless Install\" Package is distributed in the"
  echo "hope that it will be useful, but WITHOUT ANY WARRANTY; without even the"
  echo "implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
  echo "See the GNU General Public License for more details."
  echo
  echo "You should have received a copy of the GNU General Public License along"
  echo "with the Medformix OpenOffice \"Headless Install\" Package; if not, write to"
  echo "the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,"
  echo "MA 02111-1307 USA or view it at \"http://www.gnu.org/licenses/gpl.html\"."
  exit 0
fi

# Now make sure that the operating environment is all there
if [ ! -r $MFX_OOO_RESP_FILE ]; then
  if [ ! -e $MFX_OOO_RESP_FILE ]; then
    echo "$MFX_ERROR: Cannot find required file: $MFX_OOO_RESP_FILE..."
  else
    echo "$MFX_ERROR: No permission to read required file: $MFX_OOO_RESP_FILE..."
  fi
  echo
  exit 1
fi

if [ ! -x $MFX_GREP ]; then
  if [ ! -e $MFX_GREP ]; then
    echo "$MFX_ERROR: Cannot find required program: $MFX_GREP..."
  else
    echo "$MFX_ERROR: No permission to execute required program: $MFX_GREP..."
  fi
  echo
  exit 1
fi

if [ ! -x $MFX_CAT ]; then
  if [ ! -e $MFX_CAT ]; then
    echo "$MFX_ERROR: Cannot find required program: $MFX_CAT..."
  else
    echo "$MFX_ERROR: No permission to execute required program: $MFX_CAT..."
  fi
  echo
  exit 1
fi

MFX_OOO_VERSION=`$MFX_CAT $MFX_OOO_RESP_FILE | \
  $MFX_GREP "^DestinationPath=<home>/.OOo-.*$" | \
  $MFX_CUT -d/ -f2 | $MFX_CUT -d- -f2`

MFX_OOO_SETUP="$MFX_OOO_BASE/OpenOffice.org$MFX_OOO_VERSION/program/setup"

if [ ! -r $MFX_OOO_SETUP ]; then
  if [ ! -e $MFX_OOO_SETUP ]; then
    echo "$MFX_ERROR: Cannot find required file: $MFX_OOO_SETUP..."
  else
    echo "$MFX_ERROR: No permission to read required file: $MFX_OOO_SETUP..."
  fi
  echo
  exit 1
fi

if [ ! -x $MFX_SU ]; then
  if [ ! -e $MFX_SU ]; then
    echo "$MFX_ERROR: Cannot find required program: $MFX_SU..."
  else
    echo "$MFX_ERROR: No permission to execute required program: $MFX_SU..."
  fi
  echo
  exit 1
fi

if [ ! -x $MFX_PS ]; then
  if [ ! -e $MFX_PS ]; then
    echo "$MFX_ERROR: Cannot find required program: $MFX_PS..."
  else
    echo "$MFX_ERROR: No permission to execute required program: $MFX_PS..."
  fi
  echo
  exit 1
fi

if [[ $# == 2 && ! -r $2 ]]; then
  if [ ! -e $2 ]; then
    echo "$MFX_ERROR: Cannot find required file: $2..."
  else
    echo "$MFX_ERROR: No permission to read required file: $2..."
  fi
  echo
  exit 1
fi

if [ ! -x $MFX_SED ]; then
  if [ ! -e $MFX_SED ]; then
    echo "$MFX_ERROR: Cannot find required program: $MFX_SED..."
  else
    echo "$MFX_ERROR: No permission to execute required program: $MFX_SED..."
  fi
  echo
  exit 1
fi

if [ ! -x $MFX_LS ]; then
  if [ ! -e $MFX_LS ]; then
    echo "$MFX_ERROR: Cannot find required program: $MFX_LS..."
  else
    echo "$MFX_ERROR: No permission to execute required program: $MFX_LS..."
  fi
  echo
  exit 1
fi

if [ ! -L $MFX_OOO_LINK ]; then
  if [ ! -e $MFX_OOO_LINK ]; then
    echo "$MFX_ERROR: Cannot find required symbolic link: $MFX_OOO_LINK..."
  else
    echo "$MFX_ERROR: $MFX_OOO_LINK must be a symbolic link!!!"
  fi
  echo
  exit 1
fi

MFX_OOO_LINKDEST=`$MFX_LS -l $MFX_OOO_LINK | $MFX_SED -e 's/^.*-> //' | $MFX_SED -e 's/\/$//'`
MFX_OOO_LINKDEST=`$MFX_BASENAME $MFX_OOO_LINKDEST`

if [[ "OpenOffice.org$MFX_OOO_VERSION" != $MFX_OOO_LINKDEST ]]; then
  echo "$MFX_ERROR: The OpenOffice.org version of the directory pointed to"
  echo "$MFX_ERROR: by the link $MFX_OOO_LINK (which is currently set to"
  echo "$MFX_ERROR: \"`$MFX_LS -l $MFX_OOO_LINK | $MFX_SED -e 's/^.*-> //'`\"), and the version"
  echo "$MFX_ERROR: specified on the \"DestinationPath\" line of the"
  echo "$MFX_ERROR: response file \"$MFX_OOO_RESP_FILE\" (currently"
  echo -n "$MFX_ERROR: set to \""
  echo -n   "`$MFX_CAT $MFX_OOO_RESP_FILE | $MFX_GREP "^DestinationPath=<home>/.OOo-.*$"`\") "
  echo      "*MUST* agree"
  if [ -L $MFX_OOO_RESP_FILE ]; then
    echo "$MFX_ERROR: with each other. Did you forget to set the link to the"
    echo "$MFX_ERROR: correct directory or point the link for the response file"
    echo "$MFX_ERROR: to the correct version of the file (it is currently"
    echo -n "$MFX_ERROR: pointing to \""
    echo      "`$MFX_LS -l $MFX_OOO_RESP_FILE | $MFX_SED -e 's/^.*-> //'`\")?"
  else
    echo "$MFX_ERROR: with each other. Did you forget to set the link to the"
    echo "$MFX_ERROR: correct directory or update the line in the response file?"
  fi
  echo
  exit 1
fi

if [[ $# == 2 ]]; then
  if $MFX_GREP "^[    ]*FirstName[    ]*=[    ]*..*$" $2 > /dev/null 2>/dev/null; then
    MFX_OOO_FIRSTNAME=`$MFX_GREP "^[    ]*FirstName[    ]*=[    ]*..*$" $2 2> /dev/null | \
      $MFX_SED 's/[ \t]*//;s/\(^FirstName[ \t]*=[ \t]*\)\(.*$\)/\2/;s/[ \t]*$//'`
    if [[ $MFX_DEBUG_ON != "0" ]]; then
      echo "$MFX_INFO: Setting FirstName = \"$MFX_OOO_FIRSTNAME\""
    fi
  fi

  if $MFX_GREP "^[    ]*LastName[    ]*=[    ]*..*$" $2 > /dev/null 2>/dev/null; then
    MFX_OOO_LASTNAME=`$MFX_GREP "^[    ]*LastName[    ]*=[    ]*..*$" $2 2> /dev/null | \
      $MFX_SED 's/[ \t]*//;s/\(^LastName[ \t]*=[ \t]*\)\(.*$\)/\2/;s/[ \t]*$//'`
    if [[ $MFX_DEBUG_ON != "0" ]]; then
      echo "$MFX_INFO: Setting LastName = \"$MFX_OOO_LASTNAME\""
    fi
  fi

  if $MFX_GREP "^[    ]*UserID[    ]*=[    ]*..*$" $2 > /dev/null 2>/dev/null; then
    MFX_OOO_USERID=`$MFX_GREP "^[    ]*UserID[    ]*=[    ]*..*$" $2 2> /dev/null | \
      $MFX_SED 's/[ \t]*//;s/\(^UserID[ \t]*=[ \t]*\)\(.*$\)/\2/;s/[ \t]*$//'`
    if [[ $MFX_DEBUG_ON != "0" ]]; then
      echo "$MFX_INFO: Setting UserID = \"$MFX_OOO_USERID\""
    fi
  fi

  if $MFX_GREP "^[    ]*Company[    ]*=[    ]*..*$" $2 > /dev/null 2>/dev/null; then
    MFX_OOO_COMPANY=`$MFX_GREP "^[    ]*Company[    ]*=[    ]*..*$" $2 2> /dev/null | \
      $MFX_SED 's/[ \t]*//;s/\(^Company[ \t]*=[ \t]*\)\(.*$\)/\2/;s/[ \t]*$//'`
    if [[ $MFX_DEBUG_ON != "0" ]]; then
      echo "$MFX_INFO: Setting Company = \"$MFX_OOO_COMPANY\""
    fi
  fi

  if $MFX_GREP "^[    ]*WorkAddress[    ]*=[    ]*..*$" $2 > /dev/null 2>/dev/null; then
    MFX_OOO_WORKADDRESS=`$MFX_GREP "^[    ]*WorkAddress[    ]*=[    ]*..*$" $2 2> /dev/null | \
      $MFX_SED 's/[ \t]*//;s/\(^WorkAddress[ \t]*=[ \t]*\)\(.*$\)/\2/;s/[ \t]*$//'`
    if [[ $MFX_DEBUG_ON != "0" ]]; then
      echo "$MFX_INFO: Setting WorkAddress = \"$MFX_OOO_WORKADDRESS\""
    fi
  fi

  if $MFX_GREP "^[    ]*WorkCity[    ]*=[    ]*..*$" $2 > /dev/null 2>/dev/null; then
    MFX_OOO_WORKCITY=`$MFX_GREP "^[    ]*WorkCity[    ]*=[    ]*..*$" $2 2> /dev/null | \
      $MFX_SED 's/[ \t]*//;s/\(^WorkCity[ \t]*=[ \t]*\)\(.*$\)/\2/;s/[ \t]*$//'`
    if [[ $MFX_DEBUG_ON != "0" ]]; then
      echo "$MFX_INFO: Setting WorkCity = \"$MFX_OOO_WORKCITY\""
    fi
  fi

  if $MFX_GREP "^[    ]*WorkZipCode[    ]*=[    ]*..*$" $2 > /dev/null 2>/dev/null; then
    MFX_OOO_WORKZIPCODE=`$MFX_GREP "^[    ]*WorkZipCode[    ]*=[    ]*..*$" $2 2> /dev/null | \
      $MFX_SED 's/[ \t]*//;s/\(^WorkZipCode[ \t]*=[ \t]*\)\(.*$\)/\2/;s/[ \t]*$//'`
    if [[ $MFX_DEBUG_ON != "0" ]]; then
      echo "$MFX_INFO: Setting WorkZipCode = \"$MFX_OOO_WORKZIPCODE\""
    fi
  fi

  if $MFX_GREP "^[    ]*PrimaryEmail[    ]*=[    ]*..*$" $2 > /dev/null 2>/dev/null; then
    MFX_OOO_PRIMARYEMAIL=`$MFX_GREP "^[    ]*PrimaryEmail[    ]*=[    ]*..*$" $2 2> /dev/null | \
      $MFX_SED 's/[ \t]*//;s/\(^PrimaryEmail[ \t]*=[ \t]*\)\(.*$\)/\2/;s/[ \t]*$//'`
    if [[ $MFX_DEBUG_ON != "0" ]]; then
      echo "$MFX_INFO: Setting PrimaryEmail = \"$MFX_OOO_PRIMARYEMAIL\""
    fi
  fi
fi

export STARTED_XDISPLAY="0"
if ! $MFX_PS ax | $MFX_GREP Xvfb | $MFX_GREP "/usr/X11/bin/Xvfb[    ]*:1" \
    > /dev/null 2> /dev/null ; then
  if [ ! -x $MFX_BASH ]; then
    if [ ! -e $MFX_BASH ]; then
      echo "$MFX_ERROR: Cannot find required program: $MFX_BASH..."
    else
      echo "$MFX_ERROR: No permission to execute required program: $MFX_BASH..."
    fi
    echo
    exit 1
  fi

  if [ ! -r $MFX_XVFB_RCD ]; then
    if [ ! -e $MFX_XVFB_RCD ]; then
      echo "$MFX_ERROR: Cannot find required file: $MFX_XVFB_RCD..."
    else
      echo "$MFX_ERROR: No permission to read required file: $MFX_XVFB_RCD..."
    fi
    echo
    exit 1
  fi

  if [[ $MFX_DEBUG_ON != "0" ]]; then
    if ! $MFX_BASH $MFX_XVFB_RCD start; then
      echo "$MFX_ERROR: Could not start the Xvfb server..."
      exit 1
    fi
  else
    if ! $MFX_BASH $MFX_XVFB_RCD start > /dev/null 2> /dev/null; then
      echo "$MFX_ERROR: Could not start the Xvfb server..."
      exit 1
    fi
  fi

  export STARTED_XDISPLAY="1"
fi

if [[ $MFX_DEBUG_ON != "0" ]]; then
  echo "$MFX_INFO: Starting installation of OpenOffice.org for user: $1..."
fi

# Build environment to pass to OOo setup program and response file
MFX_SETUP_ENV="export DISPLAY=localhost:1.0"
MFX_SETUP_ENV="$MFX_SETUP_ENV;export MFX_OOO_FIRSTNAME=\"$MFX_OOO_FIRSTNAME\""
MFX_SETUP_ENV="$MFX_SETUP_ENV;export MFX_OOO_LASTNAME=\"$MFX_OOO_LASTNAME\""
MFX_SETUP_ENV="$MFX_SETUP_ENV;export MFX_OOO_USERID=\"$MFX_OOO_USERID\""
MFX_SETUP_ENV="$MFX_SETUP_ENV;export MFX_OOO_COMPANY=\"$MFX_OOO_COMPANY\""
MFX_SETUP_ENV="$MFX_SETUP_ENV;export MFX_OOO_WORKADDRESS=\"$MFX_OOO_WORKADDRESS\""
MFX_SETUP_ENV="$MFX_SETUP_ENV;export MFX_OOO_WORKCITY=\"$MFX_OOO_WORKCITY\""
MFX_SETUP_ENV="$MFX_SETUP_ENV;export MFX_OOO_WORKZIPCODE=\"$MFX_OOO_WORKZIPCODE\""
MFX_SETUP_ENV="$MFX_SETUP_ENV;export MFX_OOO_PRIMARYEMAIL=\"$MFX_OOO_PRIMARYEMAIL\""

if ! $MFX_SU - $1 -c "$MFX_SETUP_ENV;$MFX_OOO_SETUP -r:$MFX_OOO_RESP_FILE"; then
  echo "$MFX_ERROR: Installation failed for user: $1..."
  MFX_EXIT_CODE=1
else
  if [[ $MFX_DEBUG_ON != "0" ]]; then
    echo "$MFX_NOTICE: Installation of OpenOffice.org complete for user: $1..."
  fi
  MFX_EXIT_CODE=0
fi

# Added due to OpenOffice issue #32021...
if [ -e /tmp/hsperfdata_$1 ]; then
  rm -rf /tmp/hsperfdata_$1
fi

if [[ $STARTED_XDISPLAY == "1" ]]; then
  if [[ $MFX_DEBUG_ON != "0" ]]; then
    if ! $MFX_BASH $MFX_XVFB_RCD stop; then
      echo "$MFX_WARNING: Could not stop the Xvfb server..."
      # Because the install is done, exit okay anyway...
      #   The Xvfb Server will be cleaned up on the next reboot...
    fi
  else
    if ! $MFX_BASH $MFX_XVFB_RCD stop > /dev/null 2> /dev/null; then
      echo "$MFX_WARNING: Could not stop the Xvfb server..."
      # Because the install is done, exit okay anyway...
      #   The Xvfb Server will be cleaned up on the next reboot...
    fi
  fi
fi

exit $MFX_EXIT_CODE

Make sure that all of the variables at the top of the script (e.g. MFX_XVFB_RCD, MFX_OOO_BASE, and MFX_OOO_RESP_FILE) are set to the correct values for your installation! Also, you might want to set MFX_DEBUG_ON="1" for the first few times you run it until you get used to the idea. If the installation was successful, "mfxooosetup" exits with a value of "0", otherwise, it exists with a value of "1". You can check this with the shell command "echo $?". As an aside, if you do want to install OOo in "/opt" instead, all you need to do is change MFX_OOO_BASE to "/opt" instead of "/usr/local". Also, you will need to set MFX_OOO_RESP_FILE to where you installed the setup files (on a generic system, this would likely be "/usr/local/etc/mfxOOoResp" instead of "$MFX_OOO_BASE/mfx/etc/mfxOOoResp").

The "response" file that works with the "mfxooosetup" script, I put in "/usr/local/mfx/etc/mfxOOoResp-1.1.2" and created the symbolic link "/usr/local/mfx/etc/mfxOOoResp" to it (this is to help support multiple installations on one system as part of upgrading, etc.)... it's up to you to find a happy place for it in your life (make sure to set the MFX_OOO_RESP_FILE line in "mfxooosetup" to point at it wherever it is!):
Code:
'**************************************************************************
'
'   Medformix OpenOffice "Headless Install" Package: Response File
'
'**************************************************************************
'
' Copyright (c) 2004 Crowell Systems -- http://www.crowellsystems.com/
'
' This file is part of the Medformix OpenOffice "Headless Install" Package.
'
' The Medformix OpenOffice "Headless Install" Package is free software; you
' can redistribute it and/or modify it under the terms of the GNU General
' Public License as published by the Free Software Foundation; either
' version 2 of the License, or (at your option) any later version.
'
' The Medformix OpenOffice "Headless Install" Package is distributed in the
' hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
' implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
' See the GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License along
' with the Medformix OpenOffice "Headless Install" Package; if not, write to
' the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
' MA 02111-1307 USA or view it at "http://www.gnu.org/licenses/gpl.html".
'
'**************************************************************************
' Contributors:
'   jbotte: James Botte, jbotte@crowellsystems.com
'
' ChangeLog:
'   1.0.0: 09mar04: jbotte: Created.
'**************************************************************************

[ENVIRONMENT]
InstallationMode=INSTALL_WORKSTATION
InstallationType=WORKSTATION
Migration=NO
DestinationPath=<home>/.OOo-1.1.2
LanguageList=01
StartProcedure=StartProc
EndProcedure=EndProc

[JAVA]
JavaSupport=PREINSTALLED_OR_NONE

[PROCEDURES]
Sub EndProc
End Sub

Sub StartProc
        Dim sFirstName As String, sLastName As String, sUserID As String
        Dim sCompany As String, sWorkAddress As String, sWorkCity As String
        Dim sWorkZipCode As String, sPrimaryEmail As String, sCustomerNumber As String

        sFirstName = environ("MFX_OOO_FIRSTNAME")
        sLastName = environ("MFX_OOO_LASTNAME")
        sUserID = environ("MFX_OOO_USERID")
        sCompany = environ("MFX_OOO_COMPANY")
        sWorkAddress = environ("MFX_OOO_WORKADDRESS")
        sWorkCity = environ("MFX_OOO_WORKCITY")
        sWorkZipCode = environ("MFX_OOO_WORKZIPCODE")
        sPrimaryEmail = environ("MFX_OOO_PRIMARYEMAIL")

        If sFirstName <> "" Then
                SetUserFirstName(sFirstName)
        End If

        If sLastName <> "" Then
                SetUserLastName(sLastName)
        End If

        If sUserID <> "" Then
                SetUserID(sUserID)
        End If

        If sCompany <> "" Then
                SetUserCompanyName(sCompany)
        End If

        If sWorkAddress <> "" Then
                SetUserStreet(sWorkAddress)
        End If

        If sWorkCity <> "" Then
                SetUserCity(sWorkCity)
        End If

        If sWorkZipCode <> "" Then
                SetUserZip(sWorkZipCode)
        End If

        If sPrimaryEmail <> "" Then
                SetUserEmail(sPrimaryEmail)
        End If
End Sub

Obviously, if you need to do more as part of your installation, this would be the place to do it...

And finally, here's a sample <userInfo> file that I used:
Code:
'**************************************************************************
'
'   Medformix OpenOffice "Headless Install" Package: Sample <userInfo> File
'
'**************************************************************************
'
' Copyright (c) 2004 Crowell Systems -- http://www.crowellsystems.com/
'
' This file is part of the Medformix OpenOffice "Headless Install" Package.
'
' The Medformix OpenOffice "Headless Install" Package is free software; you
' can redistribute it and/or modify it under the terms of the GNU General
' Public License as published by the Free Software Foundation; either
' version 2 of the License, or (at your option) any later version.
'
' The Medformix OpenOffice "Headless Install" Package is distributed in the
' hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
' implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
' See the GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License along
' with the Medformix OpenOffice "Headless Install" Package; if not, write to
' the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
' MA 02111-1307 USA or view it at "http://www.gnu.org/licenses/gpl.html".
'
'**************************************************************************
' Contributors:
'   jbotte: James Botte, jbotte@crowellsystems.com
'
' ChangeLog:
'   1.0.0: 09mar04: jbotte: Created.
'**************************************************************************

FirstName=James
LastName=Botte
UserID=jbotte
Company=Crowell Systems
WorkAddress=4235 South Stream Blvd.
WorkCity=Charlotte, NC
WorkZipCode=28217
PrimaryEmail=jbotte@crowellsystems.com

As it says in the "mfxooosetup" help message, there can be spaces before and after the <tag> and/or <value> and it will work fine anyway.

Running The Simple Installation:

Now that everything's in place you will need to create a user to test the installation (note: you must be root to run "mfxooosetup"). Let's assume the user is me... jbotte, as root you would type (change paths and stuff to match your installation... also, it doesn't matter what directory you are in when you enter the commands):
Code:
/usr/local/mfx/bin/mfxooosetup jbotte

This will create a subdirectory called ".OOo-1.1.2" in my home directory with the OOo workstation installation in it for the given user. From the get-go I will be able to execute the FlatMerge macros and will not be prompted to register OOo.

To populate my user information (this ends up in "$HOME/.OOo-1.1.2/user/registry/data/org/openoffice/UserProfile.xcu"), and assuming my <userInfo> file was "/usr/local/mfx/etc/mfxOOoInfo.jbotte", I would type:
Code:
/usr/local/mfx/bin/mfxooosetup jbotte /usr/local/mfx/etc/mfxOOoInfo.jbotte


A Few Last Notes
You may have noticed that the subdirectory I specify for the OOo installation is "$HOME/.OOo-1.1.2"... this allows multiple versions of OpenOffice.org to be installed and configured for each user. The file $HOME/.sversionrc maps the OpenOffice.org version number to the correct configuration subdirectory.

Also, if anyone is on Solaris, I'd appreciate knowing if this works there.

Also, if any brave souls want to port this to WindowsXP or such, please post or email me your results!

Note: I have also recently made a small change to mfxooosetup (and a bit of cleanup) that allows the user's "$HOME/.OOo-*" configuration subdirectories to be set up before the link "/usr/local/OOo" is changed atomically to point at the new version (i.e. it goes straight to the "/usr/local/OpenOffice.org*" directory rather than using the "/usr/local/OOo" directory like it used to). This ensures that there is no race condition or down time during the upgrade process, and the switchover really is made with the change of the single link.


Last edited by jbotte on Wed Oct 06, 2004 7:00 pm; edited 9 times in total
Back to top
View user's profile Send private message
jbotte
Power User
Power User


Joined: 27 Jan 2004
Posts: 57
Location: NC, USA

PostPosted: Tue Mar 16, 2004 7:31 am    Post subject: Linux: Automated OOo User Installation -- 4/4 Reply with quote

Upgrade:

Well, we had to do some testing with OOo 1.1.3, so I installed it onto our systems using this infrastructure and was very pleased at the results.
    I downloaded the "OOo_1.1.3_LinuxIntel_install.tar.gz" installation package for Linux. I put the package in "/usr/local/mfx" on my system... pick your happy place.

    As root, I untarred it ("tar -zxvf OOo_1.1.3_LinuxIntel_install.tar.gz") in a working directory (from "/usr/local/mfx", it created the subdirectory "/usr/local/mfx/OOo_1.1.3_LinuxIntel_install")

    I changed directory into "/usr/local/mfx/OOo_1.1.3_LinuxIntel_install" and did a "./setup -net" and did the "Standard Installation" into the directory "/usr/local/OpenOffice.org1.1.3"

    I then went in and added our macro libraries and made the changes to "/usr/local/OpenOffice1.1.3/share/registry/data/org/openoffice/Office/Common.xcu"

    Then I needed to create an appropriate "mfxOOoResp" response file. So I copied mfxOOoResp-1.1.2 to mfxOOoResp-1.1.3, edited the "DestinationPath" line so it would point to ".OOo-1.1.3" instead of ".OOo-1.1.2", and recreated the symbolic link "mfxOOoResp" to my new file.
    Code:
    cd /usr/local/mfx/etc
    cp mfxOOoResp-1.1.2 mfxOOoResp-1.1.3
    <... use your favourite editor on mfxOOoResp-1.1.3 ...>
    ln -sf mfxOOoResp-1.1.3 mfxOOoResp

      The "diff" betweeen the mfxOOoResp-1.1.2 and mfxOOoResp-1.1.3 files is:
      Code:
      *** mfxOOoResp-1.1.2    Tue Mar 16 09:17:58 2004
      --- mfxOOoResp-1.1.3  Tue Mar 16 09:18:33 2004
      ***************
      *** 35,41 ****
        InstallationMode=INSTALL_WORKSTATION
        InstallationType=WORKSTATION
        Migration=NO
      ! DestinationPath=<home>/.OOo-1.1.2
        LanguageList=01
        StartProcedure=StartProc
        EndProcedure=EndProc
      --- 35,41 ----
        InstallationMode=INSTALL_WORKSTATION
        InstallationType=WORKSTATION
        Migration=NO
      ! DestinationPath=<home>/.OOo-1.1.3
        LanguageList=01
        StartProcedure=StartProc
        EndProcedure=EndProc

    From that point, I was able to run the "mfxooosetup" to install OOo 1.1.3 for all the users on the system (in our case it was users root, and mfx000 through mfx512).
    Code:
    #!/bin/bash
    #
    #**************************************************************************
    #
    #   Medformix OpenOffice "Headless Install" Package: OOo User Install
    #
    #**************************************************************************
    #
    # Copyright (c) 2004 Crowell Systems -- http://www.crowellsystems.com/
    #
    # This file is part of the Medformix OpenOffice "Headless Install" Package.
    #
    # The Medformix OpenOffice "Headless Install" Package is free software; you
    # can redistribute it and/or modify it under the terms of the GNU General
    # Public License as published by the Free Software Foundation; either
    # version 2 of the License, or (at your option) any later version.
    #
    # The Medformix OpenOffice "Headless Install" Package is distributed in the
    # hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
    # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    # See the GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License along
    # with the Medformix OpenOffice "Headless Install" Package; if not, write to
    # the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
    # MA 02111-1307 USA or view it at "http://www.gnu.org/licenses/gpl.html".
    #
    #**************************************************************************
    # Contributors:
    #   jbotte: James Botte, jbotte@crowellsystems.com
    #
    # Changelog:
    #   1.0.0: 23jul04: jbotte: Created.

    oooVersion=`/bin/cat /usr/local/mfx/etc/mfxOOoResp | /bin/grep "^DestinationPath=<home>/.OOo-.*$" | /bin/cut -d/ -f2 | /bin/cut -d- -f2`

    if [ -e /root/.OOo-$oooVersion ]; then
      echo "NOTICE: OpenOffice.org $oooVersion is already installed for \"root\". Skipping."
    else
      echo "INFO: Installing OpenOffice.org $oooVersion for \"root\"..."
      /usr/local/mfx/bin/mfxooosetup root
    fi

    userNumber=0
    while [ "$userNumber" -lt "512" ]; do
      userName=mfx`/usr/bin/printf "%03d" $userNumber`

      if [ ! -d /home/$userName ]; then
        echo "NOTICE: /home/$userName does not exist... Skipping user."
        continue
      fi

      if [ -e /home/$userName/.OOo-$oooVersion ]; then
        echo "NOTICE: OpenOffice.org $oooVersion is already installed for \"$userName\". Skipping."
       else
        echo "INFO: Installing OpenOffice.org $oooVersion for \"$userName\"..."
        /usr/local/mfx/bin/mfxooosetup $userName
      fi

      userNumber=$((userNumber + 1))
    done
So from there, all I needed to do was change the "/usr/localOOo" link to point at the new install and I was good to go:
Code:
ln -sf /usr/local/OpenOffice.org1.1.3 /usr/local/OOo

To change back to using OOo 1.1.2 (which I needed to do to compare behaviour at one point), all I needed to do was change the link "/usr/local/OOo" to point back at "/usr/local/OpenOffice.org1.1.2" and all the users would use OOo-1.1.2 with their /home/<user>/.OOo-1.1.2 configuration directory. Very slick for OOo to do, IMHO (don't forget that I had a link "/usr/local/bin/soffice" that pointed at "/usr/local/OOo/program/soffice, so it would always run whatever was pointed to by "/usr/local/OOo")! The caveat is that each install created menu entries in KDE (presumably it would behave the same way in Gnome) and it got a bit cluttered. I'll be dealing with that and other upgrade/uninstall issues at some later point...

Distribution:

Another really nice feature is that it's really easy to distribute the new installation across a collection of workstations. All you need to do is tar up the installed files and the response files (the mfxOOoResp-x.x.x and the mfxOOoResp link that points to the current version being distributed) and untar them on the new machine, do user installs for every user you want to upgrade, and then change the /usr/local/OOo link to point at the new distribution. To tar it all up for distribution, I did the following:
Code:
cd /usr/local
tar -zcvf mfxOOo-1.1.3.tar.gz ./OpenOffice.org1.1.3 ./mfx/etc/mfxOOoResp*

Then, all I need to do is copy the tarball over to the destination system into "/usr/local", then untar it in "/usr/local":
Code:
ssh -l root <target_system>
cd /usr/local
scp root@<source_system>:/usr/local/mfxOOo-1.1.3.tar.gz .
tar -zxvf mfxOOo-1.1.3.tar.gz
mfxooosetup <username1>
mfxooosetup <username2>
...
<... or you could just write a script :wink: ...>
ln -sf OpenOffice.org1.1.3 OOo

Hope this saves someone some time...
Back to top
View user's profile Send private message
unsavory
General User
General User


Joined: 26 Mar 2006
Posts: 7

PostPosted: Sun Mar 26, 2006 9:34 am    Post subject: Thank you so much! Reply with quote

This might be the single best setup guide I have ever read. Thanks for your hard work on documenting this entire process.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Code Snippets All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group