Ubuntu Pastebin

Paste from dimitern at Tue, 24 Feb 2015 13:29:23 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
	// For LTS series which need support for the cloud-tools archive,
	// we need to enable apt-get update regardless of the environ
	// setting, otherwise bootstrap or provisioning will fail.
	if series == "precise" && !addUpdateScripts {
		addUpdateScripts = true
	}

	// Bring packages up-to-date.
	c.SetAptUpdate(addUpdateScripts)
	c.SetAptUpgrade(addUpgradeScripts)
	c.SetAptGetWrapper("eatmydata")

	// If we're not doing an update, adding these packages is
	// meaningless.
	if addUpdateScripts {
		requiredPackages := []string{
			"curl",
			"cpu-checker",
			// TODO(axw) 2014-07-02 #1277359
			// Don't install bridge-utils in cloud-init;
			// leave it to the networker worker.
			"bridge-utils",
			"rsyslog-gnutls",
			"cloud-utils",
			"cloud-image-utils",
		}

		// The required packages need to come from the correct repo.
		// For precise, that might require an explicit --target-release parameter.
		for _, pkg := range requiredPackages {
			// We cannot just pass requiredPackages below, because
			// this will generate install commands which older
			// versions of cloud-init (e.g. 0.6.3 in precise) will
			// interpret incorrectly (see bug http://pad.lv/1424777).
			cmds := apt.GetPreparePackages([]string{pkg}, series)
			if len(cmds) != 1 {
				// One package given, one command (with possibly
				// multiple args) expected.
				panic(fmt.Sprintf("expected one install command per package, got %v", cmds))
			}
			for _, p := range cmds[0] {
				// We need to add them one package at a time. Also for
				// precise where --target-release
				// precise-updates/cloud-tools is needed for some packages
				// we need to pass these as "packages", otherwise the
				// aforementioned older cloud-init will also fail to
				// interpret the command correctly.
				c.AddPackage(p)
			}
		}
	}
Download as text