Browse Source

Add DestDir variable

pull/1/head
Tovi Jaeschke-Rogers 3 years ago
parent
commit
1872b493b6
2 changed files with 22 additions and 1 deletions
  1. +4
    -1
      Client/Package/InstallPackage.go
  2. +18
    -0
      Variables/Variables.go

+ 4
- 1
Client/Package/InstallPackage.go View File

@ -6,6 +6,7 @@ import (
"os"
"PackageManager/Archive"
"PackageManager/Variables"
)
func InstallPackage(pkgs []string) error {
@ -22,7 +23,9 @@ func InstallPackage(pkgs []string) error {
}
for _, pkg = range pkgs {
e = Archive.UntarGzip(pkg, "/")
fmt.Printf("Installing %s...", pkg)
e = Archive.UntarGzip(pkg, Variables.DestDir)
fmt.Printf("%s successfully installed", pkg)
}
return nil


+ 18
- 0
Variables/Variables.go View File

@ -1,5 +1,23 @@
package Variables
import (
"os"
)
const (
DatabaseName string = "package_manager.db"
)
var (
DestDir string = "/"
)
func init() {
var (
destDir string
)
destDir = os.Getenv("DESTDIR")
if destDir != "" {
DestDir = destDir
}
}

Loading…
Cancel
Save