wineshelllink and winelauncher

Robert Lunnon bobl at optushome.com.au
Sun May 8 06:54:49 CDT 2005


Changelog:
tools/wineshellink
programs/winelauncher

Laurent Blume
Replace the test of the which command for type command to get similar 
behaviour on all OSes

Notes - As below
Take 2-
Laurent has reviewed the scripts and has suggested the following patch.



----------  Forwarded Message  ----------

Subject: Re: [solarisx86] Re: using wine on sun w2100z
Date: Sun, 8 May 2005 09:17 pm
From: Laurent Blume <laurent at elanor.org>
To: bobl at optushome.com.au

Well, now that I started actually thinking, I saw that the problem was rather
more simple than what I thought.
The script is testing the availability of commands by checking the return
 value of 'which'.
On GNU/Linux, it's 0 when it's found, 1 if not.
On Solaris, it's always 0.

I replaced it by 'type', which seems to work adequately on both GNU/Linux and
Solaris I've got available. And it's part of the Single UNIX Spec, so it's
behaviour should be rather consistant between Unices.

I grepped around, and found another occurrence of it in the winelauncher
 script, I changed it there too since it's a pretty straightforward change.

# diff -u wineshelllink.old  wineshelllink
--- wineshelllink.old   mer mai   4 11:47:30 2005
+++ wineshelllink       dim mai   8 13:01:40 2005
@@ -132,7 +132,7 @@

 # Debian/Mandrake

-which update-menus > /dev/null 2>&1
+type update-menus > /dev/null 2>&1
 if [ $? = 0 -a $mode = "menu" ]
 then
   iconname="`basename "$link"`.xpm"
@@ -158,7 +158,8 @@
 if [ -d "$HOME/.kde" ]
 then
   kdeversion=0
-  if which kde-config >/dev/null 2>&1
+  type kde-config >/dev/null 2>&1
+  if [ $? = 0 ]
   then
     kdeversion=`kde-config -v | grep KDE: | sed -n "s/^KDE:
 \([^.]*\)\..*$/\1/p"` fi
@@ -180,7 +181,7 @@
       kde_entry > "$HOME/.kde/share/applnk/Wine/$link.kdelnk"

       # KDE 1.x kludge.  Wake up KDE, if we can find kpanel running
-      which kwmcom >/dev/null 2>/dev/null && \
+      type kwmcom >/dev/null 2>/dev/null && \
         ps u -C kpanel >/dev/null 2>/dev/null && \
           kwmcom kpanel:restart

@@ -188,7 +189,7 @@
     then
       kde_entry > "$HOME/Desktop/$link.kdelnk"
       #   KDE 1.x kludge:  wake up KDE, if we can find kfm running...
-      which kfmclient >/dev/null 2>/dev/null && \
+      type kfmclient >/dev/null 2>/dev/null && \
         ps u -C kfm >/dev/null 2>/dev/null  && \
           kfmclient refreshDesktop
     fi


# diff -u  winelauncher.old  winelauncher
--- winelauncher.old    mar mai   3 21:58:42 2005
+++ winelauncher        dim mai   8 13:05:07 2005
@@ -93,7 +93,7 @@

 launch_winesetup()
 {
-    which winesetup
+    type winesetup
     if [ $? -eq 0 ] ; then
         winesetup
     else

-------------------------------------------------------



More information about the wine-patches mailing list