From: Brett Parker <arch@sommitrealweird.co.uk>
Date: Wed, 26 Jan 2005 18:54:27 +0000 (+0000)
Subject: Remove all hard coded commands
X-Git-Tag: release-0.9.3~8
X-Git-Url: https://git.sommitrealweird.co.uk/bpgallery.git/commitdiff_plain/0bb2d087e1a6e4faae87f028f454c278827d2a6d?ds=inline

Remove all hard coded commands

* All commands are now specifiable via the environment

git-archimport-id: arch@sommitrealweird.co.uk--2005-desktop/bpgallery--mainline--0.9.2--patch-2
---

diff --git a/bpgallery.sh b/bpgallery.sh
index d95049e..3d82851 100755
--- a/bpgallery.sh
+++ b/bpgallery.sh
@@ -41,12 +41,20 @@ if [[ -z $ECHOCOMMAND ]]; then
 	ECHOCOMMAND=/bin/echo
 fi
 
+if [[ -z $SORTCOMMAND ]]; then
+	SORTCOMMAND=/usr/bin/sort
+fi
+
+if [[ -z $IDENTIFYCOMMAND ]]; then
+	IDENTIFYCOMMAND=/usr/bin/identify
+fi
+
 if [[ -z $WIDTH ]]; then
 	WIDTH=100
 fi
 
 if [[ -z $IMAGEEXTENSIONS ]]; then
-	IMAGEEXTENSIONS="jpg gif png";
+	IMAGEEXTENSIONS="jpeg jpg gif png";
 fi
 
 FINDIMAGESOPTIONS=""
@@ -126,7 +134,7 @@ cat <<END > index.html
 END
 
 
-$FINDCOMMAND . $FINDIMAGESOPTIONS | $XARGSCOMMAND -0 --replace $ECHOCOMMAND {} |sort -g | sed -e 's#^./\(.*\)$#<div class="thumbnail"><a href="\1"><img src="icons/\1" /></a></div>#' >> index.html
+$FINDCOMMAND . $FINDIMAGESOPTIONS | $XARGSCOMMAND -0 --replace $ECHOCOMMAND {} |$SORTCOMMAND -g | sed -e 's#^./\(.*\)$#<div class="thumbnail"><a href="\1"><img src="icons/\1" /></a></div>#' >> index.html
 
 cat <<END >> index.html
 </body>
@@ -138,7 +146,7 @@ cd icons
 
 for imageext in $IMAGEEXTENSIONS; do
 	if ( ls "*.$imageext" > /dev/null 2>/dev/null ); then
-		TEMPMAX=$(identify *.jpg | grep "Geometry:" | sed -r 's#^.*Geometry:.*?[0-9]+x([0-9]+)\+.*$#\1#' | sort -g -r | head -n 1)
+		TEMPMAX=$($IDENTIFYCOMMAND *.$imageext | grep "Geometry:" | sed -r 's#^.*Geometry:.*?[0-9]+x([0-9]+)\+.*$#\1#' | $SORTCOMMAND -g -r | head -n 1)
 		if [[ $TEMPMAX -gt $MAXHEIGHT ]]; then
 			MAXHEIGHT=$TEMPMAX
 		fi