Subject: pkg/33027: x11/xfce4-utils - xinitrc cleanup (Solaris issues)
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <segv@netctl.net>
List: pkgsrc-bugs
Date: 03/07/2006 23:00:01
>Number:         33027
>Category:       pkg
>Synopsis:       x11/xfce4-utils - xinitrc cleanup (Solaris issues)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 07 23:00:00 +0000 2006
>Originator:     segv
>Release:        
>Organization:
>Environment:
SunOS e450-lan 5.11 snv_28 sun4u sparc SUNW,Ultra-4

>Description:
I run xfce4 on OpenSolaris and noticed that the 'xinitrc' script from x11/xfce4-utils, that gets installed into $LOCALBASE/etc/xdg/xfce4/ directory, has a few issues.
>How-To-Repeat:

>Fix:
The following patch fixes 'id -u' issue on Solaris and suggests some minor improvements to 'xinitrc' script:

--- xinitrc.orig        Mon Mar  6 23:36:37 2006
+++ xinitrc     Mon Mar  6 23:36:29 2006
@@ -1,8 +1,13 @@
 #!/bin/sh
 
 # fix broken $UID on some system...
+OPSYS=`uname -s`
+case "$OPSYS" in
+       *SunOS*) ID_EXEC=/usr/xpg4/bin/id ;;
+       *) ID_EXEC=id ;;
+esac
 if test "x$UID" = "x"; then
-       UID=`id -u`
+       UID=`$ID_EXEC -u`
 fi
 
 # create temp file for X resources
@@ -55,15 +60,15 @@
 # so it populates the environment here, so we can clean it up later.
 sshagent=`which ssh-agent`
 kill_sshagent=0
-if test -z "$SSH_AGENT_PID" -a "$sshagent" -a "x$sshagent" != "xno"; then
+if test x"$SSH_AGENT_PID" = "x" -a -f "$sshagent"; then
        eval `$sshagent -s`
        kill_sshagent=1
 fi
 
 # Use dbus-launch if installed.
-if test x"$DBUS_SESSION_BUS_ADDRESS" = x""; then
+if test x"$DBUS_SESSION_BUS_ADDRESS" = "x"; then
        dbuslaunch=`which dbus-launch`
-       if test x"$dbuslaunch" != x"" -a x"$dbuslaunch" != x"no"; then
+       if test -f "$dbuslaunch"; then
                eval `$dbuslaunch --sh-syntax --exit-with-session`
        fi
 fi
@@ -70,20 +75,13 @@
 
 # Run xfce4-session if installed
 xfcesm=`which xfce4-session`
-case "x$xfcesm" in
-       x|xno*)
-               ;;
-       *)
-               $xfcesm
+if test -f "$xfcesm"; then
+       $xfcesm
+       test $kill_sshagent -eq 1 && eval `$sshagent -k`
+       exit 0
+fi
 
-               if test $kill_sshagent -eq 1; then
-                       eval `$sshagent -k`
-               fi
-               exit 0
-               ;;
-esac
 
-
 ##################
 # IMPORTANT NOTE #
 ##################
@@ -115,38 +113,32 @@
   done
 fi
 
-xftaskbar4&
-xfdesktop&
+xftaskbar4 &
+xfdesktop &
 xfcalendar &
 
 panel=`which xfce4-panel`
-case "x$panel" in
-       x|xno*)
-               ;;
-       *)
-               $panel
-               ret=$?
-               while test $ret -ne 0; do
-                       xmessage -center -file - -timeout 20 -title Error <<EOF
+if test -f "$xfcesm"; then
+       $panel
+       ret=$?
+       while test $ret -ne 0; do
+               xmessage -center -file - -timeout 20 -title Error <<EOF
 A crash occured in the panel
 Please report this to the xfce4-dev@xfce.org list
 or on http://bugs.xfce.org
 Meanwhile the panel will be restarted
 EOF
-                       cat >&2 <<EOF
+               cat >&2 <<EOF
 A crash occured in the panel
 Please report this to the xfce4-dev@xfce.org list
 or on http://bugs.xfce.org
 Meanwhile the panel will be restarted
 EOF
-                       $panel
-                       ret=$?
-               done
-               ;;
-esac
-
-if test $kill_sshagent -eq 1; then
-       eval `$sshagent -k`
+               $panel
+               ret=$?
+       done
 fi
 
+test $kill_sshagent -eq 1 && eval `$sshagent -k`
+
 xsetroot -bg white -fg red  -solid black -cursor_name watch