3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 # This file incorporates work covered by the following license notice:
11 # Licensed to the Apache Software Foundation (ASF) under one or more
12 # contributor license agreements. See the NOTICE file distributed
13 # with this work for additional information regarding copyright
14 # ownership. The ASF licenses this file to you under the Apache
15 # License, Version 2.0 (the "License"); you may not use this file
16 # except in compliance with the License. You may obtain a copy of
17 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 GNOMEXCMDS
="/usr/bin/gksu"
21 GNOMECMDS
="/usr/bin/gnome-terminal /opt/gnome/bin/gnome-terminal"
22 KDEXCMDS
="/usr/bin/kdesu /opt/kde/bin/kdesu /opt/kde?/bin/kdesu"
23 KDECMDS
="/usr/bin/konsole /opt/kde/bin/konsole /opt/kde?/bin/konsole"
24 MISCCMDS
="/usr/bin/x-terminal-emulator /usr/X11/bin/xterm /usr/openwin/bin/xterm"
26 TITLE
='${PRODUCTNAME} update'
33 if [ "`basename $0`" = "update" ]; then
34 echo "Usage: `basename $0` [<path to ${PRODUCTNAME} installation>]"
42 # Always prefer mktemp when available
43 if [ -x "$MKTEMP" ]; then
44 "$MKTEMP" "/tmp/$1.XXXXXX"
54 # make_command_file - generate a command file to pass to xterm & co
58 TMPCMD
=`make_tempfile 'OpenOffice.org-Online-Update'`
62 cat >> $TMPCMD << \EOF
63 if [ $?
-eq 0 -a ! -z "$DISPLAY" ]; then
65 echo "Press <Enter> to close this window"
79 # run the command line passed as positional parameters either via
80 # gksu/kdesu or via su command in a terminal emulator.
86 case `basename $XTERM` in
91 "gnome-terminal" |
"konsole" |
"x-terminal-emulator")
97 case `basename $SU` in
111 ( echo "echo The application \"$@\" will update your ${PRODUCTNAME} installation."
113 echo "$SU" "$SUOPT" "$@"
114 ) | run_in_terminal
"$XTERM" "$TITLEOPT" "$TITLE" ${GEOMOPT}+300+300
119 ADMINFILE
=`make_tempfile 'LibreOffice-Online-Update-admin'`
121 cat >> $ADMINFILE << EOF
131 for i
in `cd $1; ls -d *`; do
132 pkginfo
-q $i && PKGLIST
="$PKGLIST $i"
135 pkgrm
-n -a $ADMINFILE $PKGLIST
136 pkgadd
-n -a $ADMINFILE -d $1 $PKGLIST
146 BASEDIR
="`dirname $0`"
147 ABSBASEDIR
="`cd $BASEDIR; pwd`"
149 if [ -z "$DISPLAY" ]; then
153 # define search order depending on the desktop in use ..
154 if [ "`uname -s`" = "SunOS" ]; then
155 XPROP
=/usr
/openwin
/bin
/xprop
156 GREP
=/usr
/xpg
4/bin
/grep
157 MKTEMP
=/usr
/bin
/mktemp
159 if [ -x /usr
/X11
/bin
/xprop
]; then
160 XPROP
=/usr
/X11
/bin
/xprop
168 # use desktop specific tools where possible, but prefer X11 su over terminal emulators
169 if $XPROP -root |
$GREP -q '^KWIN_RUNNING'; then
170 SULIST
="$KDEXCMDS $GNOMEXCMDS"
171 XTERMLIST
="$KDECMDS $MISCCMDS"
173 SULIST
="$GNOMEXCMDS $KDEXCMDS"
174 XTERMLIST
="$GNOMECMDS $MISCCMDS"
177 # search for the first available terminal emulator
178 for i
in $XTERMLIST; do
185 # we prefer gksu or kdesu if available
195 if [ "$CMD" = "update" ]; then
196 if [ $# -gt 0 ]; then
197 [ -d $1 -a $# -eq 1 ] || Usage
198 elevate
"$ABSBASEDIR/$CMD"
200 if [ -d "$BASEDIR/RPMS" ]; then
201 # do not use --hash as the control sequence to edit the current line does not work
202 # in our setup (at least not with kdesu)
203 rpm
-v --freshen `find "$BASEDIR"/RPMS -name '*.rpm'`
204 elif [ -d "$BASEDIR/DEBS" ]; then
205 dpkg
--install --selected-only --recursive "$BASEDIR"/DEBS
206 elif [ -d "$BASEDIR/packages" ]; then
207 update_pkg
"$BASEDIR/packages"