[m-rev.] for review: make backup of installed compiler before install

Ian MacLarty maclarty at cs.mu.OZ.AU
Tue Feb 15 17:25:06 AEDT 2005


For review by anyone. 

Estimated hours taken: 1
Branches: main and 0.12

Make a backup of the current installation before installing a new version
of the compiler.  If the new installation fails then restore the previous
installation.  This prevents half the libraries from being installed if the
mmake install process fails.

tools/test_mercury
	Copy the existing installation to mercury_install_backup in the same
	directory as the current installation.
	
	Restore it if the install fails.

Index: tools/test_mercury
===================================================================
RCS file: /home/mercury1/repository/mercury/tools/test_mercury,v
retrieving revision 1.249
diff -u -r1.249 test_mercury
--- tools/test_mercury	26 Jan 2005 15:56:05 -0000	1.249
+++ tools/test_mercury	15 Feb 2005 06:13:03 -0000
@@ -728,6 +728,12 @@
         true)	cd mercury || { false; exit 1; } ;;
     esac
 
+    # Make a backup copy of the current installation which we will restore
+    # if the new installation fails.
+
+    mkdir -p $INSTALL_DIR/../mercury_install_backup
+    cp -rf $INSTALL_DIR/* $INSTALL_DIR/../mercury_install_backup
+
     # Previously we had lots of special case code here for installing on
     # IRIX systems.   We don't currently have any IRIX boxes, and this 
     # code was a bit of a pain to maintain.  If we ever get an IRIX box
@@ -775,6 +781,8 @@
 	    ;;
         *)
 	    date >> $TESTDIR/logs/install-failed."$TEST_ID"
+	    # restore the previous installation
+	    cp -rf $INSTALL_DIR/../mercury_install_backup/* $INSTALL_DIR
 	    ;;
     esac
 esac
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list