aboutsummaryrefslogtreecommitdiff
path: root/util/fbsetbg
diff options
context:
space:
mode:
authorSami Kerola <kerolasa@iki.fi>2012-12-30 23:33:26 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2013-01-02 09:01:00 (GMT)
commitdcdfdfd56b5dbb6453062ad60876647b11433f18 (patch)
tree4181ed6355e779b77b25c1cfb11b5f1318a95e24 /util/fbsetbg
parente15dfaf4639f7b46c55b414efac8dbd38629ae75 (diff)
downloadfluxbox_pavel-dcdfdfd56b5dbb6453062ad60876647b11433f18.zip
fluxbox_pavel-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.
Diffstat (limited to 'util/fbsetbg')
-rw-r--r--util/fbsetbg8
1 files changed, 6 insertions, 2 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
528if [ ! -r "$wallpaper" ]; then 532if [ ! -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"