diff options
-rw-r--r-- | installpkg.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/installpkg.go b/installpkg.go index 7933960..a6e327e 100644 --- a/installpkg.go +++ b/installpkg.go @@ -295,6 +295,12 @@ func InstallPkg(flags *InstallPkgFlags, pkgs ...string) error { return err } + installPath := path.Join(flags.Root, PackageInstallPath) + fmt.Println(installPath) + if _, err := os.Stat(installPath); !errors.Is(err, os.ErrNotExist) { + return errors.Errorf("The '%s' directory exists and would be used by installpkg and removed. Please consider renaming the directory or using Slackware's installpkg.", installPath) + } + for _, pkg := range pkgs { fmt.Printf("installing %s\n", PackageBase(pkg)) err = writeToDatabase(flags.Root, pkg) @@ -336,7 +342,6 @@ func InstallPkg(flags *InstallPkgFlags, pkgs ...string) error { fmt.Fprintln(os.Stderr, errors.Wrap(err, "running install script")) } - installPath := path.Join(flags.Root, PackageInstallPath) err = os.RemoveAll(installPath) if err != nil { return err |