package Package
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"os"
|
|
|
|
"PackageManager/Archive"
|
|
)
|
|
|
|
func InstallPackage(pkgs []string) error {
|
|
var (
|
|
pkg string
|
|
e error
|
|
)
|
|
|
|
for _, pkg = range pkgs {
|
|
_, e = os.Stat(pkg)
|
|
if os.IsNotExist(e) {
|
|
return errors.New(fmt.Sprintf("Invalid package %s", pkg))
|
|
}
|
|
}
|
|
|
|
for _, pkg = range pkgs {
|
|
e = Archive.UntarGzip(pkg, "/")
|
|
}
|
|
|
|
return nil
|
|
}
|