This is the mail archive of the
cygwin
mailing list for the Cygwin project.
rebaseall (temporary?) patch
- From: Christopher Faylor <cgf-no-personal-reply-please at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Fri, 8 Jul 2005 00:44:18 -0400
- Subject: rebaseall (temporary?) patch
- Reply-to: cygwin at cygwin dot com
The below patch to rebaseall will avoid errors when rebasing dlls used
by the shell which is executing it.
It might be interesting to automatically write a .bat file which
performed the final step of renaming the rebased in-use dlls to their
correct names but it's too late to do that.
cgf
--- /bin/rebaseall.orig 2004-03-12 08:49:18.000000000 -0500
+++ /bin/rebaseall 2005-07-08 00:38:13.765660000 -0400
@@ -1,5 +1,4 @@
#!/bin/bash
-
#
# Copyright (c) 2003 Jason Tishler
#
@@ -33,7 +32,7 @@
cleanup()
{
- rm -f $TmpFile
+ rm -f $TmpFile $InUseDlls
exit 0
}
@@ -87,11 +86,28 @@
# Set temp file
TmpFile=$TmpDir/rebase.lst
+InUseDlls=$TmpDir/rball.$$
+
+me=`readlink /proc/$$/exe`
+
+for f in `case "$me" in
+ *.exe) cygcheck "$me" ;;
+ *) cygcheck "$me".exe ;;
+esac`; do
+ cygpath -u $f
+done | grep -E '^/(bin|usr/bin).*\.dll' > $InUseDlls
+
+for f in `cat $InUseDlls`; do
+ case "$f" in
+ */cygwin1.dll) ;;
+ *) cp -p $f $f.rebased; echo $f.rebased ;;
+ esac
+done > $TmpFile
# Create rebase list
# FIXME: Remove ugly Apache hack ASAP
zcat /etc/setup/*.lst.gz | grep 'dll$' |
- sed -e '/cygwin1.dll$/d' -e 's/^/\//' -e 's/apache\/new/apache/' >$TmpFile
+ sed -e '/cygwin1.dll$/d' -e 's/^/\//' -e 's/apache\/new/apache/' | fgrep -v -f $InUseDlls >>$TmpFile
# Append user supplied file list, if any
if [ -n "$FileList" ]
@@ -102,5 +118,16 @@
# Rebase files
rebase $Verbose -d -b $BaseAddress -o $Offset -T $TmpFile
+if [ -s $InUseDlls ]; then
+ rename=`cygpath -w /bin/rename.exe`
+ echo "$0: Some dlls were not rebased because they were in use.
+
+Exit all cygwin processes and type:
+
+ $rename .rebased \"\" /bin/*.rebased
+
+to complete the rebaseall process"
+fi
+
# Clean up
cleanup
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/