diff --git a/actions/debootstrap_action.go b/actions/debootstrap_action.go index bd3eea5a..4a9d629c 100644 --- a/actions/debootstrap_action.go +++ b/actions/debootstrap_action.go @@ -157,6 +157,26 @@ func (d *DebootstrapAction) RunSecondStage(context debos.DebosContext) error { return err } +func (d *DebootstrapAction) isLikelyOldSuite() bool { + // Guess if suite is something before usr-is-merged was introduced + switch strings.ToLower(d.Suite) { + // these are known to have usr-is-merged. + case "sid", "unstable": + return false; + case "testing": + return false; + case "bookworm": + return false; + case "trixie": + return false; + case "forky": + return false; + // we can't list all derivate distributions suites, so use default. + default: + return true; + } +} + func (d *DebootstrapAction) Run(context *debos.DebosContext) error { d.LogStart() cmdline := []string{"debootstrap"} @@ -203,7 +223,11 @@ func (d *DebootstrapAction) Run(context *debos.DebosContext) error { cmdline = append(cmdline, fmt.Sprintf("--variant=%s", d.Variant)) } - cmdline = append(cmdline, "--exclude=usr-is-merged") + // workaround for https://github.com/go-debos/debos/issues/361 + if d.isLikelyOldSuite() { + cmdline = append(cmdline, "--exclude=usr-is-merged") + } + cmdline = append(cmdline, d.Suite) cmdline = append(cmdline, context.Rootdir) cmdline = append(cmdline, d.Mirror)