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.
Sami Kerola kerolasa@iki.fi
2 files changed,
7 insertions(+),
3 deletions(-)
M
util/fbsetbg
→
util/fbsetbg
@@ -505,7 +505,11 @@ if find_it random_number; then
randomnumber=`random_number` # some shells don't support $RANDOM elif [ -z "$RANDOM" ]; then - randomnumber=`(echo $$ ;time ps; w ; date )2>&1 | cksum | cut -f1 -d' '` + if [ -r /dev/urandom ]; then + randomnumber=`hexdump -n 2 -e '/2 "%u"' /dev/urandom` + else + randomnumber=`(echo $$; ps; w; date) 2>&1 | cksum | cut -f1 -d' '` + fi else randomnumber="$RANDOM" fi@@ -526,7 +530,7 @@ fi
if [ ! -r "$wallpaper" ]; then - if [ "$ignore_missing_wallpaper" == "true" ]; then + if [ "$ignore_missing_wallpaper" = "true" ]; then exit 0 fi message "Can't find wallpaper $wallpaper"