summaryrefslogtreecommitdiff
path: root/misc/openoffice-bin/files/install
blob: 434f290807c63e93c9ffe39bd2baa9737b371bd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#! /bin/sh

# should only be run local to the install directory
cd `dirname $0`

# Set the Defaults Here
oo_version="OpenOffice.org 1.1.5"
oo_home=OpenOffice.org1.1.5
oo_default_prefix=/usr/local
oo_default_netflg=-net
oo_default_interact=no


# these are the actual variables
prefix=$oo_default_prefix
netflg=$oo_default_netflg
interact=$oo_default_interact
installtype=INSTALL_NETWORK

# now parse the command line and interpret the options
oo_prev=
for oo_option
do

  # If the previous option needs an argument, assign it.
  if test -n "$oo_prev"; then
    eval "$oo_prev=\$oo_option"
    oo_prev=
    continue
  fi

  case "$oo_option" in
  -*=*) oo_optarg=`echo "$oo_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  *) oo_optarg= ;;
  esac

  case "$oo_option" in

  -? | -help | --help | --hel | --he)
    cat << EOF
Usage: install [options]
Options: [defaults in brackets after descriptions]
Configuration:
  --help                  print help message (this message)
  --version               print the version of OpenOffice.org to be installed
  --prefix=PREFIX         install OpenOffice.org into PREFIX [$oo_default_prefix]
  --single                install single user version of OpenOffice.org
  --interactive           install OpenOffice.org using interactive mode

EOF
    exit 0 ;;

  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
    oo_prev=prefix ;;
  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
    prefix="$oo_optarg" ;;

  -s | -single | --single | --singl | --singl | --sin | --si | --s)
    netflag= 
    installtype=INSTALL_NORMAL ;;

  -i | -interactive | --interactive | --interact | --intera | --inter)
    interact=yes ;;

  -version | --version | --versio | --versi | --vers)
    echo "$oo_version"
    exit 0 ;;

  -*) { echo "configure: error: $oo_option: invalid option; use --help to show usage" 1>&2; exit 1; }
    ;;

  esac
done

if test -n "$oo_prev"; then
  { echo "configure: error: missing argument to --`echo $oo_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
fi

# now for the actual installation

# if a single user install
if test "$installtype" = INSTALL_NORMAL; then

# Remove previous .sversionrc to prevent problems with previous versions
oo_versionrc="$HOME/.sversionrc"
#if [ -f "$oo_versionrc" ]; then
#  rm -f $oo_versionrc
#fi

# what should we do about prefix setting here if is was not set on the command 
# line (ie still the default of /usr/local change it to $HOME)
# perhaps change it to home directory? 
if test "$prefix" = /usr/local ; then
    prefix=$HOME
fi

fi


# create the proper autoresponse file
# we need to be careful of races in creating root files in /tmp
# for security reasons. 

# for more information, please see:
# www.dwheeler.com/secure-programs/Secure-Programs-HOWTO/avoid-race.html


#TMPFILE=`mktemp -q /tmp/$0.XXXXXX`
TMPD=/tmp/OOinstall.$$
mkdir -m 0700 ${TMPD}
if [ $? -ne 0 ]; then
     echo "$0: Can't create temp file, exiting..."
     exit 1
fi
TMPFILE=${TMPD}/inst_tmp
                                                              
cat << EOF >> ${TMPFILE} 
[ENVIRONMENT]
INSTALLATIONMODE=$installtype
INSTALLATIONTYPE=STANDARD
DESTINATIONPATH=$prefix/$oo_home
OUTERPATH=
LOGFILE=
LANGUAGELIST=<LANGUAGE>

[JAVA]
JavaSupport=preinstalled_or_none

EOF

# echo something to be patient
echo "Installation starting, please be patient ..."

# if interactive simply run setup with proper flags
# otherwise use the autoresponse file
case "$interact" in
  yes) 
      ./setup ${netflg} 
      ;;
  no) 
      ./setup -v -nogui -r:${TMPFILE}
      ;;
esac

# now clean up autoresponse file 
rm -fr ${TMPD}

# finish up
echo " "
echo "Installation Completed"