getch 0.1.9 → 0.3.0
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/README.md +35 -29
- data/bin/getch +8 -6
- data/lib/clean.rb +149 -0
- data/lib/cryptsetup.rb +132 -0
- data/lib/devs.rb +199 -0
- data/lib/dracut/encrypt.rb +36 -0
- data/lib/dracut/hybrid.rb +15 -0
- data/lib/dracut/lvm.rb +14 -0
- data/lib/dracut/minimal.rb +11 -0
- data/lib/dracut/root.rb +45 -0
- data/lib/dracut/zfs.rb +35 -0
- data/lib/dracut.rb +11 -0
- data/lib/fstab/encrypt.rb +44 -0
- data/lib/fstab/hybrid.rb +34 -0
- data/lib/fstab/lvm.rb +25 -0
- data/lib/fstab/minimal.rb +6 -0
- data/lib/fstab/root.rb +93 -0
- data/lib/fstab/zfs.rb +23 -0
- data/lib/fstab.rb +11 -0
- data/lib/getch/assembly.rb +150 -0
- data/lib/getch/command.rb +88 -128
- data/lib/getch/config/account.rb +39 -0
- data/lib/getch/config/dhcp.rb +104 -0
- data/lib/getch/config/grub.rb +42 -0
- data/lib/getch/config/iwd.rb +60 -0
- data/lib/getch/config/keymap.rb +78 -0
- data/lib/getch/config/locale.rb +96 -0
- data/lib/getch/config/portage.rb +90 -0
- data/lib/getch/config/pre_network.rb +37 -0
- data/lib/getch/config/timezone.rb +52 -0
- data/lib/getch/config/void.rb +0 -36
- data/lib/getch/config.rb +16 -37
- data/lib/getch/device.rb +67 -0
- data/lib/getch/filesystem/ext4/encrypt/config.rb +9 -71
- data/lib/getch/filesystem/ext4/encrypt/deps.rb +15 -25
- data/lib/getch/filesystem/ext4/encrypt/device.rb +11 -5
- data/lib/getch/filesystem/ext4/encrypt/format.rb +6 -15
- data/lib/getch/filesystem/ext4/encrypt/mount.rb +7 -11
- data/lib/getch/filesystem/ext4/encrypt/partition.rb +10 -76
- data/lib/getch/filesystem/ext4/encrypt/void.rb +0 -38
- data/lib/getch/filesystem/ext4/encrypt.rb +2 -1
- data/lib/getch/filesystem/ext4/hybrid/config.rb +27 -0
- data/lib/getch/filesystem/ext4/hybrid/deps.rb +55 -0
- data/lib/getch/filesystem/ext4/hybrid/device.rb +24 -0
- data/lib/getch/filesystem/ext4/hybrid/format.rb +23 -0
- data/lib/getch/filesystem/ext4/hybrid/mount.rb +21 -0
- data/lib/getch/filesystem/ext4/hybrid/partition.rb +27 -0
- data/lib/getch/filesystem/{lvm/encrypt → ext4/hybrid}/void.rb +0 -39
- data/lib/getch/filesystem/ext4/hybrid.rb +19 -0
- data/lib/getch/filesystem/ext4/lvm/config.rb +25 -0
- data/lib/getch/filesystem/ext4/lvm/deps.rb +56 -0
- data/lib/getch/filesystem/ext4/lvm/device.rb +28 -0
- data/lib/getch/filesystem/ext4/lvm/format.rb +21 -0
- data/lib/getch/filesystem/ext4/lvm/mount.rb +21 -0
- data/lib/getch/filesystem/ext4/lvm/partition.rb +28 -0
- data/lib/getch/filesystem/{lvm.rb → ext4/lvm.rb} +6 -4
- data/lib/getch/filesystem/ext4/minimal/config.rb +25 -0
- data/lib/getch/filesystem/ext4/{device.rb → minimal/deps.rb} +3 -1
- data/lib/getch/filesystem/ext4/minimal/device.rb +22 -0
- data/lib/getch/filesystem/ext4/minimal/format.rb +23 -0
- data/lib/getch/filesystem/ext4/minimal/mount.rb +21 -0
- data/lib/getch/filesystem/ext4/minimal/partition.rb +28 -0
- data/lib/getch/filesystem/ext4/minimal.rb +19 -0
- data/lib/getch/filesystem/ext4.rb +7 -7
- data/lib/getch/filesystem/zfs/encrypt/config.rb +10 -39
- data/lib/getch/filesystem/zfs/encrypt/deps.rb +4 -55
- data/lib/getch/filesystem/zfs/encrypt/device.rb +7 -51
- data/lib/getch/filesystem/zfs/encrypt/format.rb +6 -90
- data/lib/getch/filesystem/zfs/encrypt/mount.rb +16 -35
- data/lib/getch/filesystem/zfs/encrypt/partition.rb +6 -54
- data/lib/getch/filesystem/zfs/encrypt.rb +2 -1
- data/lib/getch/filesystem/zfs/minimal/config.rb +37 -0
- data/lib/getch/filesystem/zfs/minimal/deps.rb +126 -0
- data/lib/getch/filesystem/zfs/minimal/device.rb +24 -0
- data/lib/getch/filesystem/zfs/minimal/format.rb +23 -0
- data/lib/getch/filesystem/zfs/minimal/mount.rb +23 -0
- data/lib/getch/filesystem/zfs/minimal/partition.rb +23 -0
- data/lib/getch/filesystem/zfs/minimal.rb +19 -0
- data/lib/getch/filesystem/zfs.rb +1 -7
- data/lib/getch/filesystem.rb +0 -6
- data/lib/getch/gentoo/bootloader.rb +23 -44
- data/lib/getch/gentoo/finalize.rb +25 -0
- data/lib/getch/gentoo/post_config.rb +75 -0
- data/lib/getch/gentoo/pre_config.rb +37 -0
- data/lib/getch/gentoo/services.rb +18 -0
- data/lib/getch/gentoo/sources.rb +39 -33
- data/lib/getch/gentoo/tarball.rb +91 -0
- data/lib/getch/gentoo/terraform.rb +34 -0
- data/lib/getch/gentoo/update.rb +54 -0
- data/lib/getch/gentoo/use.rb +9 -6
- data/lib/getch/gentoo/use_flag.rb +17 -20
- data/lib/getch/gentoo.rb +9 -75
- data/lib/getch/guard.rb +2 -2
- data/lib/getch/helpers.rb +63 -115
- data/lib/getch/log.rb +87 -25
- data/lib/getch/options.rb +41 -11
- data/lib/getch/states.rb +28 -8
- data/lib/getch/tree.rb +56 -0
- data/lib/getch/version.rb +1 -1
- data/lib/getch/void/bootloader.rb +18 -0
- data/lib/getch/void/finalize.rb +31 -0
- data/lib/getch/void/post_config.rb +19 -0
- data/lib/getch/void/pre_config.rb +18 -0
- data/lib/getch/void/services.rb +18 -0
- data/lib/getch/void/{stage.rb → tarball.rb} +34 -14
- data/lib/getch/void/terraform.rb +28 -0
- data/lib/getch/void/update.rb +33 -0
- data/lib/getch/void.rb +9 -59
- data/lib/getch.rb +58 -90
- data/lib/luks.rb +239 -0
- data/lib/lvm2.rb +112 -0
- data/lib/mkfs/zfs.rb +167 -0
- data/lib/mkfs.rb +140 -0
- data/lib/mountfs.rb +154 -0
- data/lib/nito.rb +131 -0
- data/lib/sgdisk.rb +160 -0
- data.tar.gz.sig +0 -0
- metadata +83 -47
- metadata.gz.sig +0 -0
- data/lib/getch/config/gentoo.rb +0 -58
- data/lib/getch/filesystem/clean.rb +0 -58
- data/lib/getch/filesystem/device.rb +0 -63
- data/lib/getch/filesystem/ext4/config.rb +0 -62
- data/lib/getch/filesystem/ext4/deps.rb +0 -24
- data/lib/getch/filesystem/ext4/format.rb +0 -31
- data/lib/getch/filesystem/ext4/mount.rb +0 -26
- data/lib/getch/filesystem/ext4/partition.rb +0 -55
- data/lib/getch/filesystem/ext4/void.rb +0 -44
- data/lib/getch/filesystem/lvm/config.rb +0 -44
- data/lib/getch/filesystem/lvm/deps.rb +0 -44
- data/lib/getch/filesystem/lvm/device.rb +0 -45
- data/lib/getch/filesystem/lvm/encrypt/config.rb +0 -74
- data/lib/getch/filesystem/lvm/encrypt/deps.rb +0 -49
- data/lib/getch/filesystem/lvm/encrypt/device.rb +0 -48
- data/lib/getch/filesystem/lvm/encrypt/format.rb +0 -35
- data/lib/getch/filesystem/lvm/encrypt/mount.rb +0 -27
- data/lib/getch/filesystem/lvm/encrypt/partition.rb +0 -84
- data/lib/getch/filesystem/lvm/encrypt.rb +0 -18
- data/lib/getch/filesystem/lvm/format.rb +0 -32
- data/lib/getch/filesystem/lvm/mount.rb +0 -26
- data/lib/getch/filesystem/lvm/partition.rb +0 -72
- data/lib/getch/filesystem/lvm/void.rb +0 -46
- data/lib/getch/filesystem/mount.rb +0 -63
- data/lib/getch/filesystem/partition.rb +0 -85
- data/lib/getch/filesystem/zfs/config.rb +0 -43
- data/lib/getch/filesystem/zfs/deps.rb +0 -67
- data/lib/getch/filesystem/zfs/device.rb +0 -66
- data/lib/getch/filesystem/zfs/encrypt/void.rb +0 -97
- data/lib/getch/filesystem/zfs/format.rb +0 -117
- data/lib/getch/filesystem/zfs/mount.rb +0 -47
- data/lib/getch/filesystem/zfs/partition.rb +0 -69
- data/lib/getch/filesystem/zfs/void.rb +0 -81
- data/lib/getch/gentoo/boot.rb +0 -64
- data/lib/getch/gentoo/chroot.rb +0 -75
- data/lib/getch/gentoo/config.rb +0 -167
- data/lib/getch/gentoo/stage.rb +0 -73
- data/lib/getch/void/boot.rb +0 -84
- data/lib/getch/void/chroot.rb +0 -56
- data/lib/getch/void/config.rb +0 -90
data/lib/sgdisk.rb
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'getch/command'
|
4
|
+
require 'getch/helpers'
|
5
|
+
|
6
|
+
module Sgdisk
|
7
|
+
class Root
|
8
|
+
def initialize(devs)
|
9
|
+
@gpt = devs[:gpt] ||= nil
|
10
|
+
@efi = devs[:efi] ||= nil
|
11
|
+
@boot = devs[:boot] ||= nil
|
12
|
+
@swap = devs[:swap] ||= nil
|
13
|
+
@root = devs[:root] ||= nil
|
14
|
+
@home = devs[:home] ||= nil
|
15
|
+
load_codes
|
16
|
+
x
|
17
|
+
end
|
18
|
+
|
19
|
+
protected
|
20
|
+
|
21
|
+
def x
|
22
|
+
make_gpt
|
23
|
+
make_efi
|
24
|
+
make_boot
|
25
|
+
make_swap
|
26
|
+
make_root
|
27
|
+
make_home
|
28
|
+
end
|
29
|
+
|
30
|
+
def make_gpt
|
31
|
+
@gpt || return
|
32
|
+
|
33
|
+
partition @gpt, @gpt_code, '1MiB:+1MiB'
|
34
|
+
end
|
35
|
+
|
36
|
+
def make_efi
|
37
|
+
@efi || return
|
38
|
+
|
39
|
+
partition @efi, @efi_code, '1M:+260M'
|
40
|
+
end
|
41
|
+
|
42
|
+
def make_boot
|
43
|
+
@boot || return
|
44
|
+
|
45
|
+
partition @boot, @boot_code, '0:+256MiB'
|
46
|
+
end
|
47
|
+
|
48
|
+
def make_swap
|
49
|
+
@swap || return
|
50
|
+
|
51
|
+
mem = Getch::Helpers.get_memory
|
52
|
+
partition @swap, @swap_code, "0:+#{mem}"
|
53
|
+
end
|
54
|
+
|
55
|
+
# Align the end
|
56
|
+
# https://unix.stackexchange.com/questions/588930/sgdisk-force-alignment-of-end-sector
|
57
|
+
# https://gitlab.com/cryptsetup/cryptsetup/-/issues/585
|
58
|
+
def make_root
|
59
|
+
@root || return
|
60
|
+
|
61
|
+
return unless @root =~ /[0-9]/
|
62
|
+
|
63
|
+
finish = end_sector @root
|
64
|
+
partition @root, @root_code, "0:#{finish}"
|
65
|
+
end
|
66
|
+
|
67
|
+
def make_home
|
68
|
+
@home || return
|
69
|
+
|
70
|
+
return unless @home =~ /[0-9]/
|
71
|
+
|
72
|
+
finish = end_sector @home
|
73
|
+
partition @home, @home_code, "0:#{finish}"
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
# sgdisk -L
|
79
|
+
def load_codes
|
80
|
+
@gpt_code = 'ef02'
|
81
|
+
@efi_code = 'ef00'
|
82
|
+
@boot_code = '8300'
|
83
|
+
@swap_code = '8200'
|
84
|
+
@root_code = '8304'
|
85
|
+
@home_code = '8302'
|
86
|
+
end
|
87
|
+
|
88
|
+
# e.g: partition sda1, 'ef02', '1Mib:+1MiB'
|
89
|
+
def partition(disk, code, sectors)
|
90
|
+
d = disk[/^[a-z]+/]
|
91
|
+
p = disk[/[0-9]{1}$/]
|
92
|
+
args = "-n#{p}:#{sectors} -t#{p}:#{code} /dev/#{d}"
|
93
|
+
|
94
|
+
Getch::Command.new('sgdisk', args)
|
95
|
+
end
|
96
|
+
|
97
|
+
def end_sector(dev)
|
98
|
+
disk = dev[/^[a-z]+/]
|
99
|
+
cmd = Getch::Command.new("sgdisk -E /dev/#{disk}")
|
100
|
+
end_position = cmd.res.to_i
|
101
|
+
( end_position - ( end_position + 1 ) % 2048 )
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
class Ext4 < Root
|
106
|
+
end
|
107
|
+
|
108
|
+
class Lvm < Root
|
109
|
+
def load_codes
|
110
|
+
super
|
111
|
+
@root_code = '8e00'
|
112
|
+
@home_code = '8e00'
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
class Encrypt < Root
|
117
|
+
def load_codes
|
118
|
+
super
|
119
|
+
@boot_code = '8309'
|
120
|
+
@root_code = '8309'
|
121
|
+
@home_code = '8309'
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
class Zfs < Root
|
126
|
+
def load_codes
|
127
|
+
super
|
128
|
+
@boot_code = 'be00'
|
129
|
+
@root_code = 'bf00'
|
130
|
+
@home_code = 'bf05'
|
131
|
+
@zlog_code = 'bf07'
|
132
|
+
@zcache_code = 'bf08'
|
133
|
+
end
|
134
|
+
|
135
|
+
def make_boot
|
136
|
+
@boot || return
|
137
|
+
|
138
|
+
partition @boot, @boot_code, '0:+2G'
|
139
|
+
end
|
140
|
+
|
141
|
+
def make_swap
|
142
|
+
mem = Getch::Helpers.get_memory
|
143
|
+
partition @swap, @swap_code, "0:+#{mem}"
|
144
|
+
add_zlog
|
145
|
+
add_zcache
|
146
|
+
end
|
147
|
+
|
148
|
+
def add_zlog
|
149
|
+
@zlog || return
|
150
|
+
|
151
|
+
partition @zlog, @zlog_code, '0:+4G'
|
152
|
+
end
|
153
|
+
|
154
|
+
def add_zcache
|
155
|
+
@zcache || return
|
156
|
+
|
157
|
+
partition @zcache, @zcache_code, '0:0'
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: getch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- szorfein
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
F9Dl4EPzjBJOgQWf+NxzxNuNKI46Lp5Q8AI+xtDUHAPbSswHa40BA6ChFehP+j0L
|
36
36
|
fg==
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2022-
|
38
|
+
date: 2022-02-17 00:00:00.000000000 Z
|
39
39
|
dependencies: []
|
40
40
|
description:
|
41
41
|
email:
|
@@ -50,19 +50,41 @@ files:
|
|
50
50
|
- assets/network-stack.conf
|
51
51
|
- assets/system.conf
|
52
52
|
- bin/getch
|
53
|
+
- lib/clean.rb
|
53
54
|
- lib/cmdline.rb
|
55
|
+
- lib/cryptsetup.rb
|
56
|
+
- lib/devs.rb
|
57
|
+
- lib/dracut.rb
|
58
|
+
- lib/dracut/encrypt.rb
|
59
|
+
- lib/dracut/hybrid.rb
|
60
|
+
- lib/dracut/lvm.rb
|
61
|
+
- lib/dracut/minimal.rb
|
62
|
+
- lib/dracut/root.rb
|
63
|
+
- lib/dracut/zfs.rb
|
64
|
+
- lib/fstab.rb
|
65
|
+
- lib/fstab/encrypt.rb
|
66
|
+
- lib/fstab/hybrid.rb
|
67
|
+
- lib/fstab/lvm.rb
|
68
|
+
- lib/fstab/minimal.rb
|
69
|
+
- lib/fstab/root.rb
|
70
|
+
- lib/fstab/zfs.rb
|
54
71
|
- lib/getch.rb
|
72
|
+
- lib/getch/assembly.rb
|
55
73
|
- lib/getch/command.rb
|
56
74
|
- lib/getch/config.rb
|
57
|
-
- lib/getch/config/
|
75
|
+
- lib/getch/config/account.rb
|
76
|
+
- lib/getch/config/dhcp.rb
|
77
|
+
- lib/getch/config/grub.rb
|
78
|
+
- lib/getch/config/iwd.rb
|
79
|
+
- lib/getch/config/keymap.rb
|
80
|
+
- lib/getch/config/locale.rb
|
81
|
+
- lib/getch/config/portage.rb
|
82
|
+
- lib/getch/config/pre_network.rb
|
83
|
+
- lib/getch/config/timezone.rb
|
58
84
|
- lib/getch/config/void.rb
|
85
|
+
- lib/getch/device.rb
|
59
86
|
- lib/getch/filesystem.rb
|
60
|
-
- lib/getch/filesystem/clean.rb
|
61
|
-
- lib/getch/filesystem/device.rb
|
62
87
|
- lib/getch/filesystem/ext4.rb
|
63
|
-
- lib/getch/filesystem/ext4/config.rb
|
64
|
-
- lib/getch/filesystem/ext4/deps.rb
|
65
|
-
- lib/getch/filesystem/ext4/device.rb
|
66
88
|
- lib/getch/filesystem/ext4/encrypt.rb
|
67
89
|
- lib/getch/filesystem/ext4/encrypt/config.rb
|
68
90
|
- lib/getch/filesystem/ext4/encrypt/deps.rb
|
@@ -71,32 +93,29 @@ files:
|
|
71
93
|
- lib/getch/filesystem/ext4/encrypt/mount.rb
|
72
94
|
- lib/getch/filesystem/ext4/encrypt/partition.rb
|
73
95
|
- lib/getch/filesystem/ext4/encrypt/void.rb
|
74
|
-
- lib/getch/filesystem/ext4/
|
75
|
-
- lib/getch/filesystem/ext4/
|
76
|
-
- lib/getch/filesystem/ext4/
|
77
|
-
- lib/getch/filesystem/ext4/
|
78
|
-
- lib/getch/filesystem/
|
79
|
-
- lib/getch/filesystem/
|
80
|
-
- lib/getch/filesystem/
|
81
|
-
- lib/getch/filesystem/
|
82
|
-
- lib/getch/filesystem/lvm
|
83
|
-
- lib/getch/filesystem/lvm/
|
84
|
-
- lib/getch/filesystem/lvm/
|
85
|
-
- lib/getch/filesystem/lvm/
|
86
|
-
- lib/getch/filesystem/lvm/
|
87
|
-
- lib/getch/filesystem/lvm/
|
88
|
-
- lib/getch/filesystem/lvm/
|
89
|
-
- lib/getch/filesystem/
|
90
|
-
- lib/getch/filesystem/
|
91
|
-
- lib/getch/filesystem/
|
92
|
-
- lib/getch/filesystem/
|
93
|
-
- lib/getch/filesystem/
|
94
|
-
- lib/getch/filesystem/mount.rb
|
95
|
-
- lib/getch/filesystem/partition.rb
|
96
|
+
- lib/getch/filesystem/ext4/hybrid.rb
|
97
|
+
- lib/getch/filesystem/ext4/hybrid/config.rb
|
98
|
+
- lib/getch/filesystem/ext4/hybrid/deps.rb
|
99
|
+
- lib/getch/filesystem/ext4/hybrid/device.rb
|
100
|
+
- lib/getch/filesystem/ext4/hybrid/format.rb
|
101
|
+
- lib/getch/filesystem/ext4/hybrid/mount.rb
|
102
|
+
- lib/getch/filesystem/ext4/hybrid/partition.rb
|
103
|
+
- lib/getch/filesystem/ext4/hybrid/void.rb
|
104
|
+
- lib/getch/filesystem/ext4/lvm.rb
|
105
|
+
- lib/getch/filesystem/ext4/lvm/config.rb
|
106
|
+
- lib/getch/filesystem/ext4/lvm/deps.rb
|
107
|
+
- lib/getch/filesystem/ext4/lvm/device.rb
|
108
|
+
- lib/getch/filesystem/ext4/lvm/format.rb
|
109
|
+
- lib/getch/filesystem/ext4/lvm/mount.rb
|
110
|
+
- lib/getch/filesystem/ext4/lvm/partition.rb
|
111
|
+
- lib/getch/filesystem/ext4/minimal.rb
|
112
|
+
- lib/getch/filesystem/ext4/minimal/config.rb
|
113
|
+
- lib/getch/filesystem/ext4/minimal/deps.rb
|
114
|
+
- lib/getch/filesystem/ext4/minimal/device.rb
|
115
|
+
- lib/getch/filesystem/ext4/minimal/format.rb
|
116
|
+
- lib/getch/filesystem/ext4/minimal/mount.rb
|
117
|
+
- lib/getch/filesystem/ext4/minimal/partition.rb
|
96
118
|
- lib/getch/filesystem/zfs.rb
|
97
|
-
- lib/getch/filesystem/zfs/config.rb
|
98
|
-
- lib/getch/filesystem/zfs/deps.rb
|
99
|
-
- lib/getch/filesystem/zfs/device.rb
|
100
119
|
- lib/getch/filesystem/zfs/encrypt.rb
|
101
120
|
- lib/getch/filesystem/zfs/encrypt/config.rb
|
102
121
|
- lib/getch/filesystem/zfs/encrypt/deps.rb
|
@@ -104,18 +123,23 @@ files:
|
|
104
123
|
- lib/getch/filesystem/zfs/encrypt/format.rb
|
105
124
|
- lib/getch/filesystem/zfs/encrypt/mount.rb
|
106
125
|
- lib/getch/filesystem/zfs/encrypt/partition.rb
|
107
|
-
- lib/getch/filesystem/zfs/
|
108
|
-
- lib/getch/filesystem/zfs/
|
109
|
-
- lib/getch/filesystem/zfs/
|
110
|
-
- lib/getch/filesystem/zfs/
|
111
|
-
- lib/getch/filesystem/zfs/
|
126
|
+
- lib/getch/filesystem/zfs/minimal.rb
|
127
|
+
- lib/getch/filesystem/zfs/minimal/config.rb
|
128
|
+
- lib/getch/filesystem/zfs/minimal/deps.rb
|
129
|
+
- lib/getch/filesystem/zfs/minimal/device.rb
|
130
|
+
- lib/getch/filesystem/zfs/minimal/format.rb
|
131
|
+
- lib/getch/filesystem/zfs/minimal/mount.rb
|
132
|
+
- lib/getch/filesystem/zfs/minimal/partition.rb
|
112
133
|
- lib/getch/gentoo.rb
|
113
|
-
- lib/getch/gentoo/boot.rb
|
114
134
|
- lib/getch/gentoo/bootloader.rb
|
115
|
-
- lib/getch/gentoo/
|
116
|
-
- lib/getch/gentoo/
|
135
|
+
- lib/getch/gentoo/finalize.rb
|
136
|
+
- lib/getch/gentoo/post_config.rb
|
137
|
+
- lib/getch/gentoo/pre_config.rb
|
138
|
+
- lib/getch/gentoo/services.rb
|
117
139
|
- lib/getch/gentoo/sources.rb
|
118
|
-
- lib/getch/gentoo/
|
140
|
+
- lib/getch/gentoo/tarball.rb
|
141
|
+
- lib/getch/gentoo/terraform.rb
|
142
|
+
- lib/getch/gentoo/update.rb
|
119
143
|
- lib/getch/gentoo/use.rb
|
120
144
|
- lib/getch/gentoo/use_flag.rb
|
121
145
|
- lib/getch/guard.rb
|
@@ -123,12 +147,24 @@ files:
|
|
123
147
|
- lib/getch/log.rb
|
124
148
|
- lib/getch/options.rb
|
125
149
|
- lib/getch/states.rb
|
150
|
+
- lib/getch/tree.rb
|
126
151
|
- lib/getch/version.rb
|
127
152
|
- lib/getch/void.rb
|
128
|
-
- lib/getch/void/
|
129
|
-
- lib/getch/void/
|
130
|
-
- lib/getch/void/
|
131
|
-
- lib/getch/void/
|
153
|
+
- lib/getch/void/bootloader.rb
|
154
|
+
- lib/getch/void/finalize.rb
|
155
|
+
- lib/getch/void/post_config.rb
|
156
|
+
- lib/getch/void/pre_config.rb
|
157
|
+
- lib/getch/void/services.rb
|
158
|
+
- lib/getch/void/tarball.rb
|
159
|
+
- lib/getch/void/terraform.rb
|
160
|
+
- lib/getch/void/update.rb
|
161
|
+
- lib/luks.rb
|
162
|
+
- lib/lvm2.rb
|
163
|
+
- lib/mkfs.rb
|
164
|
+
- lib/mkfs/zfs.rb
|
165
|
+
- lib/mountfs.rb
|
166
|
+
- lib/nito.rb
|
167
|
+
- lib/sgdisk.rb
|
132
168
|
homepage: https://github.com/szorfein/getch
|
133
169
|
licenses:
|
134
170
|
- MIT
|
@@ -155,5 +191,5 @@ requirements: []
|
|
155
191
|
rubygems_version: 3.2.32
|
156
192
|
signing_key:
|
157
193
|
specification_version: 4
|
158
|
-
summary: A CLI tool to install Gentoo
|
194
|
+
summary: A CLI tool to install Gentoo or VoidLinux.
|
159
195
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|
data/lib/getch/config/gentoo.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Getch
|
4
|
-
module Config
|
5
|
-
class Gentoo
|
6
|
-
def initialize
|
7
|
-
@systemd_net_dir = "#{MOUNTPOINT}/etc/systemd"
|
8
|
-
end
|
9
|
-
|
10
|
-
def ethernet
|
11
|
-
conf = "#{@systemd_net_dir}/network/20-ethernet.network"
|
12
|
-
datas = [
|
13
|
-
'[Match]',
|
14
|
-
'Name=en*',
|
15
|
-
'Name=eth*',
|
16
|
-
'[Network]',
|
17
|
-
'DHCP=yes',
|
18
|
-
'IPv6PrivacyExtensions=yes',
|
19
|
-
'[DHCP]',
|
20
|
-
'RouteMetric=512',
|
21
|
-
]
|
22
|
-
File.write(conf, datas.join("\n"), mode: 'w')
|
23
|
-
end
|
24
|
-
|
25
|
-
def wifi
|
26
|
-
conf = "#{@systemd_net_dir}/network/20-wireless.network"
|
27
|
-
datas = [
|
28
|
-
'[Match]',
|
29
|
-
'Name=wlp*',
|
30
|
-
'Name=wlan*',
|
31
|
-
'[Network]',
|
32
|
-
'DHCP=yes',
|
33
|
-
'IPv6PrivacyExtensions=yes',
|
34
|
-
'[DHCP]',
|
35
|
-
'RouteMetric=1024',
|
36
|
-
]
|
37
|
-
File.write(conf, datas.join("\n"), mode: 'w')
|
38
|
-
end
|
39
|
-
|
40
|
-
def dns
|
41
|
-
conf = "#{@systemd_net_dir}/resolved.conf.d/dns_over_tls.conf"
|
42
|
-
datas = [
|
43
|
-
'[Resolve]',
|
44
|
-
'DNS=9.9.9.9#dns.quad9.net',
|
45
|
-
'DNSOverTLS=yes',
|
46
|
-
]
|
47
|
-
Helpers.create_dir("#{@systemd_net_dir}/resolved.conf.d")
|
48
|
-
File.write(conf, datas.join("\n"), mode: 'w')
|
49
|
-
|
50
|
-
Getch::Chroot.new('systemctl enable systemd-networkd').run!
|
51
|
-
Getch::Chroot.new('systemctl enable systemd-resolved').run!
|
52
|
-
end
|
53
|
-
|
54
|
-
def shell
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
module Getch
|
2
|
-
module FileSystem
|
3
|
-
module Clean
|
4
|
-
def self.clean_hdd(disk)
|
5
|
-
return unless disk
|
6
|
-
raise ArgumentError, "Disk #{disk} is no found." if ! File.exist? "/dev/#{disk}"
|
7
|
-
|
8
|
-
puts
|
9
|
-
print "Cleaning data on #{disk}, can be long, avoid this on Flash Memory (SSD,USB,...) ? [y,N] "
|
10
|
-
case gets.chomp
|
11
|
-
when /^y|^Y/
|
12
|
-
bloc=`blockdev --getbsz /dev/#{disk}`.chomp
|
13
|
-
Helpers.sys("dd if=/dev/urandom of=/dev/#{disk} bs=#{bloc} status=progress")
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.clean_struct(disk)
|
18
|
-
return unless disk
|
19
|
-
raise ArgumentError, "Disk #{disk} is no found." unless File.exist? "/dev/#{disk}"
|
20
|
-
|
21
|
-
Helpers.sys("sgdisk -Z /dev/#{disk}")
|
22
|
-
Helpers.sys("wipefs -a /dev/#{disk}")
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.hdd(*disks)
|
26
|
-
disks.each { |d|
|
27
|
-
clean_struct(d)
|
28
|
-
clean_hdd(d)
|
29
|
-
}
|
30
|
-
end
|
31
|
-
# See https://wiki.archlinux.org/index.php/Solid_state_drive/Memory_cell_clearing
|
32
|
-
# for SSD
|
33
|
-
def self.sdd
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.external_disk(root_disk, *disks)
|
37
|
-
disks.each do |d|
|
38
|
-
unless d && d != '' && d != nil && d == root_disk
|
39
|
-
hdd(d)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.old_vg(disk, vg)
|
45
|
-
oldvg = `vgdisplay | grep #{vg}`.chomp
|
46
|
-
Helpers.sys("vgremove -f #{vg}") if oldvg != ''
|
47
|
-
Helpers.sys("pvremove -f #{disk}") if oldvg != '' and File.exist? disk
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.old_zpool
|
51
|
-
oldzpool = `zpool status | grep pool:`.gsub(/pool: /, '').delete(' ').split("\n")
|
52
|
-
if oldzpool[0] != '' and $?.success?
|
53
|
-
oldzpool.each { |p| Helpers.sys("zpool destroy #{p}") if p }
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Getch
|
4
|
-
module FileSystem
|
5
|
-
class Device
|
6
|
-
def initialize
|
7
|
-
@efi = Helpers.efi?
|
8
|
-
@root_part = 1
|
9
|
-
@user = Getch::OPTIONS[:username]
|
10
|
-
|
11
|
-
@disk = Getch::OPTIONS[:disk]
|
12
|
-
@boot_disk = Getch::OPTIONS[:boot_disk]
|
13
|
-
@cache_disk = Getch::OPTIONS[:cache_disk]
|
14
|
-
@home_disk = Getch::OPTIONS[:home_disk]
|
15
|
-
|
16
|
-
search_boot
|
17
|
-
search_swap
|
18
|
-
search_root
|
19
|
-
search_home
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
def search_boot
|
24
|
-
if @efi
|
25
|
-
if @boot_disk
|
26
|
-
@dev_esp = "/dev/#{@boot_disk}#{@root_part}"
|
27
|
-
else
|
28
|
-
@dev_esp = "/dev/#{@disk}#{@root_part}"
|
29
|
-
@root_part += 1
|
30
|
-
end
|
31
|
-
else
|
32
|
-
if @boot_disk
|
33
|
-
@dev_gpt = "/dev/#{@boot_disk}#{@root_part}"
|
34
|
-
@dev_grub = "/dev/#{@boot_disk}"
|
35
|
-
else
|
36
|
-
@dev_gpt = "/dev/#{@disk}#{@root_part}"
|
37
|
-
@dev_grub = "/dev/#{@disk}"
|
38
|
-
@root_part += 1
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def search_swap
|
44
|
-
if @cache_disk
|
45
|
-
@dev_swap = "/dev/#{@cache_disk}1"
|
46
|
-
else
|
47
|
-
@dev_swap = "/dev/#{@disk}#{@root_part}"
|
48
|
-
@root_part += 1
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def search_root
|
53
|
-
@dev_root = "/dev/#{@disk}#{@root_part}"
|
54
|
-
end
|
55
|
-
|
56
|
-
def search_home
|
57
|
-
if @home_disk
|
58
|
-
@dev_home = "/dev/#{@home_disk}1"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Getch
|
4
|
-
module FileSystem
|
5
|
-
module Ext4
|
6
|
-
class Config < Getch::FileSystem::Ext4::Device
|
7
|
-
def initialize
|
8
|
-
super
|
9
|
-
gen_uuid
|
10
|
-
@root_dir = MOUNTPOINT
|
11
|
-
@init = '/usr/lib/systemd/systemd'
|
12
|
-
end
|
13
|
-
|
14
|
-
def fstab
|
15
|
-
file = "#{@root_dir}/etc/fstab"
|
16
|
-
datas = data_fstab
|
17
|
-
File.write(file, datas.join("\n"))
|
18
|
-
end
|
19
|
-
|
20
|
-
def systemd_boot
|
21
|
-
return unless Helpers.efi?
|
22
|
-
|
23
|
-
esp = '/efi'
|
24
|
-
dir = "#{@root_dir}/#{esp}/loader/entries/"
|
25
|
-
datas_gentoo = [
|
26
|
-
'title Gentoo Linux',
|
27
|
-
'linux /vmlinuz',
|
28
|
-
"options root=PARTUUID=#{@partuuid_root} init=#{@init} rw"
|
29
|
-
]
|
30
|
-
File.write("#{dir}/gentoo.conf", datas_gentoo.join("\n"))
|
31
|
-
end
|
32
|
-
|
33
|
-
def grub
|
34
|
-
return if Helpers.efi?
|
35
|
-
|
36
|
-
file = "#{@root_dir}/etc/default/grub"
|
37
|
-
cmdline = "GRUB_CMDLINE_LINUX=\"resume=PARTUUID=#{@partuuid_swap} root=PARTUUID=#{@partuuid_root} init=#{@init} rw slub_debug=P page_poison=1 slab_nomerge pti=on vsyscall=none spectre_v2=on spec_store_bypass_disable=seccomp iommu=force\"\n"
|
38
|
-
File.write(file, cmdline, mode: 'a')
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
def gen_uuid
|
44
|
-
@partuuid_root = Helpers.partuuid(@dev_root)
|
45
|
-
@partuuid_swap = Helpers.partuuid(@dev_swap)
|
46
|
-
@uuid_root = `lsblk -o "UUID" #{@dev_root} | tail -1`.chomp() if @dev_root
|
47
|
-
@uuid_esp = `lsblk -o "UUID" #{@dev_esp} | tail -1`.chomp() if @dev_esp
|
48
|
-
@uuid_home = `lsblk -o "UUID" #{@dev_home} | tail -1`.chomp() if @dev_home
|
49
|
-
end
|
50
|
-
|
51
|
-
def data_fstab
|
52
|
-
esp = @dev_esp ? "UUID=#{@uuid_esp} /efi vfat noauto,noatime 1 2" : ''
|
53
|
-
swap = @dev_swap ? "PARTUUID=#{@partuuid_swap} none swap discard 0 0" : ''
|
54
|
-
root = @dev_root ? "UUID=#{@uuid_root} / ext4 defaults 0 1" : ''
|
55
|
-
home = @dev_home ? "UUID=#{@uuid_home} /home/#{@user} ext4 defaults 0 2" : ''
|
56
|
-
|
57
|
-
[ esp, swap, root, home ]
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Getch
|
4
|
-
module FileSystem
|
5
|
-
module Ext4
|
6
|
-
class Deps
|
7
|
-
def initialize
|
8
|
-
if Helpers.efi?
|
9
|
-
install_efi
|
10
|
-
else
|
11
|
-
install_bios
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
def install_efi
|
17
|
-
end
|
18
|
-
|
19
|
-
def install_bios
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Getch
|
4
|
-
module FileSystem
|
5
|
-
module Ext4
|
6
|
-
class Format < Getch::FileSystem::Ext4::Device
|
7
|
-
def initialize
|
8
|
-
super
|
9
|
-
@state = Getch::States.new
|
10
|
-
format
|
11
|
-
end
|
12
|
-
|
13
|
-
def format
|
14
|
-
return if STATES[:format]
|
15
|
-
|
16
|
-
exec("mkfs.fat -F32 #{@dev_esp}") if @dev_esp
|
17
|
-
exec("mkswap -f #{@dev_swap}")
|
18
|
-
exec("mkfs.ext4 -F #{@dev_root}")
|
19
|
-
exec("mkfs.ext4 -F #{@dev_home}") if @dev_home
|
20
|
-
@state.format
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def exec(cmd)
|
26
|
-
Getch::Command.new(cmd).run!
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Getch
|
4
|
-
module FileSystem
|
5
|
-
module Ext4
|
6
|
-
class Mount < Getch::FileSystem::Ext4::Device
|
7
|
-
def initialize
|
8
|
-
super
|
9
|
-
@mount = Getch::FileSystem::Mount.new
|
10
|
-
@state = Getch::States.new
|
11
|
-
end
|
12
|
-
|
13
|
-
def run
|
14
|
-
return if STATES[:mount]
|
15
|
-
|
16
|
-
@mount.swap(@dev_swap)
|
17
|
-
@mount.root(@dev_root)
|
18
|
-
@mount.boot(@dev_boot)
|
19
|
-
@mount.esp(@dev_esp)
|
20
|
-
@mount.home(@dev_home)
|
21
|
-
@state.mount
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|