--- /bin/rebaseall 2013-12-03 16:28:03.000000000 -0800 +++ /bin/rebaseall.dsb 2014-01-09 09:51:12.338413000 -0800 @@ -29,7 +29,7 @@ PATH=$(cd $tp2 && pwd):/usr/bin:/bin ProgramName=${0##*/} -ProgramOptions='48b:o:ps:tT:v' +ProgramOptions='48b:o:ps:tT:vw:' DefaultBaseAddress=0x70000000 DefaultOffset=0 DefaultTouch= @@ -41,7 +41,7 @@ # Define functions usage() { - echo "usage: ${ProgramName} [-b BaseAddress] [-o Offset] [-s DllSuffix] [-T FileList | -] [-4|-8] [-p] [-t] [-v]" + echo "usage: ${ProgramName} [-b BaseAddress] [-o Offset] [-s DllSuffix] [-T FileList | -] [-4|-8] [-p] [-t] [-v] [-w seconds]" exit 1 } @@ -60,6 +60,7 @@ Touch="${DefaultTouch}" NoDyn="${DefaultNoDyn}" Verbose="${DefaultVerbose}" +WaitSeconds=0 FileList="${DefaultFileList}" Suffixes="${DefaultSuffixes}" db_file_i386="/etc/rebase.db.i386" @@ -123,11 +124,15 @@ FileList="${OPTARG}";; v) Verbose="-v";; + w) + WaitSeconds="${OPTARG}";; \?) usage;; esac done +while : +do # Verify only ash or dash processes are running if [ "${check_for_dash_only}" != "no" ] then @@ -160,15 +165,25 @@ ProcessResult=$? ;; esac - if [ $ProcessResult -eq 0 -a -z "${RebaseDebug}" ] + # If none found, we're good to go. + if [ $ProcessResult -ne 0 -o -n "${RebaseDebug}" ] + then + break + fi + # Otherwise either quit or wait and retry. + if [ $WaitSeconds -eq 0 ] then echo "${ProgramName}: only ash or dash processes are allowed during rebasing" echo " Exit all Cygwin processes and stop all Cygwin services." echo " Execute ash (or dash) from Start/Run... or a cmd or command window." echo " Execute '/bin/rebaseall' from ash (or dash)." exit 2 + else + echo "${ProgramName}: Cygwin processes found, retry in $WaitSeconds seconds ..." + sleep $WaitSeconds fi fi +done # Check if rebase database already exists. database_exists="no"