getch 0.0.9 → 0.1.5
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 +45 -0
- data/README.md +57 -11
- data/bin/setup.sh +4 -2
- data/lib/getch.rb +27 -10
- data/lib/getch/command.rb +25 -4
- data/lib/getch/config.rb +58 -0
- data/lib/getch/filesystem.rb +6 -0
- data/lib/getch/filesystem/clean.rb +58 -0
- data/lib/getch/filesystem/device.rb +61 -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 +8 -9
- data/lib/getch/filesystem/ext4/encrypt/deps.rb +3 -19
- data/lib/getch/filesystem/ext4/encrypt/device.rb +3 -8
- data/lib/getch/filesystem/ext4/encrypt/format.rb +3 -5
- data/lib/getch/filesystem/ext4/encrypt/mount.rb +6 -43
- data/lib/getch/filesystem/ext4/encrypt/partition.rb +19 -38
- 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/config.rb +11 -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/config.rb +9 -12
- data/lib/getch/filesystem/lvm/encrypt/deps.rb +5 -22
- data/lib/getch/filesystem/lvm/encrypt/device.rb +33 -9
- data/lib/getch/filesystem/lvm/encrypt/format.rb +3 -3
- data/lib/getch/filesystem/lvm/encrypt/mount.rb +7 -46
- data/lib/getch/filesystem/lvm/encrypt/partition.rb +20 -31
- 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 +104 -0
- data/lib/getch/filesystem/zfs/encrypt/mount.rb +51 -0
- data/lib/getch/filesystem/zfs/encrypt/partition.rb +66 -0
- data/lib/getch/filesystem/zfs/format.rb +113 -0
- data/lib/getch/filesystem/zfs/mount.rb +48 -0
- data/lib/getch/filesystem/zfs/partition.rb +65 -0
- data/lib/getch/gentoo.rb +11 -4
- data/lib/getch/gentoo/boot.rb +34 -16
- data/lib/getch/gentoo/chroot.rb +16 -25
- data/lib/getch/gentoo/config.rb +59 -7
- data/lib/getch/gentoo/sources.rb +54 -26
- data/lib/getch/gentoo/use.rb +43 -0
- data/lib/getch/gentoo/use_flag.rb +64 -0
- data/lib/getch/guard.rb +62 -0
- data/lib/getch/helpers.rb +31 -13
- data/lib/getch/options.rb +24 -9
- data/lib/getch/version.rb +1 -1
- metadata +40 -18
- metadata.gz.sig +0 -0
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,20 +30,12 @@ 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
|
-
source /etc/profile
|
45
|
-
#{cmd}
|
46
|
-
\""
|
47
|
-
Getch::Command.new(script).run!
|
37
|
+
def self.touch(file)
|
38
|
+
File.write file, '' if ! File.exist? file
|
48
39
|
end
|
49
40
|
|
50
41
|
def self.grep?(file, regex)
|
@@ -64,4 +55,31 @@ module Helpers
|
|
64
55
|
raise "Error with #{cmd}"
|
65
56
|
end
|
66
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
|
+
if dev.match(/[0-9]/)
|
70
|
+
sleep 1
|
71
|
+
`lsblk -o PARTUUID #{dev}`.delete("\n").delete("PARTUUID").match(/[\w]{5}/)
|
72
|
+
else
|
73
|
+
puts "Please, enter a pool name"
|
74
|
+
while true
|
75
|
+
print "\n> "
|
76
|
+
value = gets
|
77
|
+
if value.match(/[a-z]{4,20}/)
|
78
|
+
return value
|
79
|
+
end
|
80
|
+
puts "Bad name, you enter: #{value}"
|
81
|
+
puts "Valid pool name use character only, between 4-20."
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
67
85
|
end
|
data/lib/getch/options.rb
CHANGED
@@ -2,7 +2,7 @@ require 'optparse'
|
|
2
2
|
|
3
3
|
module Getch
|
4
4
|
class Options
|
5
|
-
attr_reader :language, :zoneinfo, :keymap, :disk, :fs, :username, :encrypt, :verbose
|
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]
|
@@ -11,6 +11,9 @@ module Getch
|
|
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)
|
@@ -24,22 +27,34 @@ module Getch
|
|
24
27
|
@language = lang
|
25
28
|
end
|
26
29
|
opts.on("-z", "--zoneinfo ZONE", "Default is US/Eastern") do |zone|
|
27
|
-
@zoneinfo = zone
|
30
|
+
@zoneinfo = Getch::Guard.zone(zone)
|
28
31
|
end
|
29
32
|
opts.on("-k", "--keymap KEY", "Default is us") do |key|
|
30
|
-
@keymap = key
|
33
|
+
@keymap = Getch::Guard.keymap(key)
|
31
34
|
end
|
32
|
-
opts.on("-d", "--disk DISK", "Disk where install Gentoo (sda,sdb)") do |disk|
|
33
|
-
@disk = disk
|
35
|
+
opts.on("-d", "--disk DISK", "Disk where install Gentoo (sda,sdb), default use #{@disk}") do |disk|
|
36
|
+
@disk = Getch::Guard.disk(disk)
|
34
37
|
end
|
35
|
-
opts.on("-f", "--format FS", "Can be ext4, lvm. Default use ext4") do |fs|
|
36
|
-
@fs = fs
|
38
|
+
opts.on("-f", "--format FS", "Can be ext4, lvm or zfs. Default use ext4") do |fs|
|
39
|
+
@fs = Getch::Guard.format(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 = Getch::Guard.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 = Getch::Guard.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 = Getch::Guard.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.5
|
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
|
+
ZmVpbi9EQz1wcm90b25tYWlsL0RDPWNvbTAeFw0yMTA1MTEyMTAzNDZaFw0yMjA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HNUoLyEmFsCPabTCXjQH6EM2uBcsrjQN4SlgBNzsKc8bS4
|
35
|
+
F9Dl4EPzjBJOgQWf+NxzxNuNKI46Lp5Q8AI+xtDUHAPbSswHa40BA6ChFehP+j0L
|
36
|
+
fg==
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2021-06-20 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
|
@@ -83,12 +86,31 @@ files:
|
|
83
86
|
- lib/getch/filesystem/lvm/format.rb
|
84
87
|
- lib/getch/filesystem/lvm/mount.rb
|
85
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
|
86
105
|
- lib/getch/gentoo.rb
|
87
106
|
- lib/getch/gentoo/boot.rb
|
88
107
|
- lib/getch/gentoo/chroot.rb
|
89
108
|
- lib/getch/gentoo/config.rb
|
90
109
|
- lib/getch/gentoo/sources.rb
|
91
110
|
- lib/getch/gentoo/stage.rb
|
111
|
+
- lib/getch/gentoo/use.rb
|
112
|
+
- lib/getch/gentoo/use_flag.rb
|
113
|
+
- lib/getch/guard.rb
|
92
114
|
- lib/getch/helpers.rb
|
93
115
|
- lib/getch/log.rb
|
94
116
|
- lib/getch/options.rb
|
@@ -101,7 +123,7 @@ metadata:
|
|
101
123
|
changelog_uri: https://github.com/szorfein/getch/blob/master/CHANGELOG.md
|
102
124
|
bug_tracker_uri: https://github.com/szorfein/getch/issues
|
103
125
|
wiki_uri: https://github.com/szorfein/getch
|
104
|
-
post_install_message:
|
126
|
+
post_install_message:
|
105
127
|
rdoc_options: []
|
106
128
|
require_paths:
|
107
129
|
- lib
|
@@ -116,8 +138,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
138
|
- !ruby/object:Gem::Version
|
117
139
|
version: '0'
|
118
140
|
requirements: []
|
119
|
-
rubygems_version: 3.
|
120
|
-
signing_key:
|
141
|
+
rubygems_version: 3.0.9
|
142
|
+
signing_key:
|
121
143
|
specification_version: 4
|
122
144
|
summary: A CLI tool to install Gentoo
|
123
145
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|