From: Tyler Bunnell Date: Thu, 28 Feb 2013 05:09:48 +0000 (+1100) Subject: misc/dist: handle previous installation X-Git-Tag: go1.1rc2~789 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=65983695fb8e3b0ba0859f964ad0a41e3e4ca2c3;p=gostls13.git misc/dist: handle previous installation 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 --- diff --git a/misc/dist/darwin/Distribution b/misc/dist/darwin/Distribution index 1468a629a2..8b764b69f4 100644 --- a/misc/dist/darwin/Distribution +++ b/misc/dist/darwin/Distribution @@ -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; } diff --git a/misc/dist/darwin/scripts/preinstall b/misc/dist/darwin/scripts/preinstall new file mode 100644 index 0000000000..4cdaaa4bca --- /dev/null +++ b/misc/dist/darwin/scripts/preinstall @@ -0,0 +1,8 @@ +#!/bin/bash + +GOROOT=/usr/local/go + +echo "Removing previous installation" +if [ -d $GOROOT ]; then + rm -r $GOROOT +fi