]> Cypherpunks repositories - gostls13.git/commitdiff
misc/dist: handle previous installation
authorTyler Bunnell <tylerbunnell@gmail.com>
Thu, 28 Feb 2013 05:09:48 +0000 (16:09 +1100)
committerAndrew Gerrand <adg@golang.org>
Thu, 28 Feb 2013 05:09:48 +0000 (16:09 +1100)
The installer package will now detect a previous installation and warn the user
that the previous installation will be deleted. If the user continues, the
installer will delete the previous installation and install the package as
usual.

Fixes #4293.

R=adg
CC=golang-dev
https://golang.org/cl/7427044

misc/dist/darwin/Distribution
misc/dist/darwin/scripts/preinstall [new file with mode: 0644]

index 1468a629a21b513969ab7d90bea096da871db807..8b764b69f43aca452e861cb1f8ca6f44c4be780f 100644 (file)
@@ -13,7 +13,13 @@ function installCheck() {
         my.result.type = 'Fatal';
         return false;
     }
-    return true;
+    if(system.files.fileExistsAtPath('/usr/local/go/bin/go')) {
+           my.result.title = 'Previous Installation Detected';
+           my.result.message = 'A previous installation of Go exists at /usr/local/go. This installer will remove the previous installation prior to installing. Please back up any data before proceeding.';
+           my.result.type = 'Warning';
+           return false;
+       }
+    return true;    
 }
     </script>
     <choices-outline>
diff --git a/misc/dist/darwin/scripts/preinstall b/misc/dist/darwin/scripts/preinstall
new file mode 100644 (file)
index 0000000..4cdaaa4
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+GOROOT=/usr/local/go
+
+echo "Removing previous installation"
+if [ -d $GOROOT ]; then
+       rm -r $GOROOT
+fi