From c5b67f9a42731e5841bfd40e41268ed308225b30 Mon Sep 17 00:00:00 2001 From: simonb Date: Mon, 17 Apr 2006 09:47:40 +0000 Subject: portability fixes for couple of shell scripts --- ChangeLog | 4 ++++ util/fbsetbg | 20 ++++++++++---------- util/startfluxbox.in | 14 +++++++------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7ab00d2..972b2f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ (Format: Year/Month/Day) Changes for 0.9.16: *06/04/17: + * Fix /bin/sh portability for fbsetbg and startfluxbox (Simon) + (fluxbox-generate_menu is seriously broken wrt portability + atm though :-/) + fbsetbg startfluxbox.in * Make autogen.sh properly /bin/sh portable (Simon) Fixes #1445464 autogen.sh diff --git a/util/fbsetbg b/util/fbsetbg index 5e58e19..b633222 100644 --- a/util/fbsetbg +++ b/util/fbsetbg @@ -46,8 +46,8 @@ # _NET_CURRENT_DESKTOP # The wallpapersetter is selected in this order -wpsetters=${wpsetters:=Esetroot wmsetbg feh hsetroot chbg display qiv xv xsri xli xsetbg} # broken icewmbg' -lastwallpaper=${HOME}/.fluxbox/lastwallpaper +wpsetters="${wpsetters:=Esetroot wmsetbg feh hsetroot chbg display qiv xv xsri xli xsetbg}" # broken icewmbg' +lastwallpaper="${HOME}/.fluxbox/lastwallpaper" WHOAMI=`whoami` @@ -200,8 +200,8 @@ if [ $# -eq 0 ]; then fi # create directory and last wallpaper file -if [ ! -d ~/.fluxbox ]; then - mkdir ~/.fluxbox +if [ ! -d "$HOME/.fluxbox" ]; then + mkdir "$HOME/.fluxbox" touch ${lastwallpaper} fi @@ -482,20 +482,20 @@ fi # random wallpaper code if [ "$option" = random ]; then # Lets make one thing clear... - wallpaperdir=$wallpaper + wallpaperdir="$wallpaper" if [ -z "$wallpaperdir" ]; then message "No random wallpaper directory specified." exit 1 fi if [ -d "$wallpaperdir" ]; then - number_of_wallpapers=`ls $wallpaperdir|wc -l` + number_of_wallpapers=`ls "$wallpaperdir"|wc -l` if find_it random_number; then - randomnumber=$(random_number) + randomnumber=`random_number` # some shells don't support $RANDOM - elif [ -z $RANDOM ]; then + elif [ -z "$RANDOM" ]; then randomnumber=`(echo $$ ;time ps; w ; date )2>&1 | cksum | cut -f1 -d' '` else - randomnumber=$RANDOM + randomnumber="$RANDOM" fi wallpapernumber=`expr $randomnumber % $number_of_wallpapers + 1` #remember previous wallpaper @@ -504,7 +504,7 @@ if [ "$option" = random ]; then fi remember=false #set -x - wallpaper="$wallpaperdir/`ls $wallpaperdir|sed -n ${wallpapernumber}p`" + wallpaper="$wallpaperdir/`ls \"$wallpaperdir\"|sed -n ${wallpapernumber}p`" option='$aspect' # have to choose something... else message "Invalid random wallpaper directory specified." diff --git a/util/startfluxbox.in b/util/startfluxbox.in index 920fb5e..6be6236 100755 --- a/util/startfluxbox.in +++ b/util/startfluxbox.in @@ -2,7 +2,7 @@ # $Id$ command="`basename \"$0\"`" -startup=~/.fluxbox/startup +startup="$HOME/.fluxbox/startup" while [ $# -gt 0 ]; do case "$1" in @@ -28,8 +28,8 @@ if [ -x "$startup" ]; then elif [ -r "$startup" ]; then exec sh "$startup" else - if [ ! -d ~/.fluxbox ]; then - mkdir -p ~/.fluxbox/backgrounds ~/.fluxbox/styles ~/.fluxbox/pixmaps + if [ ! -d "$HOME/.fluxbox" ]; then + mkdir -p "$HOME/.fluxbox/backgrounds" "$HOME/.fluxbox/styles" "$HOME/.fluxbox/pixmaps" fi if [ ! -r "$startup" ]; then ( cat << EOF @@ -40,7 +40,7 @@ else # You can set your favourite wallpaper here if you don't want # to do it from your style. # -# bsetbg -f ~/pictures/wallpaper.png +# bsetbg -f $HOME/pictures/wallpaper.png # # This sets a black background @@ -58,13 +58,13 @@ else # xset r rate 195 35 # # Your own fonts-dir: -# xset +fp $HOME/.font +# xset +fp "$HOME/.fonts" # # Your favourite mouse cursor: # xsetroot -cursor_name right_ptr # # Change your keymap: -# xmodmap ~/.Xmodmap +# xmodmap "$HOME/.Xmodmap" @@ -81,7 +81,7 @@ else exec @pkgbindir@/fluxbox # or if you want to keep a log: -# exec @pkgbindir@/fluxbox -log ~/.fluxbox/log +# exec @pkgbindir@/fluxbox -log "$HOME/.fluxbox/log" EOF ) > "$startup" fi -- cgit v0.11.2