5 # Go to the proper setup directory (if not already there)
9 FATAL_ERROR
="Fatal error, no tech support email configured in this setup"
10 # try to get root prior to running setup?
12 # 1: prompt, but run anyway if fails
13 # 2: require, abort if root fails
16 # You may want to set USE_XHOST to 1 if you want an X11 application to
17 # be launched with root privileges right after installation
19 # this is the message for su call, printf
20 SU_MESSAGE
="You need to run this installation as the super user.\nPlease enter the root password."
22 if test -x /bin
/su
; then
29 # See if we have the XPG4 utilities (Solaris)
30 if test -d /usr
/xpg
4/bin
; then
31 PATH
=/usr
/xpg
4/bin
:$PATH
34 # Return the appropriate architecture string
57 arch
=`uname -p 2> /dev/null || uname -m`
58 if test "$arch" = powerpc
; then
69 # Return the appropriate version string
73 if [ `uname -s` != Linux
]; then
77 if [ -f `echo /lib/libc.so.6* | tail -n 1` ]; then
78 if fgrep GLIBC_2.1
/lib
/libc.so
.6* 2> $NULL >> $NULL; then
85 elif [ -f /lib
/libc.so
.5 ]; then
97 if test "$os" = "OpenUNIX"; then
105 # Detect the environment
112 # Import preferences from a secondary script
113 if [ -f setup.data
/config.sh
]; then
114 . setup.data
/config.sh
115 elif [ -f SETUP.DAT
/CONFIG.SH\
;1 ]; then
116 # HP-UX and other systems unable to get LFN correctly
117 . SETUP.DAT
/CONFIG.SH\
;1
120 # Add some standard paths for compatibility
123 # call setup with -auth when ran through su/xsu
125 if [ "$1" = "-auth" ]
133 # if root is absolutely required
134 # this happens if xsu/su execs setup.sh but it still doesn't have root rights
135 if [ "$GET_ROOT" -eq 2 ]
137 # NOTE TTimo: this causes the following error message in some cases:
138 # return: can only `return' from a function or sourced script
139 # BUT: in other cases, the return is legit, if you replace by an exit call, it's broken
144 # Find the installation program
145 # try_run [-absolute] [-fatal] INSTALLER_NAME [PARAMETERS_PASSED]
146 # -absolute option: if what you are trying to execute has an absolute path
147 # NOTE: maybe try_run_absolute would be easier
148 # -fatal option: if you want verbose messages in case
149 # - the script could not be found
150 # - it's execution would fail
151 # INSTALLER_NAME: setup.gtk or setup
152 # PARAMETERS_PASSED: additional arguments passed to the setup script
156 if [ "$1" = "-absolute" ]; then
162 # older bash < 2.* don't like == operator, using =
163 if [ "$1" = "-fatal" ]; then
172 # First find the binary we want to run
174 if [ "$absolute" -eq 0 ]
176 setup_bin
="setup.data/bin/$os/$arch/$libc/$setup"
178 if [ ! -f "$setup_bin" ]; then
179 setup_bin
="setup.data/bin/$os/$arch/$setup"
180 # libc dependant version failed, trying again
181 if [ ! -f "$setup_bin" ]; then
185 if [ "$failed" -eq 1 ]; then
186 if [ "$fatal" -eq 1 ]; then
188 This installation doesn't support $libc on $os / $arch
189 (tried to run $setup)
196 # Try to run the binary ($setup_bin)
197 # The executable is here but we can't execute it from CD
198 # NOTE TTimo: this is dangerous, we also use $setup to store the name of the try_run
199 setup
="$HOME/.setup$$"
201 cp "$setup_bin" "$setup"
203 trap "rm -f $setup" 1 2 3 15
205 # echo Running "$setup" "$@"
206 if [ "$fatal" -eq 0 ]; then
210 "$setup" "$@" 2>> $NULL
213 if [ "$absolute" -eq 0 ]
215 # don't attempt removal when we are passed an absolute path
216 # no, I don't want to imagine a faulty try_run as root on /bin/su
222 # if we have not been through the auth yet, and if we need to get root, then prompt
223 if [ "$auth" -eq 0 ] && [ "$GET_ROOT" -ne 0 ]
226 if [ "$GOT_ROOT" != "0" ]
228 if [ "$USE_XHOST" -eq 1 ]; then
229 xhost
+127.0.0.1 2> $NULL > $NULL
231 try_run xsu
-e -a -u root
-c "sh `pwd`/setup.sh -auth" $XSU_ICON
234 # if try_run successfully executed xsu, it will return xsu's exit code
235 # xsu returns 2 if ran and cancelled (i.e. the user 'doesn't want' to auth)
236 # it will return 0 if the command was executed correctly
237 # summing up, if we get 1, something failed
238 if [ "$status" -eq 0 ]
240 # the auth command was properly executed
242 elif [ "$status" -eq 1 ]
244 # xsu wasn't found, or failed to run
245 # if xsu actually ran and the auth was cancelled, $status is 2
247 printf "$SU_MESSAGE\n"
248 try_run
-absolute $SU_CMD root
-c "export DISPLAY=$DISPLAY;sh `pwd`/setup.sh -auth"
250 if [ "$status" -eq 0 ]; then
251 # the auth command was properly executed
256 elif [ "$status" -eq 3 ]
258 # the auth failed or was canceled
259 # we don't want to even start the setup if not root
260 echo "Please run this installation as the super user"
263 # continue running as is
267 # See if we can find the LGP update and uninstall tools
270 echo "$PATH" |
tr ':' '\n' |
sed -e 's/^$/./g' -e "s,~,$HOME," |
272 do if [ -f "$path/$1" -a -x "$path/$1" ]; then
279 # Try to run the setup program
280 try_run setup
$args $
*
282 if [ $status -eq 2 ] ||
[ $status -eq 127 ]; then # setup.gtk couldn't connect to X11 server - ignore
283 try_run setup
$args $
* ||
{
284 if [ $status -ne 2 ]; then
285 echo "The setup program seems to have failed on $arch/$libc"