getch 0.0.8 → 0.1.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.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,64 @@
|
|
1
|
+
# lib/use_flag.rb
|
2
|
+
|
3
|
+
module Getch::Gentoo
|
4
|
+
class UseFlag
|
5
|
+
def initialize(options)
|
6
|
+
@efi = Helpers::efi?
|
7
|
+
@o = options
|
8
|
+
end
|
9
|
+
|
10
|
+
def apply
|
11
|
+
systemd
|
12
|
+
kmod
|
13
|
+
grub
|
14
|
+
zfs
|
15
|
+
lvm
|
16
|
+
cryptsetup
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def systemd
|
22
|
+
flags = []
|
23
|
+
use = Getch::Gentoo::Use.new('sys-apps/systemd')
|
24
|
+
flags << 'dns-over-tls'
|
25
|
+
flags << 'gnuefi' if @efi
|
26
|
+
use.add(flags)
|
27
|
+
end
|
28
|
+
|
29
|
+
def kmod
|
30
|
+
use = Getch::Gentoo::Use.new('sys-apps/kmod')
|
31
|
+
use.add('zstd', 'lzma')
|
32
|
+
end
|
33
|
+
|
34
|
+
def grub
|
35
|
+
return if @efi
|
36
|
+
flags = []
|
37
|
+
use = Getch::Gentoo::Use.new('sys-boot/grub')
|
38
|
+
flags << '-grub_platforms_efi-64'
|
39
|
+
flags << 'libzfs' if @o.fs == 'zfs'
|
40
|
+
flags << 'device-mapper' if @o.fs == 'lvm'
|
41
|
+
use.add(flags)
|
42
|
+
end
|
43
|
+
|
44
|
+
def zfs
|
45
|
+
return unless @o.fs == 'zfs'
|
46
|
+
use = Getch::Gentoo::Use.new('sys-fs/zfs-kmod')
|
47
|
+
use.add('rootfs')
|
48
|
+
use = Getch::Gentoo::Use.new('sys-fs/zfs')
|
49
|
+
use.add('rootfs')
|
50
|
+
end
|
51
|
+
|
52
|
+
def lvm
|
53
|
+
return unless @o.fs == 'lvm'
|
54
|
+
use = Getch::Gentoo::Use.new
|
55
|
+
use.add_global('lvm', 'device-mapper')
|
56
|
+
end
|
57
|
+
|
58
|
+
def cryptsetup
|
59
|
+
return unless @o.encrypt
|
60
|
+
use = Getch::Gentoo::Use.new
|
61
|
+
use.add_global('cryptsetup')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/lib/getch/helpers.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'open-uri'
|
2
2
|
require 'open3'
|
3
3
|
require 'fileutils'
|
4
|
-
require_relative 'command'
|
5
4
|
|
6
5
|
module Helpers
|
7
6
|
def self.efi?
|
@@ -31,19 +30,42 @@ module Helpers
|
|
31
30
|
File.write path, content if ! File.exist? path
|
32
31
|
end
|
33
32
|
|
34
|
-
def self.
|
35
|
-
|
36
|
-
source /etc/profile
|
37
|
-
emerge --changed-use #{pkgs}
|
38
|
-
\""
|
39
|
-
Getch::Command.new(cmd).run!
|
33
|
+
def self.mkdir(dir)
|
34
|
+
FileUtils.mkdir_p dir if ! Dir.exist? dir
|
40
35
|
end
|
41
36
|
|
42
|
-
def self.
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
37
|
+
def self.touch(file)
|
38
|
+
File.write file, '' if ! File.exist? file
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.grep?(file, regex)
|
42
|
+
is_found = false
|
43
|
+
return is_found if ! File.exist? file
|
44
|
+
File.open(file) do |f|
|
45
|
+
f.each do |line|
|
46
|
+
is_found = true if line.match(regex)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
is_found
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.sys(cmd)
|
53
|
+
system(cmd)
|
54
|
+
unless $?.success?
|
55
|
+
raise "Error with #{cmd}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.partuuid(dev)
|
60
|
+
`lsblk -o PARTUUID #{dev}`.match(/[\w]+-[\w]+-[\w]+-[\w]+-[\w]+/)
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.uuid(dev)
|
64
|
+
`lsblk -do UUID #{dev}`.match(/[\w]+-[\w]+-[\w]+-[\w]+-[\w]+/)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Used with ZFS for the pool name
|
68
|
+
def self.pool_id(dev)
|
69
|
+
`lsblk -o PARTUUID #{dev}`.delete("\n").delete("PARTUUID").match(/[\w]{5}/)
|
48
70
|
end
|
49
71
|
end
|
data/lib/getch/options.rb
CHANGED
@@ -2,15 +2,18 @@ require 'optparse'
|
|
2
2
|
|
3
3
|
module Getch
|
4
4
|
class Options
|
5
|
-
attr_reader :language, :zoneinfo, :
|
5
|
+
attr_reader :language, :zoneinfo, :keymap, :disk, :fs, :username, :boot_disk, :cache_disk, :home_disk, :encrypt, :verbose
|
6
6
|
|
7
7
|
def initialize(argv)
|
8
8
|
@language = DEFAULT_OPTIONS[:language]
|
9
9
|
@zoneinfo = DEFAULT_OPTIONS[:zoneinfo]
|
10
|
-
@
|
10
|
+
@keymap = DEFAULT_OPTIONS[:keymap]
|
11
11
|
@disk = DEFAULT_OPTIONS[:disk]
|
12
12
|
@fs = DEFAULT_OPTIONS[:fs]
|
13
13
|
@username = DEFAULT_OPTIONS[:username]
|
14
|
+
@boot_disk = DEFAULT_OPTIONS[:boot_disk]
|
15
|
+
@cache_disk = DEFAULT_OPTIONS[:cache_disk]
|
16
|
+
@home_disk = DEFAULT_OPTIONS[:home_disk]
|
14
17
|
@encrypt = DEFAULT_OPTIONS[:encrypt]
|
15
18
|
@verbose = DEFAULT_OPTIONS[:verbose]
|
16
19
|
parse(argv)
|
@@ -26,20 +29,32 @@ module Getch
|
|
26
29
|
opts.on("-z", "--zoneinfo ZONE", "Default is US/Eastern") do |zone|
|
27
30
|
@zoneinfo = zone
|
28
31
|
end
|
29
|
-
opts.on("-k", "--
|
30
|
-
@
|
32
|
+
opts.on("-k", "--keymap KEY", "Default is us") do |key|
|
33
|
+
@keymap = key
|
31
34
|
end
|
32
|
-
opts.on("-d", "--disk DISK", "Disk where install Gentoo (sda,sdb)") do |disk|
|
35
|
+
opts.on("-d", "--disk DISK", "Disk where install Gentoo (sda,sdb), default use #{@disk}") do |disk|
|
33
36
|
@disk = disk
|
34
37
|
end
|
35
|
-
opts.on("-f", "--format FS", "Can be ext4, lvm. Default use ext4") do |fs|
|
38
|
+
opts.on("-f", "--format FS", "Can be ext4, lvm or zfs. Default use ext4") do |fs|
|
36
39
|
@fs = fs
|
37
40
|
DEFAULT_OPTIONS[:fs] = fs # dont known why, but it should be enforce
|
38
41
|
end
|
39
|
-
opts.on("-u", "--username USERNAME", "
|
42
|
+
opts.on("-u", "--username USERNAME", "Create a new user /home/USERNAME with password.") do |user|
|
40
43
|
@username = user
|
41
44
|
end
|
42
|
-
opts.on("--
|
45
|
+
opts.on("--separate-boot DISK", "Disk for the boot/efi partition, default use #{@disk}") do |boot|
|
46
|
+
@boot_disk = boot
|
47
|
+
DEFAULT_OPTIONS[:boot_disk] = boot
|
48
|
+
end
|
49
|
+
opts.on("--separate-cache DISK", "Disk for the swap partition, add ZIL/L2ARC for ZFS when set, default use #{@disk}") do |swap|
|
50
|
+
@cache_disk = swap
|
51
|
+
DEFAULT_OPTIONS[:cache_disk] = swap
|
52
|
+
end
|
53
|
+
opts.on("--separate-home DISK", "Disk for the /home partition, default is nil") do |home|
|
54
|
+
@home_disk = home
|
55
|
+
DEFAULT_OPTIONS[:home_disk] = home
|
56
|
+
end
|
57
|
+
opts.on("--encrypt", "Encrypt your system.") do
|
43
58
|
@encrypt = true
|
44
59
|
end
|
45
60
|
opts.on("--verbose", "Write more messages to the standard output.") do
|
data/lib/getch/version.rb
CHANGED
metadata
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: getch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- szorfein
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIETTCCArWgAwIBAgIBATANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1zem9y
|
14
|
-
|
15
|
-
|
14
|
+
ZmVpbi9EQz1wcm90b25tYWlsL0RDPWNvbTAeFw0yMTA1MTEyMTAzNDZaFw0yMjA1
|
15
|
+
MTEyMTAzNDZaMCgxJjAkBgNVBAMMHXN6b3JmZWluL0RDPXByb3Rvbm1haWwvREM9
|
16
16
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NKI46Lp5Q8AI+xtDUHAPbSswHa40BA6ChFehP+j0L
|
36
|
+
fg==
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2021-05-17 00:00:00.000000000 Z
|
39
39
|
dependencies: []
|
40
|
-
description:
|
40
|
+
description:
|
41
41
|
email:
|
42
42
|
- szorfein@protonmail.com
|
43
43
|
executables:
|
@@ -54,7 +54,10 @@ files:
|
|
54
54
|
- getch.gemspec
|
55
55
|
- lib/getch.rb
|
56
56
|
- lib/getch/command.rb
|
57
|
+
- lib/getch/config.rb
|
57
58
|
- lib/getch/filesystem.rb
|
59
|
+
- lib/getch/filesystem/clean.rb
|
60
|
+
- lib/getch/filesystem/device.rb
|
58
61
|
- lib/getch/filesystem/ext4.rb
|
59
62
|
- lib/getch/filesystem/ext4/config.rb
|
60
63
|
- lib/getch/filesystem/ext4/deps.rb
|
@@ -73,15 +76,40 @@ files:
|
|
73
76
|
- lib/getch/filesystem/lvm/config.rb
|
74
77
|
- lib/getch/filesystem/lvm/deps.rb
|
75
78
|
- lib/getch/filesystem/lvm/device.rb
|
79
|
+
- lib/getch/filesystem/lvm/encrypt.rb
|
80
|
+
- lib/getch/filesystem/lvm/encrypt/config.rb
|
81
|
+
- lib/getch/filesystem/lvm/encrypt/deps.rb
|
82
|
+
- lib/getch/filesystem/lvm/encrypt/device.rb
|
83
|
+
- lib/getch/filesystem/lvm/encrypt/format.rb
|
84
|
+
- lib/getch/filesystem/lvm/encrypt/mount.rb
|
85
|
+
- lib/getch/filesystem/lvm/encrypt/partition.rb
|
76
86
|
- lib/getch/filesystem/lvm/format.rb
|
77
87
|
- lib/getch/filesystem/lvm/mount.rb
|
78
88
|
- lib/getch/filesystem/lvm/partition.rb
|
89
|
+
- lib/getch/filesystem/mount.rb
|
90
|
+
- lib/getch/filesystem/partition.rb
|
91
|
+
- lib/getch/filesystem/zfs.rb
|
92
|
+
- lib/getch/filesystem/zfs/config.rb
|
93
|
+
- lib/getch/filesystem/zfs/deps.rb
|
94
|
+
- lib/getch/filesystem/zfs/device.rb
|
95
|
+
- lib/getch/filesystem/zfs/encrypt.rb
|
96
|
+
- lib/getch/filesystem/zfs/encrypt/config.rb
|
97
|
+
- lib/getch/filesystem/zfs/encrypt/deps.rb
|
98
|
+
- lib/getch/filesystem/zfs/encrypt/device.rb
|
99
|
+
- lib/getch/filesystem/zfs/encrypt/format.rb
|
100
|
+
- lib/getch/filesystem/zfs/encrypt/mount.rb
|
101
|
+
- lib/getch/filesystem/zfs/encrypt/partition.rb
|
102
|
+
- lib/getch/filesystem/zfs/format.rb
|
103
|
+
- lib/getch/filesystem/zfs/mount.rb
|
104
|
+
- lib/getch/filesystem/zfs/partition.rb
|
79
105
|
- lib/getch/gentoo.rb
|
80
106
|
- lib/getch/gentoo/boot.rb
|
81
107
|
- lib/getch/gentoo/chroot.rb
|
82
108
|
- lib/getch/gentoo/config.rb
|
83
109
|
- lib/getch/gentoo/sources.rb
|
84
110
|
- lib/getch/gentoo/stage.rb
|
111
|
+
- lib/getch/gentoo/use.rb
|
112
|
+
- lib/getch/gentoo/use_flag.rb
|
85
113
|
- lib/getch/helpers.rb
|
86
114
|
- lib/getch/log.rb
|
87
115
|
- lib/getch/options.rb
|
@@ -94,7 +122,7 @@ metadata:
|
|
94
122
|
changelog_uri: https://github.com/szorfein/getch/blob/master/CHANGELOG.md
|
95
123
|
bug_tracker_uri: https://github.com/szorfein/getch/issues
|
96
124
|
wiki_uri: https://github.com/szorfein/getch
|
97
|
-
post_install_message:
|
125
|
+
post_install_message:
|
98
126
|
rdoc_options: []
|
99
127
|
require_paths:
|
100
128
|
- lib
|
@@ -109,8 +137,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
137
|
- !ruby/object:Gem::Version
|
110
138
|
version: '0'
|
111
139
|
requirements: []
|
112
|
-
rubygems_version: 3.
|
113
|
-
signing_key:
|
140
|
+
rubygems_version: 3.0.9
|
141
|
+
signing_key:
|
114
142
|
specification_version: 4
|
115
143
|
summary: A CLI tool to install Gentoo
|
116
144
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|