pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg_alternatives, Darwin and locale



Christian Biere wrote:
> Louis Guillaume wrote:
> > Who knows when Apple will fix this? Maybe we can't wait!
> What is Apple supposed to fix? History?

I'm not Apple but maybe the attached patch fixes it? Not history of
course.

-- 
Christian
--- wrapper.sh.orig     2008-07-20 04:17:42.000000000 +0200
+++ wrapper.sh  2008-07-20 04:24:47.000000000 +0200
@@ -44,21 +44,18 @@
 else
     userfile=~/.pkg_alternatives/${wrapper}
 fi
-alternatives=$(cat ${userfile} __CONF_FILE__ __DB_FILE__ 2>/dev/null | \
-               grep -v "^#" | tr ' ' '�')
 
-found=
-for a in ${alternatives}; do
-    prog=$(echo ${a} | cut -d '�' -f 1)
-    if [ -x ${prog} ]; then
-        found=$(echo ${a} | tr '�' ' ')
-       break
-    fi
-done
+cat "${userfile}" __CONF_FILE__ __DB_FILE__ 2>/dev/null | \
+{
+    while read line
+    do
+        line="${line##\#*}"
+        prog="${line%%\ *}" 
+        if [ X != "X${prog}" ] && [ -x "${prog}" ]
+        then exec ${line} "${@}"
+        fi
+    done
 
-if [ -z "${found}" ]; then
     echo "${progname}: no alternatives found" 1>&2
     exit 1
-fi
-
-exec ${found} "${@}"
+}


Home | Main Index | Thread Index | Old Index