From: Brett Parker Date: Mon, 12 Jun 2006 19:09:07 +0000 (+0000) Subject: Fix xargs for a BSD environment X-Git-Tag: release-1.1.0~5 X-Git-Url: https://git.sommitrealweird.co.uk/bpgallery.git/commitdiff_plain/5da939c907eff9831f8a9140b8589f51b7bbf07a Fix xargs for a BSD environment Change --replace to -I {} so that the xargs commands work in a BSD environment. git-archimport-id: arch@sommitrealweird.co.uk--2005-desktop/bpgallery--mainline--1.1--patch-2 --- diff --git a/bpgallery.sh b/bpgallery.sh index 955cb71..4cc7450 100755 --- a/bpgallery.sh +++ b/bpgallery.sh @@ -362,8 +362,8 @@ END function generate_resized_images() { $ECHOCOMMAND "Generating $2" currentimage=0 - totalimages=$($FINDCOMMAND . $FINDIMAGESOPTIONS | $XARGSCOMMAND -0 --replace $ECHOCOMMAND {} | $WCCOMMAND); - imagestoupdate=$($FINDCOMMAND . $FINDIMAGESOPTIONS | $XARGSCOMMAND -0 --replace $ECHOCOMMAND {} | while read filename; do filename=${filename//\"/\\\"}; if [ ! -r "$2/$filename" ] || [ "$filename" -nt "$2/$filename" ] || [ $($IDENTIFYCOMMAND -format "%w" "$2/$filename") -ne $1 ]; then $ECHOCOMMAND $filename; fi; done | $WCCOMMAND) + totalimages=$($FINDCOMMAND . $FINDIMAGESOPTIONS | $XARGSCOMMAND -0 -I {} $ECHOCOMMAND {} | $WCCOMMAND); + imagestoupdate=$($FINDCOMMAND . $FINDIMAGESOPTIONS | $XARGSCOMMAND -0 -I {} $ECHOCOMMAND {} | while read filename; do filename=${filename//\"/\\\"}; if [ ! -r "$2/$filename" ] || [ "$filename" -nt "$2/$filename" ] || [ $($IDENTIFYCOMMAND -format "%w" "$2/$filename") -ne $1 ]; then $ECHOCOMMAND $filename; fi; done | $WCCOMMAND) if [ $totalimages -eq $imagestoupdate ]; then $ECHOCOMMAND "Regenerating all $2" @@ -374,7 +374,7 @@ function generate_resized_images() { $ECHOCOMMAND "Generating $imagestoupdate of $totalimages $2" fi - $FINDCOMMAND . $FINDIMAGESOPTIONS | $XARGSCOMMAND -0 --replace $ECHOCOMMAND {} | while read filename; do tempfilename=${filename//\"/\\\"/}; if [ ! -r "$2/$tempfilename" ] || [ "$tempfilename" -nt "$2/$tempfilename" ] || [ $($IDENTIFYCOMMAND -format "%w" "$2/$filename") -ne $1 ]; then $ECHOCOMMAND -n $filename; $ECHOCOMMAND -n -e "\000"; fi; done | $XARGSCOMMAND -0 --verbose --max-procs=4 --replace $CONVERTTOOL -resize $1 '{}' $2/'{}' 2>&1 | while read throwout; do $ECHOCOMMAND done: $currentimage/$imagestoupdate images; currentimage=$((currentimage+1)); done + $FINDCOMMAND . $FINDIMAGESOPTIONS | $XARGSCOMMAND -0 -I {} $ECHOCOMMAND {} | while read filename; do tempfilename=${filename//\"/\\\"/}; if [ ! -r "$2/$tempfilename" ] || [ "$tempfilename" -nt "$2/$tempfilename" ] || [ $($IDENTIFYCOMMAND -format "%w" "$2/$filename") -ne $1 ]; then $ECHOCOMMAND -n $filename; $ECHOCOMMAND -n -e "\000"; fi; done | $XARGSCOMMAND -0 --verbose --max-procs=4 -I {} $CONVERTTOOL -resize $1 '{}' $2/'{}' 2>&1 | while read throwout; do $ECHOCOMMAND done: $currentimage/$imagestoupdate images; currentimage=$((currentimage+1)); done $ECHOCOMMAND done: $imagestoupdate/$imagestoupdate images $ECHOCOMMAND "Completed generating $2 for $totalimages images" } @@ -430,7 +430,7 @@ function generate_pages() { fi $FINDCOMMAND . $FINDIMAGESOPTIONS | \ - $XARGSCOMMAND -0 --replace $ECHOCOMMAND {} | \ + $XARGSCOMMAND -0 -I {} $ECHOCOMMAND {} | \ $SORTCOMMAND -g | \ while read imagefilename; do previousimage=$currentimage @@ -591,7 +591,7 @@ if [ $GENERATEPAGESFORMEDIUMSIZE != 0 ]; then extra=__medium fi -$FINDCOMMAND . $FINDIMAGESOPTIONS | $XARGSCOMMAND -0 --replace $ECHOCOMMAND {} |$SORTCOMMAND -g | while read filename; do filename=${filename#./}; if [ -r captions.txt ]; then caption=$($GREPCOMMAND -E "^$filename " captions.txt); caption=${caption#* }; else caption=""; fi; if [ $GENERATEPAGESFORFULLSIZE != 0 ]; then link=$(bpgallery_escape_url "${filename}${extra}.html"); else link=$(bpgallery_escape_url "$filename"); fi; filename=$(bpgallery_escape_url "$filename"); $BPGALLERY_THUMBSLINE_FUNCTION; done >> ${INDEXDOCUMENT} +$FINDCOMMAND . $FINDIMAGESOPTIONS | $XARGSCOMMAND -0 -I {} $ECHOCOMMAND {} |$SORTCOMMAND -g | while read filename; do filename=${filename#./}; if [ -r captions.txt ]; then caption=$($GREPCOMMAND -E "^$filename " captions.txt); caption=${caption#* }; else caption=""; fi; if [ $GENERATEPAGESFORFULLSIZE != 0 ]; then link=$(bpgallery_escape_url "${filename}${extra}.html"); else link=$(bpgallery_escape_url "$filename"); fi; filename=$(bpgallery_escape_url "$filename"); $BPGALLERY_THUMBSLINE_FUNCTION; done >> ${INDEXDOCUMENT} $BPGALLERY_TAIL_FUNCTION >> ${INDEXDOCUMENT}