diff options
author | Sami Kerola <kerolasa@iki.fi> | 2012-12-30 23:33:26 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2013-01-02 09:01:00 (GMT) |
commit | dcdfdfd56b5dbb6453062ad60876647b11433f18 (patch) | |
tree | 4181ed6355e779b77b25c1cfb11b5f1318a95e24 | |
parent | e15dfaf4639f7b46c55b414efac8dbd38629ae75 (diff) | |
download | fluxbox-dcdfdfd56b5dbb6453062ad60876647b11433f18.zip fluxbox-dcdfdfd56b5dbb6453062ad60876647b11433f18.tar.bz2 |
utils: remove bashisms
fbsetbg: The random number generation used 'time' shell internal, which
does not exist in all shells. Allowing 'ps' output to be part of cksum
input will increase entropy and enhance quality of the randomness.
fbsetbg: The second fix is more important. In posix shell there is no
'==' comparision operator.
fluxbox-generate_menu: There are no quarantees about echo accepting
options, so use 'printf' for more advanced outputing.
-rw-r--r-- | util/fbsetbg | 8 | ||||
-rwxr-xr-x | util/fluxbox-generate_menu.in | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/util/fbsetbg b/util/fbsetbg index 0bdb804..e277317 100644 --- a/util/fbsetbg +++ b/util/fbsetbg | |||
@@ -505,7 +505,11 @@ if [ "$option" = random ]; then | |||
505 | randomnumber=`random_number` | 505 | randomnumber=`random_number` |
506 | # some shells don't support $RANDOM | 506 | # some shells don't support $RANDOM |
507 | elif [ -z "$RANDOM" ]; then | 507 | elif [ -z "$RANDOM" ]; then |
508 | randomnumber=`(echo $$ ;time ps; w ; date )2>&1 | cksum | cut -f1 -d' '` | 508 | if [ -r /dev/urandom ]; then |
509 | randomnumber=`hexdump -n 2 -e '/2 "%u"' /dev/urandom` | ||
510 | else | ||
511 | randomnumber=`(echo $$; ps; w; date) 2>&1 | cksum | cut -f1 -d' '` | ||
512 | fi | ||
509 | else | 513 | else |
510 | randomnumber="$RANDOM" | 514 | randomnumber="$RANDOM" |
511 | fi | 515 | fi |
@@ -526,7 +530,7 @@ fi | |||
526 | 530 | ||
527 | 531 | ||
528 | if [ ! -r "$wallpaper" ]; then | 532 | if [ ! -r "$wallpaper" ]; then |
529 | if [ "$ignore_missing_wallpaper" == "true" ]; then | 533 | if [ "$ignore_missing_wallpaper" = "true" ]; then |
530 | exit 0 | 534 | exit 0 |
531 | fi | 535 | fi |
532 | message "Can't find wallpaper $wallpaper" | 536 | message "Can't find wallpaper $wallpaper" |
diff --git a/util/fluxbox-generate_menu.in b/util/fluxbox-generate_menu.in index 63c152e..eb6414c 100755 --- a/util/fluxbox-generate_menu.in +++ b/util/fluxbox-generate_menu.in | |||
@@ -331,7 +331,7 @@ searchForIcon(){ | |||
331 | if [ -f "$entry_icon" ]; then | 331 | if [ -f "$entry_icon" ]; then |
332 | # if icon exists and entry does not already exists, add it | 332 | # if icon exists and entry does not already exists, add it |
333 | if ! grep -q -m 1 "^.${entry_exec}.[[:space:]]*<.*/${icon_base}\....>" $ICONMAPPING 2> /dev/null; then | 333 | if ! grep -q -m 1 "^.${entry_exec}.[[:space:]]*<.*/${icon_base}\....>" $ICONMAPPING 2> /dev/null; then |
334 | echo -e "\"${entry_exec}\" \t <${entry_icon}>" >> $ICONMAPPING | 334 | printf "\"${entry_exec}\" \t <${entry_icon}>\n" >> $ICONMAPPING |
335 | else | 335 | else |
336 | : echo "# mapping already exists for ${entry_exec}" >> $ICONMAPPING | 336 | : echo "# mapping already exists for ${entry_exec}" >> $ICONMAPPING |
337 | fi | 337 | fi |