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
+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
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
if [ "x$argcommand" == "xinstall-root" ]; then
InstallRoot=$option
elif [ "x$argcommand" == "xrpm-archives" ]; then
- if [[ $option =~ [=] ]]; then
+ if ( containsequals $option ); then
argcommand=${option%%=*}
argcommand=${argcommand##--}
option=${option##*=}
argcommand=${option%%=*}
argcommand=${argcommand##--}
option=${option##*=}
read -p "Remove cache directory ($ourcachedirectory)? [Yn]: " cleanup
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
echo leaving logs in $ourcachedirectory
else
echo removing logs directory