make HELM_HOME portable

allow cacheFile to be relative for local index
uses a symlink with a relative path on unix

final piece of https://github.com/kubernetes/helm/pull/3327
pull/3648/head
Christopher A. Stelma 8 years ago committed by Christopher A. Stelma
parent cb12dbba97
commit 10e186cf34

@ -386,7 +386,7 @@ func ensureDefaultRepos(home helmpath.Home, out io.Writer, skipRefresh bool) err
if err != nil { if err != nil {
return err return err
} }
lr, err := initLocalRepo(home.LocalRepository(localRepositoryIndexFile), home.CacheIndex("local"), out, home) lr, err := initLocalRepo(home.LocalRepository(localRepositoryIndexFile), home.CacheRelativeIndex("local"), out, home)
if err != nil { if err != nil {
return err return err
} }

@ -20,10 +20,15 @@ package main
import ( import (
"os" "os"
"path/filepath"
"k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/helm/helmpath"
) )
func createLink(indexFile, cacheFile string, home helmpath.Home) error { func createLink(indexFile, cacheFile string, home helmpath.Home) error {
return os.Symlink(indexFile, cacheFile) fp, err := filepath.Rel(home.Cache(), indexFile)
if err != nil {
return err
}
return os.Symlink(fp, filepath.Join(home.Cache(), cacheFile))
} }

@ -20,10 +20,11 @@ package main
import ( import (
"os" "os"
"path/filepath"
"k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/helm/helmpath"
) )
func createLink(indexFile, cacheFile string, home helmpath.Home) error { func createLink(indexFile, cacheFile string, home helmpath.Home) error {
return os.Link(indexFile, cacheFile) return os.Link(indexFile, filepath.Join(home.Cache(), cacheFile))
} }

Loading…
Cancel
Save