update install script

This commit is contained in:
Henrique Dias 2016-02-22 21:37:47 +00:00
parent 1da6363db7
commit e9b13f961b

View File

@ -154,17 +154,24 @@ func Install() string {
tempfiles = append(tempfiles, bin+"/README.md", bin+"/LICENSE.md") tempfiles = append(tempfiles, bin+"/README.md", bin+"/LICENSE.md")
clean() clean()
ftorename := bin + "/" + strings.Replace(filename, ".tar.gz", "", 1) ftorename := bin + "/"
if runtime.GOOS == "darwin" { switch runtime.GOOS {
ftorename = bin + "/" + strings.Replace(filename, ".zip", "", 1) case "darwin":
ftorename += strings.Replace(filename, ".zip", "", 1)
case "windows":
ftorename += strings.Replace(filename, ".zip", ".exe", 1)
default:
ftorename += strings.Replace(filename, ".tar.gz", "", 1)
} }
if runtime.GOOS == "windows" { err = os.Rename(ftorename, hugo)
ftorename = bin + "/" + strings.Replace(filename, ".zip", ".exe", 1)
if err != nil {
fmt.Println(err)
os.Exit(-1)
} }
os.Rename(ftorename, hugo)
fmt.Println("Hugo installed at " + hugo) fmt.Println("Hugo installed at " + hugo)
return hugo return hugo
} }