diff --git a/actions/debootstrap_action.go b/actions/debootstrap_action.go index 8def5836..9935b90a 100644 --- a/actions/debootstrap_action.go +++ b/actions/debootstrap_action.go @@ -48,7 +48,9 @@ Example: - private-key -- provide the client's private key in a file separate from the certificate. - parent-suite -- release code name which this suite is based on. Useful for downstreams which do - not use debian codenames for their suite names (e.g. "stable"). + not use debian codenames for their suite names (e.g. "stable"). The script debootstrap uses will + be set to this property. If the script does not exist, debos will fall back to using the "unstable" + debootstrap script. */ package actions @@ -184,6 +186,10 @@ func shouldExcludeUsrIsMerged(suite string) bool { } } +func getDebootstrapScriptPath(script string) string { + return path.Join("/usr/share/debootstrap/scripts/", script) +} + func (d *DebootstrapAction) Run(context *debos.DebosContext) error { d.LogStart() cmdline := []string{"debootstrap"} @@ -238,7 +244,15 @@ func (d *DebootstrapAction) Run(context *debos.DebosContext) error { cmdline = append(cmdline, d.Suite) cmdline = append(cmdline, context.Rootdir) cmdline = append(cmdline, d.Mirror) - cmdline = append(cmdline, "/usr/share/debootstrap/scripts/unstable") + + /* Determine debootstrap script to use from d.ParentSuite, falling back to + unstable if a script for the parent suite does not exist. */ + script := getDebootstrapScriptPath(d.ParentSuite) + if _, err := os.Stat(script); err != nil { + script = getDebootstrapScriptPath("unstable") + } + log.Printf("using debootstrap script %s\n", script) + cmdline = append(cmdline, script) /* Make sure /etc/apt/apt.conf.d exists inside the fakemachine otherwise debootstrap prints a warning about the path not existing. */