aboutsummaryrefslogtreecommitdiff
path: root/installpkg.go
diff options
context:
space:
mode:
authorSlack Coder <slackcoder@server.ky>2022-05-19 15:39:24 -0500
committerSlack Coder <slackcoder@server.ky>2022-05-20 15:06:50 -0500
commita1e7249e712bfc7bbcf6275bdd87f2343d60f81a (patch)
treea8827ba2b8701640bfdb4cbe6f148ad5055147cd /installpkg.go
parent3026d40715e2758bc9ddfbd98acb558cfcba3c5d (diff)
downloadpkgtools-go-a1e7249e712bfc7bbcf6275bdd87f2343d60f81a.tar.xz
bail out on unknown package attributes
Be freindlier to the user by clearly communicating and refusing to install packages we do not know how to install. Add an environment variable allowing users to opt out and silently ignore errors if they so choose.
Diffstat (limited to 'installpkg.go')
-rw-r--r--installpkg.go23
1 files changed, 16 insertions, 7 deletions
diff --git a/installpkg.go b/installpkg.go
index 479b318..488692e 100644
--- a/installpkg.go
+++ b/installpkg.go
@@ -65,11 +65,13 @@ type InstallPkgFlags struct {
TerseLength int
Warn bool
- chown bool
- chmod bool
+ chown bool
+ chmod bool
+ Strict bool
}
var DefaultInstallPkgFlags = InstallPkgFlags{
+ // Official slackware configuration
Ask: false,
InfoBox: false,
LockDir: InstallLockDir,
@@ -83,8 +85,10 @@ var DefaultInstallPkgFlags = InstallPkgFlags{
TerseLength: DefaultTerseLength,
Warn: false,
- chown: true,
- chmod: true,
+ // ours
+ chown: false,
+ chmod: false,
+ Strict: true,
}
func (s *InstallPkgFlags) SetEnvValues() {
@@ -97,6 +101,10 @@ func (s *InstallPkgFlags) SetEnvValues() {
if v := os.Getenv("ROOT"); v != "" {
s.Root = v
}
+
+ if v := os.Getenv("PKGTOOLS_GO_STRICT"); v != "NO" {
+ s.Strict = false
+ }
}
func runInstallScript(
@@ -301,9 +309,10 @@ func extractSlackwarePkg(flags *InstallPkgFlags, fp string) error {
defer slackPkg.Close()
toRoot := NewTarExtractor(&TarCfg{
- Root: flags.Root,
- Chmod: flags.chmod,
- Chown: flags.chown,
+ Root: flags.Root,
+ Chmod: flags.chmod,
+ Chown: flags.chown,
+ Strict: flags.Strict,
})
err = FilterTar(