From: Brett Parker Date: Mon, 12 Sep 2005 11:28:06 +0000 (+0000) Subject: Fix for olllllld bash X-Git-Url: https://git.sommitrealweird.co.uk/rpmbased-dist-chroot.git/commitdiff_plain/a6e03694cb18f3097f3117e5ec1340a25c46edeb?ds=inline;hp=2105183cee6c9fc558f86a34d5dd291fae495c24 Fix for olllllld bash Bash 2.05 does not include the =~ operator for regexps, so we get round this in inventive ways to overcome the shortfallings of a default debian sarge install (I really wish they'd made bash3 the default in that release!) git-archimport-id: arch@sommitrealweird.co.uk--2005-desktop/rpmbased-dist-chroot--mainline--0.1--patch-2 --- diff --git a/rpmbased-dist-chroot.sh b/rpmbased-dist-chroot.sh index 5aaf4ea..268fd4f 100755 --- a/rpmbased-dist-chroot.sh +++ b/rpmbased-dist-chroot.sh @@ -43,9 +43,25 @@ END exit $1 } +function startswithmm() { + if [ "${1##--*}" == "" ]; then + return 0 + else + return 1 + fi +} + +function containsequals() { + if [ "${1//*=*}" == "" ]; then + return 0 + else + return 1 + fi +} + argcommand="" for option in $@; do - if [[ ! $option =~ ^-- ]]; then + if ( ! startswithmm $option ); then if [ "x$argcommand" == "xinstall-root" ]; then InstallRoot=$option elif [ "x$argcommand" == "xrpm-archives" ]; then @@ -58,7 +74,7 @@ for option in $@; do fi fi else - if [[ $option =~ [=] ]]; then + if ( containsequals $option ); then argcommand=${option%%=*} argcommand=${argcommand##--} option=${option##*=} @@ -198,7 +214,9 @@ done read -p "Remove cache directory ($ourcachedirectory)? [Yn]: " cleanup -if [[ $cleanup =~ ^[Nn] ]]; then +cleanup=${cleanup:0:1} + +if [ "$cleanup" == "N" ] || [ "$cleanup" == "n" ] ; then echo leaving logs in $ourcachedirectory else echo removing logs directory