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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
//
// ubuntu-device-flash - Tool to download and flash devices with an Ubuntu Image
// based system
//
// Copyright (c) 2015 Canonical Ltd.
//
// Written by Sergio Schvezov <sergio.schvezov@canonical.com>
//
package main
import (
"fmt"
"launchpad.net/goget-ubuntu-touch/diskimage"
"launchpad.net/goget-ubuntu-touch/ubuntuimage"
)
type imageFlavor string
const (
minSizePersonal = 10
minSizeCore = 4
)
const (
rootSizePersonal = 4096
rootSizeCore = 1024
)
const (
flavorPersonal imageFlavor = "personal"
flavorCore imageFlavor = "core"
)
func (f imageFlavor) Channel() string {
return fmt.Sprintf("ubuntu-%s", f)
}
func (f imageFlavor) minSize() int64 {
switch f {
case flavorPersonal:
return minSizePersonal
case flavorCore:
return minSizeCore
default:
panic("invalid flavor")
}
}
func (f imageFlavor) rootSize() int {
switch f {
case flavorPersonal:
return rootSizePersonal
case flavorCore:
return rootSizeCore
default:
panic("invalid flavor")
}
}
type Snapper struct {
Channel string `long:"channel" description:"Specify the channel to use" default:"stable"`
Output string `long:"output" short:"o" description:"Name of the image file to create" required:"true"`
Oem string `long:"oem" description:"The snappy oem package to base the image out of" default:"generic-amd64"`
StoreID string `long:"store" description:"Set an alternate store id."`
Development struct {
Install []string `long:"install" description:"Install additional packages (can be called multiple times)"`
DevicePart string `long:"device-part" description:"Specify a local device part to override the one from the server"`
DeveloperMode bool `long:"developer-mode" description:"Finds the latest public key in your ~/.ssh and sets it up using cloud-init"`
} `group:"Development"`
Positional struct {
Release string `positional-arg-name:"release" description:"The release to base the image out of (15.04 or rolling)" required:"true"`
} `positional-args:"yes" required:"yes"`
img diskimage.CoreImage
hardware diskimage.HardwareDescription
oem diskimage.OemDescription
size int64
flavor imageFlavor
device string
customizationFunc []func() error
}
func (s *Snapper) systemImage() (*ubuntuimage.Image, error) {
return nil, nil
}
func (s *Snapper) install(systemPath string) error {
return nil
}
// deploy orchestrates the priviledged part of the setup
func (s *Snapper) deploy(systemImage *ubuntuimage.Image, filePathChan <-chan string) error {
return nil
}
func (s *Snapper) create() error {
return fmt.Errorf(`Building core images is currently not supported.
Images for ubuntu-core 15.04 can be build with the ppa:snappy-dev/tools.
Building images for ubuntu-core 16.04 will be supported by this tool soon.
`)
}
|