[m-dev.] For review: improve mercury_cleanup_install
Warwick Harvey
wharvey at cs.monash.edu.au
Tue Jan 11 20:04:24 AEDT 2000
Estimated hours taken: 4 (mostly testing ;-)
`mercury_cleanup_install' is currently called from during the standard
install process if there's an error. However, if this process is being done
from the second stage bootcheck directory, `mercury_cleanup_install' doesn't
work correctly, as it ignores symbolic links. This change fixes this.
scripts/mercury_cleanup_install:
Add support for following symbolic links. This includes gracefully
skipping a directory if it's already been cleaned up, due to
symbolic links resulting in aliasing.
(Note: whitespace-only changes suppressed in this diff: the indenting looks
fine in the "real" version.)
Index: scripts/mercury_cleanup_install
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/mercury_cleanup_install,v
retrieving revision 1.1
diff -u -b -r1.1 mercury_cleanup_install
--- scripts/mercury_cleanup_install 1999/10/21 14:36:34 1.1
+++ scripts/mercury_cleanup_install 2000/01/11 08:58:06
@@ -42,8 +42,11 @@
cleanup_failed_dirs=
-for tmp in `find . -name tmp_dir -print` ; do
+for tmp in `find . -follow -name tmp_dir -print` ; do
dir=`dirname $tmp`
+ # Check whether the directory is still there: if there are symbolic
+ # links around, we may have cleaned it up already.
+ if [ -d $tmp ] ; then
echo "Cleaning up from apparent failed install in \`$dir'..."
if (
cd $dir && (
@@ -64,7 +67,7 @@
)
[ -d Mercury/dirs ] && mv tmp_dir/*.dir $dirs_subdir
[ -d Mercury/cs ] && mv -f tmp_dir/*.c Mercury/cs
- [ -d Mercury/os ] && mv -f tmp_dir/*.o tmp_dir/*.pic_o Mercury/os
+ [ -d Mercury/os ] && mv -f tmp_dir/*.{o,pic_o} Mercury/os
mv -f tmp_dir/* .
rmdir tmp_dir
)
@@ -78,6 +81,9 @@
echo "Failed again. :-("
cleanup_failed_dirs="$cleanup_failed_dirs $dir"
fi
+ fi
+ else
+ echo "Skipping \`$dir' (already done)."
fi
done
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list