+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]
+
+Options:
+ --install-root <directorytoinstallto>
+ --rpm-archives <pathtorpms>
+ --install-packages <listofpackagestoinstall>
+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 ( ! startswithmm $option ); then
+ if [ "x$argcommand" == "xinstall-root" ]; then
+ InstallRoot=$option
+ elif [ "x$argcommand" == "xrpm-archives" ]; then
+ RPMArchives=$option
+ elif [ "x$argcommand" == "xinstall-packages" ]; then
+ if [ "x$installpackages" == "x" ]; then
+ installpackages=$option
+ else
+ installpackages="$installpackages $option"
+ fi
+ fi
+ else
+ if ( containsequals $option ); then
+ argcommand=${option%%=*}
+ argcommand=${argcommand##--}
+ option=${option##*=}
+
+ if [ "x$argcommand" == "xinstall-root" ]; then
+ InstallRoot=$option
+ elif [ "x$argcommand" == "xrpm-archives" ]; then
+ RPMArchives=$option
+ elif [ "x$argcommand" == "xinstall-packages" ]; then
+ installpackages=$option
+ else
+ echo "Unknown option $option"
+ exit 1
+ fi
+ else
+ if [ "x$option" == "x--help" ]; then
+ displayHelp 0
+ elif [ "x$option" == "x--install-root" ]; then
+ argcommand=${option##--}
+ elif [ "x$option" == "x--rpm-archives" ]; then
+ argcommand=${option##--}
+ elif [ "x$option" == "x--install-packages" ]; then
+ argcommand=${option##--}
+ installpackages=""
+ else
+ echo "Unknown option $option"
+ exit 1
+ fi
+ fi
+ fi
+done
+
+echo "Install Packages: $installpackages"
+echo "RPMArchives : $RPMArchives"
+echo "InstallRoot : $InstallRoot"
+