+function displayHelp() {
+cat <<END
+Usage: $0 [options]
+
+Options:
+ --install-root <directorytoinstallto>
+ --rpm-archives <pathtorpms>
+ --install-packages <listofpackagestoinstall>
+END
+ exit $1
+}
+
+argcommand=""
+for option in $@; do
+ if [[ ! $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 [[ $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"
+