-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwindows.go
More file actions
143 lines (119 loc) · 3.11 KB
/
windows.go
File metadata and controls
143 lines (119 loc) · 3.11 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
package osmgr
const (
WINV = "Vista"
WIN7 = "7"
WIN8 = "8"
WIN81 = "8.1"
WIN10 = "10"
WIN11 = "11"
)
var (
PT_GPT_MBR = []string{"gpt", "mbr"}
FS_FAT32 = []string{"fat32"}
FS_NTFS = []string{"ntfs"}
FS_FAT32_NTFS = []string{"fat32", "ntfs"}
FS_FAT32_NTFS_BTRFS = []string{"fat32", "ntfs", "btrfs"}
)
type Windows struct {
Version string //Vista, 7, 8, 8.1, 10, 11
}
func (win *Windows) GetPartitionTables() []string {
switch win.Version {
case WINV, WIN7, WIN8, WIN81, WIN10, WIN11:
return PT_GPT_MBR
}
return nil //Unsupported version of Windows
}
func (win *Windows) GetBootFilesystems() []string {
switch win.Version {
case WINV, WIN7:
return FS_NTFS
case WIN8, WIN81, WIN10, WIN11:
return FS_FAT32
}
return nil //Unsupported version of Windows
}
func (win *Windows) GetBootSize() int64 {
switch win.Version {
case WINV, WIN7, WIN8, WIN81, WIN10, WIN11:
return 100 * SIZE_MiB
}
return 0 //Size is not known
}
func (win *Windows) GetSystemFilesystems() []string {
switch win.Version {
case WIN10:
return FS_FAT32_NTFS_BTRFS
case WINV, WIN7, WIN8, WIN81, WIN11:
return FS_FAT32_NTFS
}
return nil //Unsupported version of Windows
}
func (win *Windows) GetSystemSize() int64 {
switch win.Version {
case WINV, WIN7, WIN8, WIN81:
return 20 * SIZE_GiB
case WIN10:
return 32 * SIZE_GiB
case WIN11:
return 64 * SIZE_GiB
}
return 0 //Size is not known
}
func (win *Windows) GetRecoveryFilesystems() []string {
switch win.Version {
case WINV, WIN7, WIN8, WIN81, WIN10, WIN11:
return FS_NTFS
}
return nil //Unsupported version of Windows
}
func (win *Windows) GetRecoverySize() int64 {
switch win.Version {
case WINV, WIN7, WIN8, WIN81, WIN10, WIN11:
return 750 * SIZE_MiB
}
return 0 //Size is not known
}
func (win *Windows) GetHomeFilesystems() []string {
return nil
}
func (win *Windows) GetHomeSize() int64 {
return 0 //Home partitions are not supported
}
func (win *Windows) GetTempFilesystems() []string {
return nil
}
func (win *Windows) GetTempSize() int64 {
return 0 //Temp partitions are not supported
}
func (win *Windows) GetSwap() bool {
return false //Swap partitions are not supported
}
//Install the bootloader, infer MBR/GPT from part.Disk.Table
func (win *Windows) InstallBoot(part *Partition) error {
return ERR_NOT_IMPLEMENTED_PART
}
func (win *Windows) InstallSystem(part *Partition) error {
return ERR_NOT_IMPLEMENTED_PART
}
func (win *Windows) InstallRecovery(part *Partition) error {
return ERR_NOT_IMPLEMENTED_PART
}
func (win *Windows) InstallHome(part *Partition) error {
return nil //We can't have a separate partition for our home directory (yet)
}
func (win *Windows) InstallTemp(part *Partition) error {
return nil //We can't have a separate temp partition (yet)
}
func (win *Windows) InstallSwap(part *Partition) error {
return nil //We can't have a separate partition for our pagefile and/or hiberfil (yet)
}
func (win *Windows) GetFreshTableRecommendsDisk(disk *Disk) []*Partition {
return nil
}
func (win *Windows) GetFreshTableRecommendsPartitions(...*Partition) []*Partition {
return nil
}
func (win *Windows) AreTableRecommendsFast() bool {
return true
}