Move directories
This commit is contained in:
parent
eb8db1bc99
commit
4a8c4e22ec
@ -60,7 +60,13 @@ func CompileSourcePackage(archiveFilename, outputDirectory string, skipChecks bo
|
|||||||
gid = os.Getgid()
|
gid = os.Getgid()
|
||||||
}
|
}
|
||||||
|
|
||||||
tempDirectory := path.Join(homeDir, ".cache/bpm/compilation/", bpmpkg.PkgInfo.Name)
|
// Set temporary directory
|
||||||
|
var tempDirectory string
|
||||||
|
if os.Getuid() == 0 {
|
||||||
|
tempDirectory = path.Join("/var/cache/bpm/compilation/", bpmpkg.PkgInfo.Name)
|
||||||
|
} else {
|
||||||
|
tempDirectory = path.Join(homeDir, ".cache/bpm/compilation/", bpmpkg.PkgInfo.Name)
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure temporary directory does not exist
|
// Ensure temporary directory does not exist
|
||||||
if _, err := os.Stat(tempDirectory); err == nil {
|
if _, err := os.Stat(tempDirectory); err == nil {
|
||||||
|
@ -516,7 +516,7 @@ func (operation *BPMOperation) Execute(verbose, force bool) (err error) {
|
|||||||
// Compile package if type is 'source'
|
// Compile package if type is 'source'
|
||||||
if bpmpkg.PkgInfo.Type == "source" {
|
if bpmpkg.PkgInfo.Type == "source" {
|
||||||
// Get path to compiled package directory
|
// Get path to compiled package directory
|
||||||
compiledDir := path.Join(operation.RootDir, "/var/lib/bpm/compiled/")
|
compiledDir := path.Join(operation.RootDir, "/var/cache/bpm/compiled/")
|
||||||
|
|
||||||
// Create compiled package directory if not exists
|
// Create compiled package directory if not exists
|
||||||
if _, err := os.Stat(compiledDir); err != nil {
|
if _, err := os.Stat(compiledDir); err != nil {
|
||||||
|
@ -266,16 +266,16 @@ func (repo *Repository) FetchPackage(pkg string) (string, error) {
|
|||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
err = os.MkdirAll("/var/cache/bpm/packages/", 0755)
|
err = os.MkdirAll("/var/cache/bpm/fetched/", 0755)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
out, err := os.Create("/var/cache/bpm/packages/" + path.Base(entry.Download))
|
out, err := os.Create("/var/cache/bpm/fetched/" + path.Base(entry.Download))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
defer out.Close()
|
defer out.Close()
|
||||||
|
|
||||||
_, err = io.Copy(out, resp.Body)
|
_, err = io.Copy(out, resp.Body)
|
||||||
return "/var/cache/bpm/packages/" + path.Base(entry.Download), nil
|
return "/var/cache/bpm/fetched/" + path.Base(entry.Download), nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user