Fix for olllllld bash
[rpmbased-dist-chroot.git] / rpmbased-dist-chroot.sh
index 5aaf4eaef76cb4e11afda41fbdd6610f7e265bb4..268fd4fe6998797c735661c8018ec576761ee557 100755 (executable)
@@ -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