aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rwxr-xr-xutil/fluxbox-generate_menu.in19
1 files changed, 10 insertions, 9 deletions
diff --git a/util/fluxbox-generate_menu.in b/util/fluxbox-generate_menu.in
index d319098..b00db10 100755
--- a/util/fluxbox-generate_menu.in
+++ b/util/fluxbox-generate_menu.in
@@ -35,9 +35,11 @@
35# - don't use id -u or $UID, use whoami 35# - don't use id -u or $UID, use whoami
36# - getopts won't work on all platforms, but the config-file can 36# - getopts won't work on all platforms, but the config-file can
37# compensate for that. 37# compensate for that.
38# - OpenBSD and Solaris grep do not have the -m option 38# - OpenBSD and Solaris grep do not have the -m or -q options
39# - various software like grep/sed/perl may be not present or not 39# - various software like grep/sed/perl may be not present or not
40# the version you have. for example grep '\W' only works on gnu-grep. 40# the version you have. for example grep '\W' only works on gnu-grep.
41# - echo can lack several flags (notably -n) and might default to absent -e
42# In doubt, use printf
41# Keep this in mind, use bare basic defaults. 43# Keep this in mind, use bare basic defaults.
42# - Do _NOT_ suggest to use #!/bin/bash. Not everybody uses bash. 44# - Do _NOT_ suggest to use #!/bin/bash. Not everybody uses bash.
43# Non portable features like getopts in this script can be achieved in 45# Non portable features like getopts in this script can be achieved in
@@ -186,7 +188,6 @@ convertIcon(){
186 return 0; 188 return 0;
187 fi 189 fi
188 190
189 local BASENAME
190 BASENAME="${1##*/}" 191 BASENAME="${1##*/}"
191 192
192 # make sure it is an icon by checking if it has an extension 193 # make sure it is an icon by checking if it has an extension
@@ -246,7 +247,7 @@ removePath(){
246 247
247doSearchLoop(){ 248doSearchLoop(){
248 for ICONPATH in "$@"; do 249 for ICONPATH in "$@"; do
249 ## $dnlamVERBOSE ": $ICONPATH" >> $ICONMAPPING 250 # $dnlamVERBOSE ": $ICONPATH" >> $ICONMAPPING
250 [ -d "$ICONPATH" ] || continue 251 [ -d "$ICONPATH" ] || continue
251 #echo -n "." 252 #echo -n "."
252 # # $dnlamVERBOSE ":: $ICONPATH/$temp_icon" >> $ICONMAPPING 253 # # $dnlamVERBOSE ":: $ICONPATH/$temp_icon" >> $ICONMAPPING
@@ -257,7 +258,7 @@ doSearchLoop(){
257 # remove extension 258 # remove extension
258 iconNOext="${temp_icon%%.*}" 259 iconNOext="${temp_icon%%.*}"
259 [ -d "$ICONPATH" ] && for ICONEXT in .xpm .png .gif ; do 260 [ -d "$ICONPATH" ] && for ICONEXT in .xpm .png .gif ; do
260 ## echo "::: $ICONPATH/$iconNOext$ICONEXT" >> $ICONMAPPING 261 # echo "::: $ICONPATH/$iconNOext$ICONEXT" >> $ICONMAPPING
261 realpath=`find "$ICONPATH" -type f -name "$iconNOext$ICONEXT" | head -n 1` 262 realpath=`find "$ICONPATH" -type f -name "$iconNOext$ICONEXT" | head -n 1`
262 if [ -n "$realpath" ]; then 263 if [ -n "$realpath" ]; then
263 echo $realpath 264 echo $realpath
@@ -345,7 +346,7 @@ searchForIcon(){
345 # echo "^.${entry_exec}.[[:space:]]*<.*/${icon_base}\....>" 346 # echo "^.${entry_exec}.[[:space:]]*<.*/${icon_base}\....>"
346 if [ -f "$entry_icon" ]; then 347 if [ -f "$entry_icon" ]; then
347 # if icon exists and entry does not already exists, add it 348 # if icon exists and entry does not already exists, add it
348 if ! grep -q -m 1 "^.${execname}.[[:space:]]*<.*/${icon_base}\....>" $ICONMAPPING 2> /dev/null; then 349 if ! grep "^.${execname}.[[:space:]]*<.*/${icon_base}\....>" $ICONMAPPING > /dev/null 2>&1; then
349 printf "\"${execname}\" \t <${entry_icon}>\n" >> $ICONMAPPING 350 printf "\"${execname}\" \t <${entry_icon}>\n" >> $ICONMAPPING
350 else 351 else
351 : echo "# mapping already exists for ${execname}" >> $ICONMAPPING 352 : echo "# mapping already exists for ${execname}" >> $ICONMAPPING
@@ -417,7 +418,7 @@ lookupIcon() {
417 fi 418 fi
418 419
419 if [ -z "$iconString" ] && [ -z "$PARSING_DESKTOP" ] ; then 420 if [ -z "$iconString" ] && [ -z "$PARSING_DESKTOP" ] ; then
420 ## $dnlamVERBOSE "lookupIcon: Searching ... should only be needed for icons not gotten from *.desktop (manual-created ones): $execname" >&2 421 # $dnlamVERBOSE "lookupIcon: Searching ... should only be needed for icons not gotten from *.desktop (manual-created ones): $execname" >&2
421 searchForIcon "$execname" "$execname" 422 searchForIcon "$execname" "$execname"
422 [ -n "$entry_icon" ] && iconString="<$entry_icon>" 423 [ -n "$entry_icon" ] && iconString="<$entry_icon>"
423 fi 424 fi
@@ -432,7 +433,7 @@ append() {
432 iconString="`echo $* | grep -o '<.*>'`" 433 iconString="`echo $* | grep -o '<.*>'`"
433 # echo "iconString=$iconString" >&2 434 # echo "iconString=$iconString" >&2
434 if [ -z "$iconString" ] && [ -z "$NO_ICON" ]; then 435 if [ -z "$iconString" ] && [ -z "$NO_ICON" ]; then
435 echo -n " $* " >> ${MENUFILENAME} 436 printf " $* " >> ${MENUFILENAME}
436 # get the program name between '{}' from parameters 437 # get the program name between '{}' from parameters
437 execname="$*" 438 execname="$*"
438 execname=${execname#*\{} 439 execname=${execname#*\{}
@@ -576,7 +577,7 @@ WHOAMI=`whoami`
576[ "$WHOAMI" = root ] && PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin 577[ "$WHOAMI" = root ] && PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
577 578
578# Check for Imlib2-support 579# Check for Imlib2-support
579if @pkgprefix@fluxbox@pkgsuffix@@EXEEXT@ -info 2> /dev/null | grep -q "^IMLIB"; then 580if @pkgprefix@fluxbox@pkgsuffix@@EXEEXT@ -info 2> /dev/null | grep "^IMLIB" >/dev/null 2>&1; then
580 PNG_ICONS="yes" 581 PNG_ICONS="yes"
581else 582else
582 # better assume to assume "no" 583 # better assume to assume "no"
@@ -1473,7 +1474,7 @@ if [ -z "${INSTALL}" ] && [ -z "${NO_ICON}" ]; then
1473 1474
1474 checkDirs(){ 1475 checkDirs(){
1475 #echo checkDirs: $* >&2 1476 #echo checkDirs: $* >&2
1476 local CHECKED_DIRS="" 1477 CHECKED_DIRS=""
1477 for DIR in "$@"; do 1478 for DIR in "$@"; do
1478 if [ -d "$DIR" ]; then 1479 if [ -d "$DIR" ]; then
1479 # todo: should check if there are duplicates 1480 # todo: should check if there are duplicates