Add better support for ix86
[rpmbased-dist-chroot.git] / rpmbased-dist-chroot.sh
index 5aaf4eaef76cb4e11afda41fbdd6610f7e265bb4..7fd9a197336f2deaa5ae643b5c3797292513ed1d 100755 (executable)
@@ -31,6 +31,18 @@ ourcachedirectory=$(mktemp -d)
 architecture=$(uname -m)
 export ARCH=$architecture
 
+case $architecture in
+       i686)
+               architecture="i686,i586,i486,i386"
+               ;;
+       i586)
+               architecture="i586,i486,i386"
+               ;;
+       i486)
+               architecture="i486,i386"
+               ;;
+esac
+
 function displayHelp() {
 cat <<END
 Usage: $0 [options]
@@ -43,9 +55,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 +86,7 @@ for option in $@; do
                        fi
                fi
        else
-               if [[ $option =~ [=] ]]; then
+               if ( containsequals $option ); then
                        argcommand=${option%%=*}
                        argcommand=${argcommand##--}
                        option=${option##*=}
@@ -198,7 +226,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