getch 0.1.0 → 0.1.1
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 +9 -0
- data/README.md +18 -4
- data/lib/getch.rb +14 -7
- data/lib/getch/command.rb +18 -4
- data/lib/getch/filesystem.rb +5 -0
- data/lib/getch/filesystem/clean.rb +51 -0
- data/lib/getch/filesystem/device.rb +55 -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 +9 -9
- data/lib/getch/filesystem/ext4/encrypt/deps.rb +1 -1
- 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 +5 -5
- data/lib/getch/filesystem/lvm/deps.rb +3 -2
- data/lib/getch/filesystem/lvm/device.rb +23 -7
- data/lib/getch/filesystem/lvm/encrypt/config.rb +3 -3
- data/lib/getch/filesystem/lvm/encrypt/deps.rb +1 -1
- data/lib/getch/filesystem/lvm/encrypt/device.rb +23 -7
- 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 +19 -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/config.rb +4 -5
- data/lib/getch/filesystem/zfs/deps.rb +3 -6
- data/lib/getch/filesystem/zfs/device.rb +30 -9
- data/lib/getch/filesystem/zfs/encrypt/config.rb +7 -7
- data/lib/getch/filesystem/zfs/encrypt/deps.rb +2 -6
- data/lib/getch/filesystem/zfs/encrypt/device.rb +30 -9
- data/lib/getch/filesystem/zfs/encrypt/format.rb +84 -1
- data/lib/getch/filesystem/zfs/encrypt/mount.rb +4 -20
- data/lib/getch/filesystem/zfs/encrypt/partition.rb +15 -111
- data/lib/getch/filesystem/zfs/format.rb +84 -2
- data/lib/getch/filesystem/zfs/mount.rb +5 -24
- data/lib/getch/filesystem/zfs/partition.rb +15 -108
- data/lib/getch/gentoo.rb +2 -1
- data/lib/getch/gentoo/boot.rb +2 -2
- data/lib/getch/gentoo/chroot.rb +10 -24
- data/lib/getch/gentoo/config.rb +22 -2
- data/lib/getch/gentoo/sources.rb +11 -11
- data/lib/getch/helpers.rb +13 -0
- data/lib/getch/options.rb +20 -5
- data/lib/getch/version.rb +1 -1
- metadata +6 -2
- metadata.gz.sig +0 -0
data/lib/getch/gentoo/sources.rb
CHANGED
@@ -15,7 +15,7 @@ module Getch
|
|
15
15
|
|
16
16
|
def build_kspp
|
17
17
|
puts "Adding KSPP to the kernel source"
|
18
|
-
|
18
|
+
bask("-b -a systemd")
|
19
19
|
end
|
20
20
|
|
21
21
|
def make
|
@@ -26,8 +26,8 @@ module Getch
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
30
|
-
Getch::Make.new("make
|
29
|
+
def localmodconfig
|
30
|
+
Getch::Make.new("make localmodconfig").run!
|
31
31
|
end
|
32
32
|
|
33
33
|
private
|
@@ -43,37 +43,37 @@ module Getch
|
|
43
43
|
def virtualbox_guest
|
44
44
|
systemd=`systemd-detect-virt`.chomp
|
45
45
|
return if ! ismatch?('vmwgfx') || systemd.match(/none/)
|
46
|
-
|
46
|
+
bask("-a virtualbox-guest")
|
47
47
|
Getch::Emerge.new("app-emulation/virtualbox-guest-additions").pkg!
|
48
48
|
end
|
49
49
|
|
50
50
|
def qemu_guest
|
51
|
-
|
52
|
-
|
51
|
+
bask("-a kvm-host") if ismatch?('kvm')
|
52
|
+
bask("-a kvm-guest") if ismatch?('virtio')
|
53
53
|
end
|
54
54
|
|
55
55
|
def ismatch?(arg)
|
56
56
|
@lsmod.match?(/#{arg}/)
|
57
57
|
end
|
58
58
|
|
59
|
-
def
|
60
|
-
Getch::
|
59
|
+
def bask(cmd)
|
60
|
+
Getch::Bask.new(cmd).run!
|
61
61
|
end
|
62
62
|
|
63
63
|
def install_wifi
|
64
64
|
return if ! ismatch?('cfg80211')
|
65
|
-
|
65
|
+
bask("-a wifi")
|
66
66
|
wifi_drivers
|
67
67
|
Getch::Emerge.new("net-wireless/iw wpa_supplicant net-wireless/iwd").pkg!
|
68
68
|
end
|
69
69
|
|
70
70
|
def install_audio
|
71
71
|
return if ! ismatch?('snd_pcm')
|
72
|
-
|
72
|
+
bask("-a sound")
|
73
73
|
end
|
74
74
|
|
75
75
|
def wifi_drivers
|
76
|
-
|
76
|
+
bask("-a ath9k-driver") if ismatch?('ath9k')
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
data/lib/getch/helpers.rb
CHANGED
@@ -55,4 +55,17 @@ module Helpers
|
|
55
55
|
raise "Error with #{cmd}"
|
56
56
|
end
|
57
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}/)
|
70
|
+
end
|
58
71
|
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)
|
@@ -29,17 +32,29 @@ module Getch
|
|
29
32
|
opts.on("-k", "--keymap KEY", "Default is us") do |key|
|
30
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,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: getch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- szorfein
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
J/zT/q2Ac7BWpSLbv6p9lChBiEnD9j24x463LR5QQjDNS5SsjzRQfFuprsa9Nqf2
|
36
36
|
Tw==
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2020-
|
38
|
+
date: 2020-11-01 00:00:00.000000000 Z
|
39
39
|
dependencies: []
|
40
40
|
description:
|
41
41
|
email:
|
@@ -55,6 +55,8 @@ files:
|
|
55
55
|
- lib/getch.rb
|
56
56
|
- lib/getch/command.rb
|
57
57
|
- lib/getch/filesystem.rb
|
58
|
+
- lib/getch/filesystem/clean.rb
|
59
|
+
- lib/getch/filesystem/device.rb
|
58
60
|
- lib/getch/filesystem/ext4.rb
|
59
61
|
- lib/getch/filesystem/ext4/config.rb
|
60
62
|
- lib/getch/filesystem/ext4/deps.rb
|
@@ -83,6 +85,8 @@ files:
|
|
83
85
|
- lib/getch/filesystem/lvm/format.rb
|
84
86
|
- lib/getch/filesystem/lvm/mount.rb
|
85
87
|
- lib/getch/filesystem/lvm/partition.rb
|
88
|
+
- lib/getch/filesystem/mount.rb
|
89
|
+
- lib/getch/filesystem/partition.rb
|
86
90
|
- lib/getch/filesystem/zfs.rb
|
87
91
|
- lib/getch/filesystem/zfs/config.rb
|
88
92
|
- lib/getch/filesystem/zfs/deps.rb
|
metadata.gz.sig
CHANGED
Binary file
|