Example #1
0
func runCreate(cmd *cobra.Command, args []string) {
	if len(args) != 0 {
		plog.Fatal("No args accepted")
	}

	if chrootVersion == "" {
		plog.Fatal("Missing --sdk-version=VERSION")
	}

	plog.Noticef("Downloading SDK version %s", chrootVersion)
	if err := sdk.DownloadSDK(chrootVersion); err != nil {
		plog.Fatalf("Download failed: %v", err)
	}

	if allowReplace {
		if err := sdk.Delete(chrootName); err != nil {
			plog.Fatalf("Replace failed: %v", err)
		}
	}

	if err := sdk.Unpack(chrootVersion, chrootName); err != nil {
		plog.Fatalf("Create failed: %v", err)
	}

	if err := sdk.Setup(chrootName); err != nil {
		plog.Fatalf("Create failed: %v", err)
	}
}
Example #2
0
func runDownload(cmd *cobra.Command, args []string) {
	if len(args) != 0 {
		plog.Fatal("No args accepted")
	}

	if downloadVersion == "" {
		plog.Fatal("Missing --sdk-version=VERSION")
	}

	plog.Noticef("Downloading SDK version %s", downloadVersion)
	if err := sdk.DownloadSDK(downloadVersion); err != nil {
		plog.Fatalf("Download failed: %v", err)
	}
}