Package: imagej
Version: 1.39q-2
Severity: normal
Tags: patch

The imagej starter script contains several bugs:

* The script tries to symlink to macros even if they already exist in the
user's directory.  For example I prefer a customized StartupMacros.txt that
adds some new features.

* The script won't be able to symlink plugins or luts with spaces in the
filename, should they ever appear in the system directories (already fixed for
macros).

* The script gratuitously prints the usage message.

* The fix to #468173 is buggy.  There are still problems specifying image names
on the command line, because imagej is looking in the wrong directory.

The attached patch fixes all of these.


      
____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs
--- /usr/bin/imagej	2008-03-13 14:19:58.000000000 -0400
+++ bin/imagej	2008-03-13 14:01:45.000000000 -0400
@@ -113,7 +113,7 @@
 # create plugins,macro,tmp dirs 
 mkdir -p $ij_user_path/plugins 
 mkdir -p $ij_user_path/macros
-#mkdir -p $HOME/lut to understand
+mkdir -p $ij_user_path/luts
 
 # create imagej socket-lock directory if non existant 
 if [[ ! -d "$ij_tmp" ]] ; then
@@ -134,25 +134,26 @@
 
 # makes symbolik links from shared plugins, macros and luts 
 
-for p in $(ls /usr/share/imagej/plugins) ; do
-  if [ ! -h $ij_user_path/plugins/$p ] ; then
+ls /usr/share/imagej/plugins | while read p ; do
+  if [ ! -e "$ij_user_path/plugins/$p" ] ; then
     ln -s /usr/share/imagej/plugins/$p $ij_user_path/plugins/$p
   fi
 done
 
-ls -1 /usr/share/imagej/macros | while read p; do
-  if [ ! -h "$ij_user_path/macros/$p" ] ; then
+ls /usr/share/imagej/macros | while read p; do
+  if [ ! -e "$ij_user_path/macros/$p" ] ; then
       ln -s "/usr/share/imagej/macros/$p" "$ij_user_path/macros/$p"
   fi
 done
 
-for p in $(ls /usr/share/imagej/luts) ; do
-  if [ ! -h $ij_user_path/luts/$p ] ; then
-      ln -s /usr/share/imagej/luts/$p $ij_user_path/luts/$p
-  fi
+ls /usr/share/imagej/luts | while read p ; do
+    if [ ! -e "$ij_user_path/luts/$p" ] ; then
+	ln -s /usr/share/imagej/luts/$p $ij_user_path/luts/$p
+    fi
 done
 
 
+
 ##################### USAGE DESCRIPTION #####################
 
 function usage {
@@ -278,9 +279,9 @@
 	i=i+1
 done
 
-if (( "$#" == 0 )) ; then
-	usage
-fi	
+#if (( "$#" == 0 )) ; then
+#	usage
+#fi	
 
 # -b and -m options only:
 # remaining command line arguments are passed as macro arguments 
@@ -308,7 +309,7 @@
 ##################### USING PORT #####################
 
 # Creates a temp file indicating a port is in use by imagej
-cd "$ij_tmp"
+pushd "$ij_tmp" > /dev/null
 declare -i count=1
 portopen='false'
 lockFileCreated='false'
@@ -404,6 +405,8 @@
 
 ##################### FINALLY RUN IMAGEJ #####################
 
+popd > /dev/null
+
 if [ "$JAVA_HOME" ] ; then
 	if (( $verbosity > 0 )) ; then
 		echo ${modules}

Reply via email to