getch 0.1.9 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +132 -0
- data/LICENSE +10 -0
- data/README.md +35 -29
- data/bin/getch +8 -6
- data/getch.gemspec +31 -0
- 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 +3 -3
- 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 +144 -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 +113 -74
- 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/mountfs.rb
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'nito'
|
|
4
|
+
|
|
5
|
+
module MountFs
|
|
6
|
+
class Minimal
|
|
7
|
+
include NiTo
|
|
8
|
+
|
|
9
|
+
def initialize(devs, options)
|
|
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
|
+
@mountpoint = options[:mountpoint]
|
|
16
|
+
x
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
protected
|
|
20
|
+
|
|
21
|
+
def x
|
|
22
|
+
mount_root
|
|
23
|
+
mount_efi
|
|
24
|
+
mount_boot
|
|
25
|
+
mount_swap
|
|
26
|
+
mount_home
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def mount_root
|
|
30
|
+
mount "/dev/#{@root}", @mountpoint
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def mount_efi
|
|
34
|
+
@efi || return
|
|
35
|
+
|
|
36
|
+
mount "/dev/#{@efi}", "#{@mountpoint}/efi"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def mount_boot
|
|
40
|
+
@boot || return
|
|
41
|
+
|
|
42
|
+
mount "/dev/#{@root}", "#{@mountpoint}/boot"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def mount_swap
|
|
46
|
+
@swap || return
|
|
47
|
+
|
|
48
|
+
grep?('/proc/swaps', "/dev/#{@swap}") && return
|
|
49
|
+
|
|
50
|
+
swapon "/dev/#{@swap}"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def mount_home
|
|
54
|
+
@home || return
|
|
55
|
+
|
|
56
|
+
mount "/dev/#{@home}", "#{@mountpoint}/home"
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
private
|
|
60
|
+
|
|
61
|
+
def swapon(path)
|
|
62
|
+
Getch::Command.new('swapon', path)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
class Lvm < Minimal
|
|
67
|
+
def initialize(devs, options)
|
|
68
|
+
@vg = options[:vg_name]
|
|
69
|
+
super
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def mount_root
|
|
73
|
+
mount "/dev/#{@vg}/root", @mountpoint
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def mount_swap
|
|
77
|
+
dm = Getch::Helpers.get_dm "#{@vg0}-swap"
|
|
78
|
+
|
|
79
|
+
grep?('/proc/swaps', "/dev/#{dm}") && return
|
|
80
|
+
|
|
81
|
+
swapon "/dev/#{@vg}/swap"
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def mount_home
|
|
85
|
+
mount "/dev/#{@vg}/home", "#{@mountpoint}/home"
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
class Encrypt < Minimal
|
|
90
|
+
def initialize(devs, options)
|
|
91
|
+
@luks = options[:luks_name]
|
|
92
|
+
super
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def mount_root
|
|
96
|
+
umount "/dev/mapper/boot-#{@luks}"
|
|
97
|
+
mount "/dev/mapper/root-#{@luks}", @mountpoint
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def mount_boot
|
|
101
|
+
mount "/dev/mapper/boot-#{@luks}", "#{@mountpoint}/boot"
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def mount_swap
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def mount_home
|
|
108
|
+
@home || return
|
|
109
|
+
|
|
110
|
+
mount "/dev/mapper/home-#{@luks}", "#{@mountpoint}/home"
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
class Hybrid < Encrypt
|
|
115
|
+
def initialize(devs, options)
|
|
116
|
+
@vg = options[:vg_name]
|
|
117
|
+
super
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def mount_root
|
|
121
|
+
umount "/dev/mapper/boot-#{@luks}"
|
|
122
|
+
mount "/dev/#{@vg}/root", @mountpoint
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def mount_boot
|
|
126
|
+
mount "/dev/mapper/boot-#{@luks}", "#{@mountpoint}/boot"
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def mount_home
|
|
130
|
+
mount "/dev/#{@vg}/home", "#{@mountpoint}/home"
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
class Zfs < Minimal
|
|
135
|
+
def initialize(devs, options)
|
|
136
|
+
@zfs = options[:zfs_name]
|
|
137
|
+
@os = options[:os]
|
|
138
|
+
super
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Root should be alrealy mounted
|
|
142
|
+
def mount_root
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def mount_boot
|
|
146
|
+
@boot || return
|
|
147
|
+
|
|
148
|
+
Getch::Command.new("zfs mount b#{@zfs}/BOOT/#{@os}")
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def mount_home
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|
data/lib/nito.rb
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'fileutils'
|
|
4
|
+
require 'open3'
|
|
5
|
+
require 'tempfile'
|
|
6
|
+
require_relative 'getch/log'
|
|
7
|
+
require_relative 'getch/command'
|
|
8
|
+
|
|
9
|
+
# uNix Tools like mkdir, mount in Ruby code
|
|
10
|
+
module NiTo
|
|
11
|
+
module_function
|
|
12
|
+
|
|
13
|
+
def mkdir(path, perm = 0755)
|
|
14
|
+
return if Dir.exist? path
|
|
15
|
+
|
|
16
|
+
FileUtils.mkdir_p path, mode: perm
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def grep?(file, search)
|
|
20
|
+
is_found = false
|
|
21
|
+
return is_found unless File.exist? file
|
|
22
|
+
|
|
23
|
+
File.open(file).each do |l|
|
|
24
|
+
is_found = true if l =~ /#{search}/
|
|
25
|
+
end
|
|
26
|
+
is_found
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def rm(file)
|
|
30
|
+
File.exist?(file) && File.delete(file)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def umount(dir)
|
|
34
|
+
return unless mount? dir
|
|
35
|
+
|
|
36
|
+
Getch::Command.new('umount', dir)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Mount, accept *args, the last argument should be the destination
|
|
40
|
+
# e.g: mount '--types proc', '/proc', '/mnt/getch/proc'
|
|
41
|
+
def mount(*args)
|
|
42
|
+
return if mount? args.last
|
|
43
|
+
|
|
44
|
+
mkdir args.last
|
|
45
|
+
Getch::Command.new('mount', args.join(' '))
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def mount?(dir)
|
|
49
|
+
res = false
|
|
50
|
+
File.open('/proc/mounts').each do |l|
|
|
51
|
+
res = true if l =~ /#{dir}/
|
|
52
|
+
end
|
|
53
|
+
res
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Like echo 'content' > to_file
|
|
57
|
+
def echo(file, content)
|
|
58
|
+
File.write file, "#{content}\n", mode: 'w'
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Like echo 'content' >> to_file
|
|
62
|
+
def echo_a(file, content)
|
|
63
|
+
File.write file, "#{content}\n", mode: 'a' unless grep? file, content
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def cp(src, dest)
|
|
67
|
+
FileUtils.cp src, dest
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# create a void file
|
|
71
|
+
def touch(file)
|
|
72
|
+
File.write file, '' unless File.exist? file
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Like sed -i /old:new/ file
|
|
76
|
+
def sed(file, regex, change)
|
|
77
|
+
tmp_file = Tempfile.new
|
|
78
|
+
File.open(file).each do |l|
|
|
79
|
+
if l.match(regex)
|
|
80
|
+
echo_a tmp_file, change
|
|
81
|
+
else
|
|
82
|
+
File.write tmp_file, l, mode: 'a'
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
cp tmp_file, file
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def search_proc_swaps(path)
|
|
89
|
+
found = nil
|
|
90
|
+
File.open('/proc/swaps').each do |l|
|
|
91
|
+
if l =~ /#{path}/
|
|
92
|
+
found = l.split(' ')
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
found
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def swapoff(dev)
|
|
99
|
+
return unless grep? '/proc/swaps', dev
|
|
100
|
+
|
|
101
|
+
found = search_proc_swaps(dev)
|
|
102
|
+
found ?
|
|
103
|
+
Getch::Command.new('swapoff', found[0]) :
|
|
104
|
+
return
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def swapoff_dm(name)
|
|
108
|
+
dm = Getch::Helpers.get_dm name
|
|
109
|
+
dm || return
|
|
110
|
+
|
|
111
|
+
found = search_proc_swaps(dm)
|
|
112
|
+
found ?
|
|
113
|
+
Getch::Command.new('swapoff', found[0]) :
|
|
114
|
+
return
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def sh(*args)
|
|
118
|
+
log = Log.new
|
|
119
|
+
Open3.popen3 args.join(' ') do |_, stdout, stderr, wait_thr|
|
|
120
|
+
if wait_thr.value.success?
|
|
121
|
+
log.info_res 'Ok'
|
|
122
|
+
return stdout.read.chomp
|
|
123
|
+
end
|
|
124
|
+
puts
|
|
125
|
+
log.dbg args.join(' ') + "\nEXIT:#{wait_thr.value}"
|
|
126
|
+
log.dbg "STDERR:#{stderr.read}"
|
|
127
|
+
log.dbg "STDOUT:#{stdout.read}"
|
|
128
|
+
log.fatal 'Die'
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
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.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- szorfein
|
|
@@ -10,32 +10,33 @@ bindir: bin
|
|
|
10
10
|
cert_chain:
|
|
11
11
|
- |
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
13
|
+
MIIEhTCCAu2gAwIBAgIBATANBgkqhkiG9w0BAQsFADBEMREwDwYDVQQDDAhzem9y
|
|
14
|
+
ZmVpbjEaMBgGCgmSJomT8ixkARkWCnByb3Rvbm1haWwxEzARBgoJkiaJk/IsZAEZ
|
|
15
|
+
FgNjb20wHhcNMjIwOTA4MDYyNjE5WhcNMjMwOTA4MDYyNjE5WjBEMREwDwYDVQQD
|
|
16
|
+
DAhzem9yZmVpbjEaMBgGCgmSJomT8ixkARkWCnByb3Rvbm1haWwxEzARBgoJkiaJ
|
|
17
|
+
k/IsZAEZFgNjb20wggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDEJNhl
|
|
18
|
+
Gd0JNHLXysR7GvbCKD+y1prQbmS333GpoFgPR2chEGv8Y7l0We2UFXCZ59CVOs1v
|
|
19
|
+
KBVQhhNvxWAHWhfe/8stb1JFBxZpnCi7S0BGpqeblaGBXVlhBOzbZ6d1NrOwMfDS
|
|
20
|
+
6EzdX4WAOH55HnAz29T5KREUdbONVLU7HJNIIFVZvf6ethOv84pnkWbdWjV0RB3A
|
|
21
|
+
ERYste5QHGx1YQOYGTuJMlu8113kqTbB8wpEw6X00aJwmXcJvnKXkhN5mxd06yss
|
|
22
|
+
EE96lOk16raTWCh7DeYR3/ilVet3DpLlCvpFNtMIuko1HFa3HTW+57003VxD8Ozk
|
|
23
|
+
VGQKn823D+ReujKh+jgxbl8Q+r652C9Wl1N+C5CSma4mDtNGKr0XmEOEQycpSx0z
|
|
24
|
+
Z9J6/27wS8s6SJ0rLxueFQ6gb2oPEQb8jKJuNEuXWLmO3Idrwlv9Z7ymhnksjyqM
|
|
25
|
+
fAw+NMGEOCITNphXmssazlLX+bnxcbpr7rbTHa1xBmmHoUVudAnxAG43PrMCAwEA
|
|
26
|
+
AaOBgTB/MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBRzxda94CPF
|
|
27
|
+
Ll9UQ5l55l65RCZuEzAiBgNVHREEGzAZgRdzem9yZmVpbkBwcm90b25tYWlsLmNv
|
|
28
|
+
bTAiBgNVHRIEGzAZgRdzem9yZmVpbkBwcm90b25tYWlsLmNvbTANBgkqhkiG9w0B
|
|
29
|
+
AQsFAAOCAYEAPhavFyzIP60Zw7y40zJhzQpMK2IWtdw9HrRJq313Ea4UT1Kgv7F9
|
|
30
|
+
lCFtQzI5XMzooYiLMoPz7xBMXaUz+DDFOOcgGSinVrFbfPA4rOGEkBjnlwC39lBc
|
|
31
|
+
AiyXFzCV7Wqn4VhtqQQyvmoNYL4Q666K+nL8/nsXZWsXtRQ119LeAvrI2A+xmYAb
|
|
32
|
+
FPE5bD3Jx1JCoJdVN1DmE4YYdM8mVmb0XjCK9Tp1M01EDKDvAX7f3B+X6A5D7uBq
|
|
33
|
+
63X6Kx09VkntVOrifd3W4TwjDlyAMpB+50OIi3ErPnH2R4i09qnCiZmcVWATBVKw
|
|
34
|
+
e2QSloIAUZJwEFkrRqWPNVi8sr+BcMeuKpXaOwpbkP+xq/W2EKlUQKhPXMXS4jvC
|
|
35
|
+
MuTi+RjpSNKZxzBrOlK2eMIpiFrugF7nzKcM9EGnWRWUb899drCcD4VJhjPtgpn+
|
|
36
|
+
aEJeKq4/BlIwMlXPe+W5C8zp2i8hgG1/OYbwbGE1p2iRi1NIK7G/HyRqQjOqJxzE
|
|
37
|
+
LLknX69FN7/G
|
|
37
38
|
-----END CERTIFICATE-----
|
|
38
|
-
date: 2022-01
|
|
39
|
+
date: 2022-10-01 00:00:00.000000000 Z
|
|
39
40
|
dependencies: []
|
|
40
41
|
description:
|
|
41
42
|
email:
|
|
@@ -43,26 +44,50 @@ email:
|
|
|
43
44
|
executables:
|
|
44
45
|
- getch
|
|
45
46
|
extensions: []
|
|
46
|
-
extra_rdoc_files:
|
|
47
|
-
- README.md
|
|
47
|
+
extra_rdoc_files: []
|
|
48
48
|
files:
|
|
49
|
+
- CHANGELOG.md
|
|
50
|
+
- LICENSE
|
|
49
51
|
- README.md
|
|
50
52
|
- assets/network-stack.conf
|
|
51
53
|
- assets/system.conf
|
|
52
54
|
- bin/getch
|
|
55
|
+
- getch.gemspec
|
|
56
|
+
- lib/clean.rb
|
|
53
57
|
- lib/cmdline.rb
|
|
58
|
+
- lib/cryptsetup.rb
|
|
59
|
+
- lib/devs.rb
|
|
60
|
+
- lib/dracut.rb
|
|
61
|
+
- lib/dracut/encrypt.rb
|
|
62
|
+
- lib/dracut/hybrid.rb
|
|
63
|
+
- lib/dracut/lvm.rb
|
|
64
|
+
- lib/dracut/minimal.rb
|
|
65
|
+
- lib/dracut/root.rb
|
|
66
|
+
- lib/dracut/zfs.rb
|
|
67
|
+
- lib/fstab.rb
|
|
68
|
+
- lib/fstab/encrypt.rb
|
|
69
|
+
- lib/fstab/hybrid.rb
|
|
70
|
+
- lib/fstab/lvm.rb
|
|
71
|
+
- lib/fstab/minimal.rb
|
|
72
|
+
- lib/fstab/root.rb
|
|
73
|
+
- lib/fstab/zfs.rb
|
|
54
74
|
- lib/getch.rb
|
|
75
|
+
- lib/getch/assembly.rb
|
|
55
76
|
- lib/getch/command.rb
|
|
56
77
|
- lib/getch/config.rb
|
|
57
|
-
- lib/getch/config/
|
|
78
|
+
- lib/getch/config/account.rb
|
|
79
|
+
- lib/getch/config/dhcp.rb
|
|
80
|
+
- lib/getch/config/grub.rb
|
|
81
|
+
- lib/getch/config/iwd.rb
|
|
82
|
+
- lib/getch/config/keymap.rb
|
|
83
|
+
- lib/getch/config/locale.rb
|
|
84
|
+
- lib/getch/config/portage.rb
|
|
85
|
+
- lib/getch/config/pre_network.rb
|
|
86
|
+
- lib/getch/config/timezone.rb
|
|
58
87
|
- lib/getch/config/void.rb
|
|
88
|
+
- lib/getch/device.rb
|
|
59
89
|
- lib/getch/filesystem.rb
|
|
60
|
-
- lib/getch/filesystem/clean.rb
|
|
61
|
-
- lib/getch/filesystem/device.rb
|
|
62
90
|
- 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
91
|
- lib/getch/filesystem/ext4/encrypt.rb
|
|
67
92
|
- lib/getch/filesystem/ext4/encrypt/config.rb
|
|
68
93
|
- lib/getch/filesystem/ext4/encrypt/deps.rb
|
|
@@ -71,32 +96,29 @@ files:
|
|
|
71
96
|
- lib/getch/filesystem/ext4/encrypt/mount.rb
|
|
72
97
|
- lib/getch/filesystem/ext4/encrypt/partition.rb
|
|
73
98
|
- 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
|
|
99
|
+
- lib/getch/filesystem/ext4/hybrid.rb
|
|
100
|
+
- lib/getch/filesystem/ext4/hybrid/config.rb
|
|
101
|
+
- lib/getch/filesystem/ext4/hybrid/deps.rb
|
|
102
|
+
- lib/getch/filesystem/ext4/hybrid/device.rb
|
|
103
|
+
- lib/getch/filesystem/ext4/hybrid/format.rb
|
|
104
|
+
- lib/getch/filesystem/ext4/hybrid/mount.rb
|
|
105
|
+
- lib/getch/filesystem/ext4/hybrid/partition.rb
|
|
106
|
+
- lib/getch/filesystem/ext4/hybrid/void.rb
|
|
107
|
+
- lib/getch/filesystem/ext4/lvm.rb
|
|
108
|
+
- lib/getch/filesystem/ext4/lvm/config.rb
|
|
109
|
+
- lib/getch/filesystem/ext4/lvm/deps.rb
|
|
110
|
+
- lib/getch/filesystem/ext4/lvm/device.rb
|
|
111
|
+
- lib/getch/filesystem/ext4/lvm/format.rb
|
|
112
|
+
- lib/getch/filesystem/ext4/lvm/mount.rb
|
|
113
|
+
- lib/getch/filesystem/ext4/lvm/partition.rb
|
|
114
|
+
- lib/getch/filesystem/ext4/minimal.rb
|
|
115
|
+
- lib/getch/filesystem/ext4/minimal/config.rb
|
|
116
|
+
- lib/getch/filesystem/ext4/minimal/deps.rb
|
|
117
|
+
- lib/getch/filesystem/ext4/minimal/device.rb
|
|
118
|
+
- lib/getch/filesystem/ext4/minimal/format.rb
|
|
119
|
+
- lib/getch/filesystem/ext4/minimal/mount.rb
|
|
120
|
+
- lib/getch/filesystem/ext4/minimal/partition.rb
|
|
96
121
|
- 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
122
|
- lib/getch/filesystem/zfs/encrypt.rb
|
|
101
123
|
- lib/getch/filesystem/zfs/encrypt/config.rb
|
|
102
124
|
- lib/getch/filesystem/zfs/encrypt/deps.rb
|
|
@@ -104,18 +126,23 @@ files:
|
|
|
104
126
|
- lib/getch/filesystem/zfs/encrypt/format.rb
|
|
105
127
|
- lib/getch/filesystem/zfs/encrypt/mount.rb
|
|
106
128
|
- 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/
|
|
129
|
+
- lib/getch/filesystem/zfs/minimal.rb
|
|
130
|
+
- lib/getch/filesystem/zfs/minimal/config.rb
|
|
131
|
+
- lib/getch/filesystem/zfs/minimal/deps.rb
|
|
132
|
+
- lib/getch/filesystem/zfs/minimal/device.rb
|
|
133
|
+
- lib/getch/filesystem/zfs/minimal/format.rb
|
|
134
|
+
- lib/getch/filesystem/zfs/minimal/mount.rb
|
|
135
|
+
- lib/getch/filesystem/zfs/minimal/partition.rb
|
|
112
136
|
- lib/getch/gentoo.rb
|
|
113
|
-
- lib/getch/gentoo/boot.rb
|
|
114
137
|
- lib/getch/gentoo/bootloader.rb
|
|
115
|
-
- lib/getch/gentoo/
|
|
116
|
-
- lib/getch/gentoo/
|
|
138
|
+
- lib/getch/gentoo/finalize.rb
|
|
139
|
+
- lib/getch/gentoo/post_config.rb
|
|
140
|
+
- lib/getch/gentoo/pre_config.rb
|
|
141
|
+
- lib/getch/gentoo/services.rb
|
|
117
142
|
- lib/getch/gentoo/sources.rb
|
|
118
|
-
- lib/getch/gentoo/
|
|
143
|
+
- lib/getch/gentoo/tarball.rb
|
|
144
|
+
- lib/getch/gentoo/terraform.rb
|
|
145
|
+
- lib/getch/gentoo/update.rb
|
|
119
146
|
- lib/getch/gentoo/use.rb
|
|
120
147
|
- lib/getch/gentoo/use_flag.rb
|
|
121
148
|
- lib/getch/guard.rb
|
|
@@ -123,12 +150,24 @@ files:
|
|
|
123
150
|
- lib/getch/log.rb
|
|
124
151
|
- lib/getch/options.rb
|
|
125
152
|
- lib/getch/states.rb
|
|
153
|
+
- lib/getch/tree.rb
|
|
126
154
|
- lib/getch/version.rb
|
|
127
155
|
- lib/getch/void.rb
|
|
128
|
-
- lib/getch/void/
|
|
129
|
-
- lib/getch/void/
|
|
130
|
-
- lib/getch/void/
|
|
131
|
-
- lib/getch/void/
|
|
156
|
+
- lib/getch/void/bootloader.rb
|
|
157
|
+
- lib/getch/void/finalize.rb
|
|
158
|
+
- lib/getch/void/post_config.rb
|
|
159
|
+
- lib/getch/void/pre_config.rb
|
|
160
|
+
- lib/getch/void/services.rb
|
|
161
|
+
- lib/getch/void/tarball.rb
|
|
162
|
+
- lib/getch/void/terraform.rb
|
|
163
|
+
- lib/getch/void/update.rb
|
|
164
|
+
- lib/luks.rb
|
|
165
|
+
- lib/lvm2.rb
|
|
166
|
+
- lib/mkfs.rb
|
|
167
|
+
- lib/mkfs/zfs.rb
|
|
168
|
+
- lib/mountfs.rb
|
|
169
|
+
- lib/nito.rb
|
|
170
|
+
- lib/sgdisk.rb
|
|
132
171
|
homepage: https://github.com/szorfein/getch
|
|
133
172
|
licenses:
|
|
134
173
|
- MIT
|
|
@@ -152,8 +191,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
152
191
|
- !ruby/object:Gem::Version
|
|
153
192
|
version: '0'
|
|
154
193
|
requirements: []
|
|
155
|
-
rubygems_version: 3.
|
|
194
|
+
rubygems_version: 3.3.19
|
|
156
195
|
signing_key:
|
|
157
196
|
specification_version: 4
|
|
158
|
-
summary: A CLI tool to install Gentoo
|
|
197
|
+
summary: A CLI tool to install Gentoo or VoidLinux.
|
|
159
198
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|