getch 0.0.8 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +44 -0
- data/README.md +57 -8
- data/bin/setup.sh +4 -2
- data/lib/getch.rb +43 -15
- data/lib/getch/command.rb +26 -5
- data/lib/getch/config.rb +58 -0
- data/lib/getch/filesystem.rb +6 -0
- data/lib/getch/filesystem/clean.rb +51 -0
- data/lib/getch/filesystem/device.rb +61 -0
- data/lib/getch/filesystem/ext4.rb +1 -0
- data/lib/getch/filesystem/ext4/config.rb +8 -9
- data/lib/getch/filesystem/ext4/device.rb +2 -7
- data/lib/getch/filesystem/ext4/encrypt/config.rb +69 -47
- data/lib/getch/filesystem/ext4/encrypt/deps.rb +21 -15
- data/lib/getch/filesystem/ext4/encrypt/device.rb +5 -9
- data/lib/getch/filesystem/ext4/encrypt/format.rb +10 -6
- data/lib/getch/filesystem/ext4/encrypt/mount.rb +6 -43
- data/lib/getch/filesystem/ext4/encrypt/partition.rb +57 -55
- data/lib/getch/filesystem/ext4/format.rb +3 -5
- data/lib/getch/filesystem/ext4/mount.rb +7 -46
- data/lib/getch/filesystem/ext4/partition.rb +16 -39
- data/lib/getch/filesystem/lvm.rb +1 -0
- data/lib/getch/filesystem/lvm/config.rb +12 -15
- data/lib/getch/filesystem/lvm/deps.rb +5 -20
- data/lib/getch/filesystem/lvm/device.rb +33 -9
- data/lib/getch/filesystem/lvm/encrypt.rb +15 -0
- data/lib/getch/filesystem/lvm/encrypt/config.rb +71 -0
- data/lib/getch/filesystem/lvm/encrypt/deps.rb +46 -0
- data/lib/getch/filesystem/lvm/encrypt/device.rb +46 -0
- data/lib/getch/filesystem/lvm/encrypt/format.rb +32 -0
- data/lib/getch/filesystem/lvm/encrypt/mount.rb +25 -0
- data/lib/getch/filesystem/lvm/encrypt/partition.rb +80 -0
- data/lib/getch/filesystem/lvm/format.rb +11 -7
- data/lib/getch/filesystem/lvm/mount.rb +7 -46
- data/lib/getch/filesystem/lvm/partition.rb +19 -31
- data/lib/getch/filesystem/mount.rb +56 -0
- data/lib/getch/filesystem/partition.rb +77 -0
- data/lib/getch/filesystem/zfs.rb +14 -0
- data/lib/getch/filesystem/zfs/config.rb +57 -0
- data/lib/getch/filesystem/zfs/deps.rb +95 -0
- data/lib/getch/filesystem/zfs/device.rb +58 -0
- data/lib/getch/filesystem/zfs/encrypt.rb +15 -0
- data/lib/getch/filesystem/zfs/encrypt/config.rb +67 -0
- data/lib/getch/filesystem/zfs/encrypt/deps.rb +97 -0
- data/lib/getch/filesystem/zfs/encrypt/device.rb +60 -0
- data/lib/getch/filesystem/zfs/encrypt/format.rb +105 -0
- data/lib/getch/filesystem/zfs/encrypt/mount.rb +51 -0
- data/lib/getch/filesystem/zfs/encrypt/partition.rb +65 -0
- data/lib/getch/filesystem/zfs/format.rb +114 -0
- data/lib/getch/filesystem/zfs/mount.rb +48 -0
- data/lib/getch/filesystem/zfs/partition.rb +64 -0
- data/lib/getch/gentoo.rb +8 -4
- data/lib/getch/gentoo/boot.rb +32 -17
- data/lib/getch/gentoo/chroot.rb +12 -26
- data/lib/getch/gentoo/config.rb +37 -12
- data/lib/getch/gentoo/sources.rb +26 -29
- data/lib/getch/gentoo/use.rb +43 -0
- data/lib/getch/gentoo/use_flag.rb +64 -0
- data/lib/getch/helpers.rb +35 -13
- data/lib/getch/options.rb +23 -8
- data/lib/getch/version.rb +1 -1
- metadata +46 -18
- metadata.gz.sig +0 -0
@@ -0,0 +1,105 @@
|
|
1
|
+
module Getch
|
2
|
+
module FileSystem
|
3
|
+
module Zfs
|
4
|
+
module Encrypt
|
5
|
+
class Format < Getch::FileSystem::Zfs::Encrypt::Device
|
6
|
+
def initialize
|
7
|
+
super
|
8
|
+
@log = Getch::Log.new()
|
9
|
+
@state = Getch::States.new()
|
10
|
+
if ! @id
|
11
|
+
@log.info "Research pool id for #{@dev_root}..."
|
12
|
+
sleep 2 until Helpers::pool_id(@dev_root)
|
13
|
+
@id = Helpers::pool_id(@dev_root)
|
14
|
+
@boot_pool_name = "bpool-#{@id}"
|
15
|
+
@pool_name = "rpool-#{@id}"
|
16
|
+
end
|
17
|
+
format
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def format
|
23
|
+
return if STATES[:format]
|
24
|
+
raise "Error, no id found for #{@dev_root}." if ! @id
|
25
|
+
system("mkfs.fat -F32 #{@dev_esp}") if @dev_esp
|
26
|
+
system("mkswap -f #{@dev_swap}")
|
27
|
+
zfs
|
28
|
+
datasets
|
29
|
+
@state.format
|
30
|
+
end
|
31
|
+
|
32
|
+
def zfs
|
33
|
+
bloc=`blockdev --getbsz #{@dev_root}`.chomp
|
34
|
+
ashift = case bloc
|
35
|
+
when 8096
|
36
|
+
13
|
37
|
+
when 4096
|
38
|
+
12
|
39
|
+
else # 512
|
40
|
+
9
|
41
|
+
end
|
42
|
+
|
43
|
+
Helpers::mkdir(MOUNTPOINT)
|
44
|
+
|
45
|
+
@log.debug("ashift found for #{bloc} - #{ashift}")
|
46
|
+
if @dev_boot
|
47
|
+
# https://openzfs.github.io/openzfs-docs/Getting%20Started/Ubuntu/Ubuntu%2020.04%20Root%20on%20ZFS.html
|
48
|
+
@log.info("Creating boot pool on #{@pool_name}")
|
49
|
+
exec("zpool create -f \\
|
50
|
+
-o ashift=#{ashift} -o autotrim=on -d \\
|
51
|
+
-o feature@async_destroy=enabled \\
|
52
|
+
-o feature@bookmarks=enabled \\
|
53
|
+
-o feature@embedded_data=enabled \\
|
54
|
+
-o feature@empty_bpobj=enabled \\
|
55
|
+
-o feature@enabled_txg=enabled \\
|
56
|
+
-o feature@extensible_dataset=enabled \\
|
57
|
+
-o feature@filesystem_limits=enabled \\
|
58
|
+
-o feature@hole_birth=enabled \\
|
59
|
+
-o feature@large_blocks=enabled \\
|
60
|
+
-o feature@lz4_compress=enabled \\
|
61
|
+
-o feature@spacemap_histogram=enabled \\
|
62
|
+
-O acltype=posixacl -O canmount=off -O compression=lz4 \\
|
63
|
+
-O devices=off -O normalization=formD -O atime=off -O xattr=sa \\
|
64
|
+
-O mountpoint=/boot -R #{MOUNTPOINT} \\
|
65
|
+
#{@boot_pool_name} #{@dev_boot}
|
66
|
+
")
|
67
|
+
end
|
68
|
+
|
69
|
+
exec("zpool create -f -o ashift=#{ashift} -o autotrim=on \\
|
70
|
+
-O encryption=aes-256-gcm \\
|
71
|
+
-O keylocation=prompt -O keyformat=passphrase \\
|
72
|
+
-O acltype=posixacl -O canmount=off -O compression=lz4 \\
|
73
|
+
-O dnodesize=auto -O normalization=formD -O atime=off \\
|
74
|
+
-O xattr=sa -O mountpoint=/ -R #{MOUNTPOINT} \\
|
75
|
+
#{@pool_name} #{@dev_root}
|
76
|
+
")
|
77
|
+
end
|
78
|
+
|
79
|
+
def datasets
|
80
|
+
exec("zfs create -o canmount=off -o mountpoint=none #{@pool_name}/ROOT")
|
81
|
+
exec("zfs create -o canmount=off -o mountpoint=none #{@boot_pool_name}/BOOT") if @dev_boot
|
82
|
+
|
83
|
+
exec("zfs create -o canmount=noauto -o mountpoint=/ #{@pool_name}/ROOT/gentoo")
|
84
|
+
exec("zfs create -o canmount=noauto -o mountpoint=/boot #{@boot_pool_name}/BOOT/gentoo") if @dev_boot
|
85
|
+
|
86
|
+
exec("zfs create -o canmount=off #{@pool_name}/ROOT/gentoo/usr")
|
87
|
+
exec("zfs create #{@pool_name}/ROOT/gentoo/usr/src")
|
88
|
+
exec("zfs create -o canmount=off #{@pool_name}/ROOT/gentoo/var")
|
89
|
+
exec("zfs create #{@pool_name}/ROOT/gentoo/var/log")
|
90
|
+
exec("zfs create #{@pool_name}/ROOT/gentoo/var/db")
|
91
|
+
exec("zfs create #{@pool_name}/ROOT/gentoo/var/tmp")
|
92
|
+
|
93
|
+
exec("zfs create -o canmount=off -o mountpoint=/ #{@pool_name}/USERDATA")
|
94
|
+
exec("zfs create -o canmount=on -o mountpoint=/root #{@pool_name}/USERDATA/root")
|
95
|
+
exec("zfs create -o canmount=on -o mountpoint=/home/#{@user} #{@pool_name}/USERDATA/#{@user}") if @user
|
96
|
+
end
|
97
|
+
|
98
|
+
def exec(cmd)
|
99
|
+
Helpers::sys(cmd)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Getch
|
4
|
+
module FileSystem
|
5
|
+
module Zfs
|
6
|
+
module Encrypt
|
7
|
+
class Mount < Getch::FileSystem::Zfs::Encrypt::Device
|
8
|
+
def initialize
|
9
|
+
super
|
10
|
+
@root_dir = MOUNTPOINT
|
11
|
+
@mount = Getch::FileSystem::Mount.new
|
12
|
+
@state = Getch::States.new
|
13
|
+
@log = Getch::Log.new
|
14
|
+
end
|
15
|
+
|
16
|
+
def run
|
17
|
+
return if STATES[:mount]
|
18
|
+
exec("zpool export -a")
|
19
|
+
exec("rm -rf #{MOUNTPOINT}/*")
|
20
|
+
exec("zpool import -N -R #{MOUNTPOINT} #{@pool_name}")
|
21
|
+
exec("zpool import -N -R #{MOUNTPOINT} #{@boot_pool_name}") if @dev_boot
|
22
|
+
exec("zfs load-key -a")
|
23
|
+
@mount.swap(@dev_swap)
|
24
|
+
mount_root
|
25
|
+
mount_boot
|
26
|
+
@mount.esp(@dev_esp)
|
27
|
+
exec("zfs mount -a")
|
28
|
+
@state.mount
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def mount_root
|
34
|
+
Helpers::mkdir(@root_dir)
|
35
|
+
exec("zfs mount #{@pool_name}/ROOT/gentoo")
|
36
|
+
end
|
37
|
+
|
38
|
+
def mount_boot
|
39
|
+
return if ! @dev_boot
|
40
|
+
exec("zfs mount #{@boot_pool_name}/BOOT/gentoo")
|
41
|
+
end
|
42
|
+
|
43
|
+
def exec(cmd)
|
44
|
+
@log.info("==> #{cmd}")
|
45
|
+
Helpers::sys(cmd)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module Getch
|
2
|
+
module FileSystem
|
3
|
+
module Zfs
|
4
|
+
module Encrypt
|
5
|
+
class Partition < Getch::FileSystem::Zfs::Encrypt::Device
|
6
|
+
def initialize
|
7
|
+
super
|
8
|
+
@state = Getch::States.new()
|
9
|
+
@clean = Getch::FileSystem::Clean
|
10
|
+
@partition = Getch::FileSystem::Partition.new
|
11
|
+
@log = Getch::Log.new()
|
12
|
+
run
|
13
|
+
end
|
14
|
+
|
15
|
+
def run
|
16
|
+
return if STATES[:partition ]
|
17
|
+
@clean.old_zpool
|
18
|
+
@clean.struct(@disk, @cache_disk, @home_disk)
|
19
|
+
@clean.hdd(@disk, @cache_disk, @home_disk)
|
20
|
+
partition
|
21
|
+
cache
|
22
|
+
@state.partition
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def partition
|
28
|
+
if Helpers::efi?
|
29
|
+
@partition.efi(@dev_esp)
|
30
|
+
@partition.swap(@dev_swap)
|
31
|
+
@partition.root(@dev_root, "BF00") if @root_part != 1
|
32
|
+
else
|
33
|
+
@partition.gpt(@dev_gpt)
|
34
|
+
@partition.boot(@dev_boot)
|
35
|
+
@partition.swap(@dev_swap)
|
36
|
+
@partition.root(@dev_root, "BF00") if @root_part != 1
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def cache
|
41
|
+
if @dev_log
|
42
|
+
exec("sgdisk -n2:0:+4G -t2:BF07 #{cache_disk}")
|
43
|
+
end
|
44
|
+
if @dev_cache
|
45
|
+
exec("sgdisk -n3:0:0 -t3:BF08 #{cache_disk}")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Partition_efi
|
50
|
+
# /efi - EFI system partition - 260MB
|
51
|
+
# / - Root
|
52
|
+
|
53
|
+
# Partition_bios
|
54
|
+
# None - Bios Boot Partition - 1MiB
|
55
|
+
# /boot - Boot - 8300
|
56
|
+
# / - Root
|
57
|
+
|
58
|
+
def exec(cmd)
|
59
|
+
Helpers::sys(cmd)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
module Getch
|
2
|
+
module FileSystem
|
3
|
+
module Zfs
|
4
|
+
class Format < Getch::FileSystem::Zfs::Device
|
5
|
+
def initialize
|
6
|
+
super
|
7
|
+
@log = Getch::Log.new
|
8
|
+
@state = Getch::States.new
|
9
|
+
if ! @id
|
10
|
+
@log.info "Research pool id for #{@dev_root}..."
|
11
|
+
sleep 2 until Helpers::pool_id(@dev_root)
|
12
|
+
@id = Helpers::pool_id(@dev_root)
|
13
|
+
@boot_pool_name = "bpool-#{@id}"
|
14
|
+
@pool_name = "rpool-#{@id}"
|
15
|
+
end
|
16
|
+
format
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def format
|
22
|
+
return if STATES[:format]
|
23
|
+
raise "Error, no id found for #{@dev_root}." if ! @id
|
24
|
+
@log.info "Create #{@id} for #{@pool_name}"
|
25
|
+
system("mkfs.fat -F32 #{@dev_esp}") if @dev_esp
|
26
|
+
zfs
|
27
|
+
cache
|
28
|
+
datasets
|
29
|
+
@state.format
|
30
|
+
end
|
31
|
+
|
32
|
+
def zfs
|
33
|
+
bloc=`blockdev --getbsz #{@dev_root}`.chomp
|
34
|
+
ashift = case bloc
|
35
|
+
when 8096
|
36
|
+
13
|
37
|
+
when 4096
|
38
|
+
12
|
39
|
+
else # 512
|
40
|
+
9
|
41
|
+
end
|
42
|
+
|
43
|
+
Helpers::mkdir(MOUNTPOINT)
|
44
|
+
@log.debug("ashift found for #{bloc} - #{ashift}")
|
45
|
+
|
46
|
+
if @dev_boot
|
47
|
+
# https://openzfs.github.io/openzfs-docs/Getting%20Started/Ubuntu/Ubuntu%2020.04%20Root%20on%20ZFS.html
|
48
|
+
@log.info("Creating boot pool on #{@pool_name}")
|
49
|
+
exec("zpool create -f \\
|
50
|
+
-o ashift=#{ashift} -o autotrim=on -d \\
|
51
|
+
-o feature@async_destroy=enabled \\
|
52
|
+
-o feature@bookmarks=enabled \\
|
53
|
+
-o feature@embedded_data=enabled \\
|
54
|
+
-o feature@empty_bpobj=enabled \\
|
55
|
+
-o feature@enabled_txg=enabled \\
|
56
|
+
-o feature@extensible_dataset=enabled \\
|
57
|
+
-o feature@filesystem_limits=enabled \\
|
58
|
+
-o feature@hole_birth=enabled \\
|
59
|
+
-o feature@large_blocks=enabled \\
|
60
|
+
-o feature@lz4_compress=enabled \\
|
61
|
+
-o feature@spacemap_histogram=enabled \\
|
62
|
+
-O acltype=posixacl -O canmount=off -O compression=lz4 \\
|
63
|
+
-O devices=off -O normalization=formD -O atime=off -O xattr=sa \\
|
64
|
+
-O mountpoint=/boot -R #{MOUNTPOINT} \\
|
65
|
+
#{@boot_pool_name} #{@dev_boot}
|
66
|
+
")
|
67
|
+
end
|
68
|
+
|
69
|
+
exec("zpool create -f -o ashift=#{ashift} -o autotrim=on \\
|
70
|
+
-O acltype=posixacl -O canmount=off -O compression=lz4 \\
|
71
|
+
-O dnodesize=auto -O normalization=formD -O atime=off \\
|
72
|
+
-O xattr=sa -O mountpoint=/ -R #{MOUNTPOINT} \\
|
73
|
+
#{@pool_name} #{@dev_root}
|
74
|
+
")
|
75
|
+
end
|
76
|
+
|
77
|
+
def cache
|
78
|
+
system("mkswap -f #{@dev_swap}")
|
79
|
+
if @dev_log
|
80
|
+
exec("zpool add #{@pool_name} log #{@dev_log}")
|
81
|
+
end
|
82
|
+
if @dev_cache
|
83
|
+
exec("zpool add #{@pool_name} cache #{@dev_cache}")
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def datasets
|
88
|
+
exec("zfs create -o canmount=off -o mountpoint=none #{@pool_name}/ROOT")
|
89
|
+
exec("zfs create -o canmount=off -o mountpoint=none #{@boot_pool_name}/BOOT") if @dev_boot
|
90
|
+
|
91
|
+
exec("zfs create -o canmount=noauto -o mountpoint=/ #{@pool_name}/ROOT/gentoo")
|
92
|
+
exec("zfs create -o canmount=noauto -o mountpoint=/boot #{@boot_pool_name}/BOOT/gentoo") if @dev_boot
|
93
|
+
|
94
|
+
exec("zfs create -o canmount=off #{@pool_name}/ROOT/gentoo/usr")
|
95
|
+
exec("zfs create #{@pool_name}/ROOT/gentoo/usr/src")
|
96
|
+
exec("zfs create -o canmount=off #{@pool_name}/ROOT/gentoo/var")
|
97
|
+
exec("zfs create #{@pool_name}/ROOT/gentoo/var/log")
|
98
|
+
exec("zfs create #{@pool_name}/ROOT/gentoo/var/db")
|
99
|
+
exec("zfs create #{@pool_name}/ROOT/gentoo/var/tmp")
|
100
|
+
|
101
|
+
exec("zfs create -o canmount=off -o mountpoint=/ #{@pool_name}/USERDATA")
|
102
|
+
exec("zfs create -o canmount=on -o mountpoint=/root #{@pool_name}/USERDATA/root")
|
103
|
+
if @user
|
104
|
+
exec("zfs create -o canmount=on -o mountpoint=/home/#{@user} #{@pool_name}/USERDATA/#{@user}")
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def exec(cmd)
|
109
|
+
Getch::Command.new(cmd).run!
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Getch
|
4
|
+
module FileSystem
|
5
|
+
module Zfs
|
6
|
+
class Mount < Getch::FileSystem::Zfs::Device
|
7
|
+
def initialize
|
8
|
+
super
|
9
|
+
@root_dir = MOUNTPOINT
|
10
|
+
@mount = Getch::FileSystem::Mount.new
|
11
|
+
@state = Getch::States.new
|
12
|
+
@log = Getch::Log.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def run
|
16
|
+
return if STATES[:mount]
|
17
|
+
exec("zpool export -a")
|
18
|
+
exec("rm -rf #{MOUNTPOINT}/*")
|
19
|
+
exec("zpool import -N -R #{MOUNTPOINT} #{@pool_name}")
|
20
|
+
exec("zpool import -N -R #{MOUNTPOINT} #{@boot_pool_name}") if @dev_boot
|
21
|
+
@mount.swap(@dev_swap)
|
22
|
+
mount_root
|
23
|
+
mount_boot
|
24
|
+
@mount.esp(@dev_esp)
|
25
|
+
exec("zfs mount -a")
|
26
|
+
@state.mount
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def mount_root
|
32
|
+
Helpers::mkdir(@root_dir)
|
33
|
+
exec("zfs mount #{@pool_name}/ROOT/gentoo")
|
34
|
+
end
|
35
|
+
|
36
|
+
def mount_boot
|
37
|
+
return if ! @dev_boot
|
38
|
+
exec("zfs mount #{@boot_pool_name}/BOOT/gentoo")
|
39
|
+
end
|
40
|
+
|
41
|
+
def exec(cmd)
|
42
|
+
@log.info("==> #{cmd}")
|
43
|
+
Helpers::sys(cmd)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module Getch
|
2
|
+
module FileSystem
|
3
|
+
module Zfs
|
4
|
+
class Partition < Getch::FileSystem::Zfs::Device
|
5
|
+
def initialize
|
6
|
+
super
|
7
|
+
@clean = Getch::FileSystem::Clean
|
8
|
+
@partition = Getch::FileSystem::Partition.new
|
9
|
+
@state = Getch::States.new()
|
10
|
+
@log = Getch::Log.new()
|
11
|
+
run_partition
|
12
|
+
end
|
13
|
+
|
14
|
+
def run_partition
|
15
|
+
return if STATES[:partition ]
|
16
|
+
@clean.old_zpool
|
17
|
+
@clean.struct(@disk, @cache_disk, @home_disk)
|
18
|
+
@clean.hdd(@disk, @cache_disk, @home_disk)
|
19
|
+
partition
|
20
|
+
cache
|
21
|
+
@state.partition
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def partition
|
27
|
+
if @efi
|
28
|
+
@partition.efi(@dev_esp)
|
29
|
+
@partition.swap(@dev_swap)
|
30
|
+
@partition.root(@dev_root, "BF00") if @root_part != 1
|
31
|
+
else
|
32
|
+
@partition.gpt(@dev_gpt)
|
33
|
+
# Boot pool for GRUB2
|
34
|
+
@partition.boot(@dev_boot)
|
35
|
+
@partition.swap(@dev_swap)
|
36
|
+
@partition.root(@dev_root, "BF00") if @root_part != 1
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def cache
|
41
|
+
if @dev_log
|
42
|
+
exec("sgdisk -n2:0:+4G -t2:BF07 #{cache_disk}")
|
43
|
+
end
|
44
|
+
if @dev_cache
|
45
|
+
exec("sgdisk -n3:0:0 -t3:BF08 #{cache_disk}")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Partition_efi
|
50
|
+
# /efi - EFI system partition - 260MB
|
51
|
+
# / - Root
|
52
|
+
|
53
|
+
# Partition_bios
|
54
|
+
# None - Bios Boot Partition - 1MiB
|
55
|
+
# /boot - Boot - 8300
|
56
|
+
# / - Root
|
57
|
+
|
58
|
+
def exec(cmd)
|
59
|
+
Getch::Command.new(cmd).run!
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|