3 GNOMEXCMDS
="/usr/bin/gksu"
4 GNOMECMDS
="/usr/bin/gnome-terminal /opt/gnome/bin/gnome-terminal"
5 KDEXCMDS
="/usr/bin/kdesu /opt/kde/bin/kdesu /opt/kde?/bin/kdesu"
6 KDECMDS
="/usr/bin/konsole /opt/kde/bin/konsole /opt/kde?/bin/konsole"
7 MISCCMDS
="/usr/bin/x-terminal-emulator /usr/X11/bin/xterm /usr/openwin/bin/xterm"
9 TITLE
='${PRODUCTNAME} update'
16 if [ "`basename $0`" = "update" ]; then
17 echo "Usage: `basename $0` [<path to ${PRODUCTNAME} installation>]"
25 # Always prefer mktemp when available
26 if [ -x "$MKTEMP" ]; then
27 "$MKTEMP" "/tmp/$1.XXXXXX"
37 # make_command_file - generate a command file to pass to xterm & co
41 TMPCMD
=`make_tempfile 'OpenOffice.org-Online-Update'`
45 cat >> $TMPCMD << \EOF
46 if [ $?
-eq 0 -a ! -z "$DISPLAY" ]; then
48 echo "Press <Enter> to close this window"
62 # run the command line passed as positional parameters either via
63 # gksu/kdesu or via su command in a terminal emulator.
69 case `basename $XTERM` in
74 "gnome-terminal" |
"konsole" |
"x-terminal-emulator")
80 case `basename $SU` in
94 ( echo "echo The application \"$@\" will update your ${PRODUCTNAME} installation."
96 echo "$SU" "$SUOPT" "$@"
97 ) | run_in_terminal
"$XTERM" "$TITLEOPT" "$TITLE" ${GEOMOPT}+300+300
102 ADMINFILE
=`make_tempfile 'OpenOffice.org-Online-Update-admin'`
104 cat >> $ADMINFILE << EOF
114 for i
in `cd $1; ls -d *`; do
115 pkginfo
-q $i && PKGLIST
="$PKGLIST $i"
118 pkgrm
-n -a $ADMINFILE $PKGLIST
119 pkgadd
-n -a $ADMINFILE -d $1 $PKGLIST
129 BASEDIR
="`dirname $0`"
130 ABSBASEDIR
="`cd $BASEDIR; pwd`"
132 if [ -z "$DISPLAY" ]; then
136 # define search order depending on the desktop in use ..
137 if [ "`uname -s`" = "SunOS" ]; then
138 XPROP
=/usr
/openwin
/bin
/xprop
139 GREP
=/usr
/xpg
4/bin
/grep
140 MKTEMP
=/usr
/bin
/mktemp
142 if [ -x /usr
/X11
/bin
/xprop
]; then
143 XPROP
=/usr
/X11
/bin
/xprop
151 # use desktop specific tools where possible, but prefer X11 su over terminal emulators
152 if $XPROP -root |
$GREP -q '^KWIN_RUNNING'; then
153 SULIST
="$KDEXCMDS $GNOMEXCMDS"
154 XTERMLIST
="$KDECMDS $MISCCMDS"
156 SULIST
="$GNOMEXCMDS $KDEXCMDS"
157 XTERMLIST
="$GNOMECMDS $MISCCMDS"
160 # search for the first available terminal emulator
161 for i
in $XTERMLIST; do
168 # we prefer gksu or kdesu if available
178 if [ "$CMD" = "update" ]; then
179 if [ $# -gt 0 ]; then
180 [ -d $1 -a $# -eq 1 ] || Usage
181 elevate
"$ABSBASEDIR/$CMD"
183 if [ -d "$BASEDIR/RPMS" ]; then
184 # do not use --hash as the control sequence to edit the current line does not work
185 # in our setup (at least not with kdesu)
186 rpm
-v --freshen `find "$BASEDIR"/RPMS -name '*.rpm'`
187 elif [ -d "$BASEDIR/DEBS" ]; then
188 dpkg
--install --selected-only --recursive "$BASEDIR"/DEBS
189 elif [ -d "$BASEDIR/packages" ]; then
190 update_pkg
"$BASEDIR/packages"