getch 0.1.2 → 0.1.9
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/README.md +66 -32
- data/assets/network-stack.conf +63 -0
- data/assets/system.conf +38 -0
- data/bin/getch +12 -4
- data/lib/cmdline.rb +128 -0
- data/lib/getch/command.rb +32 -22
- data/lib/getch/config/gentoo.rb +58 -0
- data/lib/getch/config/void.rb +47 -0
- data/lib/getch/config.rb +45 -0
- data/lib/getch/filesystem/clean.rb +22 -15
- data/lib/getch/filesystem/device.rb +8 -6
- data/lib/getch/filesystem/ext4/config.rb +8 -4
- data/lib/getch/filesystem/ext4/deps.rb +3 -1
- data/lib/getch/filesystem/ext4/device.rb +2 -3
- data/lib/getch/filesystem/ext4/encrypt/config.rb +15 -11
- data/lib/getch/filesystem/ext4/encrypt/deps.rb +5 -10
- data/lib/getch/filesystem/ext4/encrypt/device.rb +5 -3
- data/lib/getch/filesystem/ext4/encrypt/format.rb +4 -2
- data/lib/getch/filesystem/ext4/encrypt/mount.rb +3 -3
- data/lib/getch/filesystem/ext4/encrypt/partition.rb +29 -35
- data/lib/getch/filesystem/ext4/encrypt/void.rb +101 -0
- data/lib/getch/filesystem/ext4/encrypt.rb +3 -0
- data/lib/getch/filesystem/ext4/format.rb +4 -1
- data/lib/getch/filesystem/ext4/mount.rb +3 -0
- data/lib/getch/filesystem/ext4/partition.rb +11 -8
- data/lib/getch/filesystem/ext4/void.rb +44 -0
- data/lib/getch/filesystem/ext4.rb +3 -0
- data/lib/getch/filesystem/lvm/config.rb +10 -29
- data/lib/getch/filesystem/lvm/deps.rb +7 -11
- data/lib/getch/filesystem/lvm/device.rb +5 -3
- data/lib/getch/filesystem/lvm/encrypt/config.rb +17 -17
- data/lib/getch/filesystem/lvm/encrypt/deps.rb +8 -12
- data/lib/getch/filesystem/lvm/encrypt/device.rb +7 -5
- data/lib/getch/filesystem/lvm/encrypt/format.rb +5 -2
- data/lib/getch/filesystem/lvm/encrypt/mount.rb +4 -2
- data/lib/getch/filesystem/lvm/encrypt/partition.rb +17 -13
- data/lib/getch/filesystem/lvm/encrypt/void.rb +101 -0
- data/lib/getch/filesystem/lvm/encrypt.rb +3 -0
- data/lib/getch/filesystem/lvm/format.rb +4 -1
- data/lib/getch/filesystem/lvm/mount.rb +3 -0
- data/lib/getch/filesystem/lvm/partition.rb +10 -7
- data/lib/getch/filesystem/lvm/void.rb +46 -0
- data/lib/getch/filesystem/lvm.rb +3 -0
- data/lib/getch/filesystem/mount.rb +19 -12
- data/lib/getch/filesystem/partition.rb +19 -11
- data/lib/getch/filesystem/zfs/config.rb +10 -24
- data/lib/getch/filesystem/zfs/deps.rb +28 -58
- data/lib/getch/filesystem/zfs/device.rb +9 -1
- data/lib/getch/filesystem/zfs/encrypt/config.rb +12 -28
- data/lib/getch/filesystem/zfs/encrypt/deps.rb +29 -60
- data/lib/getch/filesystem/zfs/encrypt/device.rb +9 -1
- data/lib/getch/filesystem/zfs/encrypt/format.rb +24 -22
- data/lib/getch/filesystem/zfs/encrypt/mount.rb +15 -14
- data/lib/getch/filesystem/zfs/encrypt/partition.rb +24 -18
- data/lib/getch/filesystem/zfs/encrypt/void.rb +97 -0
- data/lib/getch/filesystem/zfs/encrypt.rb +3 -0
- data/lib/getch/filesystem/zfs/format.rb +21 -18
- data/lib/getch/filesystem/zfs/mount.rb +12 -13
- data/lib/getch/filesystem/zfs/partition.rb +20 -15
- data/lib/getch/filesystem/zfs/void.rb +81 -0
- data/lib/getch/filesystem/zfs.rb +3 -0
- data/lib/getch/filesystem.rb +2 -0
- data/lib/getch/gentoo/boot.rb +29 -67
- data/lib/getch/gentoo/bootloader.rb +68 -0
- data/lib/getch/gentoo/chroot.rb +26 -29
- data/lib/getch/gentoo/config.rb +69 -31
- data/lib/getch/gentoo/sources.rb +73 -38
- data/lib/getch/gentoo/stage.rb +12 -13
- data/lib/getch/gentoo/use.rb +39 -0
- data/lib/getch/gentoo/use_flag.rb +89 -0
- data/lib/getch/gentoo.rb +39 -21
- data/lib/getch/guard.rb +71 -0
- data/lib/getch/helpers.rb +180 -48
- data/lib/getch/log.rb +10 -7
- data/lib/getch/options.rb +50 -41
- data/lib/getch/states.rb +10 -3
- data/lib/getch/version.rb +1 -1
- data/lib/getch/void/boot.rb +84 -0
- data/lib/getch/void/chroot.rb +56 -0
- data/lib/getch/void/config.rb +90 -0
- data/lib/getch/void/stage.rb +69 -0
- data/lib/getch/void.rb +65 -0
- data/lib/getch.rb +125 -74
- data.tar.gz.sig +0 -0
- metadata +28 -10
- metadata.gz.sig +0 -0
- data/.gitignore +0 -2
- data/CHANGELOG.md +0 -80
- data/Rakefile +0 -21
- data/bin/setup.sh +0 -90
- data/getch.gemspec +0 -25
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'fileutils'
|
|
4
|
+
require 'securerandom'
|
|
5
|
+
|
|
6
|
+
module Getch
|
|
7
|
+
module Void
|
|
8
|
+
class Config
|
|
9
|
+
include Helpers::Void
|
|
10
|
+
|
|
11
|
+
def initialize
|
|
12
|
+
@log = Getch::Log.new
|
|
13
|
+
@network_dir = "#{MOUNTPOINT}/etc"
|
|
14
|
+
@id = SecureRandom.hex(2)
|
|
15
|
+
@hostname = "void-hatch-#{@id}"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def host
|
|
19
|
+
print " => Adding hostname #{@hostname}..."
|
|
20
|
+
conf = "#{@network_dir}/hostname"
|
|
21
|
+
File.write(conf, "#{@hostname}\n", mode: 'w', chmod: 0744)
|
|
22
|
+
puts "\s[OK]"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def network
|
|
26
|
+
print ' => Copying /etc/resolv.conf...'
|
|
27
|
+
src = '/etc/resolv.conf'
|
|
28
|
+
dest = "#{@network_dir}/resolv.conf"
|
|
29
|
+
FileUtils.copy_file(src, dest)
|
|
30
|
+
puts "\s[Ok]"
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def system
|
|
34
|
+
print ' => Updating configs system...'
|
|
35
|
+
control_options
|
|
36
|
+
rc = "#{MOUNTPOINT}/etc/rc.conf"
|
|
37
|
+
add_line(rc, 'HARDWARECLOCK="UTC"') unless search(rc, /^HARDWARECLOCK/)
|
|
38
|
+
add_line(rc, "KEYMAP=\"#{OPTIONS[:keymap]}\"") unless search(rc, /^KEYMAP/)
|
|
39
|
+
add_line(rc, "TIMEZONE=\"#{OPTIONS[:zoneinfo]}\"") unless search(rc, /^TIMEZONE/)
|
|
40
|
+
add_line(rc, "HOSTNAME=\"#{@hostname}\"") unless search(rc, /^HOSTNAME/)
|
|
41
|
+
puts "\s[OK]"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def locale
|
|
45
|
+
print ' => Updating locale system...'
|
|
46
|
+
control_options
|
|
47
|
+
conf = "#{MOUNTPOINT}/etc/locale.conf"
|
|
48
|
+
File.write(conf, "LANG=#{@lang}\n")
|
|
49
|
+
add_line(conf, 'LC_COLLATE=C')
|
|
50
|
+
conf = "#{MOUNTPOINT}/etc/default/libc-locales"
|
|
51
|
+
add_line(conf, @utf8)
|
|
52
|
+
puts "\s[OK]"
|
|
53
|
+
command 'xbps-reconfigure -f glibc-locales'
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
private
|
|
57
|
+
|
|
58
|
+
def control_options
|
|
59
|
+
search_zone(OPTIONS[:zoneinfo])
|
|
60
|
+
search_utf8(OPTIONS[:language])
|
|
61
|
+
search_key(OPTIONS[:keymap])
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def search_key(keys)
|
|
65
|
+
@keymap = nil
|
|
66
|
+
Dir.glob("#{MOUNTPOINT}/usr/share/kbd/keymaps/**/#{keys}.map.gz") { |f|
|
|
67
|
+
@keymap = f
|
|
68
|
+
}
|
|
69
|
+
raise ArgumentError, "No keymap #{@keymap} found" unless @keymap
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def search_zone(zone)
|
|
73
|
+
unless File.exist? "#{MOUNTPOINT}/usr/share/zoneinfo/#{zone}"
|
|
74
|
+
raise ArgumentError, "Zoneinfo #{zone} doesn\'t exist."
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def search_utf8(lang)
|
|
79
|
+
@utf8, @lang = nil, nil
|
|
80
|
+
File.open("#{MOUNTPOINT}/etc/default/libc-locales").each do |l|
|
|
81
|
+
@utf8 = l.delete_prefix('#') if l.match(/#{lang}.UTF-8/)
|
|
82
|
+
|
|
83
|
+
found = l.split if l.match(/#{lang}.UTF-8/)
|
|
84
|
+
@lang = found[0].delete_prefix('#') if found
|
|
85
|
+
end
|
|
86
|
+
raise ArgumentError, "Lang #{lang} no found" unless @utf8
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'open-uri'
|
|
4
|
+
require 'open3'
|
|
5
|
+
|
|
6
|
+
module Getch
|
|
7
|
+
module Void
|
|
8
|
+
class RootFS
|
|
9
|
+
def initialize
|
|
10
|
+
@url = 'https://alpha.de.repo.voidlinux.org/live/current'
|
|
11
|
+
@file = 'sha256sum.txt'
|
|
12
|
+
@xbps = false
|
|
13
|
+
Dir.chdir(MOUNTPOINT)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Search only the glibc x86_64 for now
|
|
17
|
+
def search_archive
|
|
18
|
+
yurl = "#{@url}/#{@file}"
|
|
19
|
+
puts "Open #{yurl}"
|
|
20
|
+
Helpers.get_file_online(yurl, @file)
|
|
21
|
+
File.open(@file).each do |l|
|
|
22
|
+
@xbps = l.tr('()', '').split(' ') if l.match(/void-x86_64-ROOTFS-[\d._]+.tar.xz/)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def download
|
|
27
|
+
raise StandardError, 'No file found, retry later.' unless @xbps
|
|
28
|
+
return if File.exist? @xbps[1]
|
|
29
|
+
|
|
30
|
+
puts "Downloading #{@xbps[1]}..."
|
|
31
|
+
Helpers.get_file_online("#{@url}/#{@xbps[1]}", @xbps[1])
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def checksum
|
|
35
|
+
print ' => Checking SHA256 checksum...'
|
|
36
|
+
# Should contain 2 spaces...
|
|
37
|
+
command = "echo #{@xbps[3]} #{@xbps[1]} | sha256sum --check"
|
|
38
|
+
_, stderr, status = Open3.capture3(command)
|
|
39
|
+
if status.success? then
|
|
40
|
+
puts "\t[OK]"
|
|
41
|
+
decompress
|
|
42
|
+
cleaning
|
|
43
|
+
return
|
|
44
|
+
end
|
|
45
|
+
cleaning
|
|
46
|
+
raise "Problem with the checksum, stderr\n#{stderr}"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
private
|
|
50
|
+
|
|
51
|
+
def decompress
|
|
52
|
+
print " => Decompressing archive #{@xbps[1]}..."
|
|
53
|
+
cmd = "tar xpf #{@xbps[1]} --xattrs-include=\'*.*\' --numeric-owner"
|
|
54
|
+
_, stderr, status = Open3.capture3(cmd)
|
|
55
|
+
if status.success? then
|
|
56
|
+
puts "\s[OK]"
|
|
57
|
+
return
|
|
58
|
+
end
|
|
59
|
+
cleaning
|
|
60
|
+
raise "Fail to decompress archive #{@xbps[1]} - #{stderr}."
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def cleaning
|
|
64
|
+
Dir.glob('void-x86_64*.tar.xz').each { |f| File.delete(f) }
|
|
65
|
+
Dir.glob('sha256*').each { |f| File.delete(f) }
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
data/lib/getch/void.rb
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'void/stage'
|
|
4
|
+
require_relative 'void/config'
|
|
5
|
+
require_relative 'void/chroot'
|
|
6
|
+
#require_relative 'void/sources'
|
|
7
|
+
require_relative 'void/boot'
|
|
8
|
+
|
|
9
|
+
module Getch
|
|
10
|
+
module Void
|
|
11
|
+
class Main
|
|
12
|
+
def initialize
|
|
13
|
+
@state = Getch::States.new
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def root_fs
|
|
17
|
+
return if STATES[:gentoo_base]
|
|
18
|
+
|
|
19
|
+
xbps = Getch::Void::RootFS.new
|
|
20
|
+
xbps.search_archive
|
|
21
|
+
xbps.download
|
|
22
|
+
xbps.checksum
|
|
23
|
+
@state.stage3
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def config
|
|
27
|
+
return if STATES[:gentoo_config]
|
|
28
|
+
|
|
29
|
+
config = Getch::Void::Config.new
|
|
30
|
+
config.host
|
|
31
|
+
config.network
|
|
32
|
+
config.system
|
|
33
|
+
config.locale
|
|
34
|
+
@state.config
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def chroot
|
|
38
|
+
return if STATES[:gentoo_kernel]
|
|
39
|
+
|
|
40
|
+
chroot = Getch::Void::Chroot.new
|
|
41
|
+
chroot.update
|
|
42
|
+
chroot.fs
|
|
43
|
+
chroot.extras
|
|
44
|
+
chroot.install_pkgs
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def kernel
|
|
48
|
+
return if STATES[:gentoo_kernel]
|
|
49
|
+
|
|
50
|
+
Getch::Void::Sources.new
|
|
51
|
+
@state.kernel
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def boot
|
|
55
|
+
boot = Getch::Void::Boot.new
|
|
56
|
+
boot.new_user
|
|
57
|
+
boot.fstab
|
|
58
|
+
boot.dracut
|
|
59
|
+
boot.grub
|
|
60
|
+
boot.initramfs
|
|
61
|
+
boot.finish
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
data/lib/getch.rb
CHANGED
|
@@ -1,25 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'getch/helpers'
|
|
1
4
|
require_relative 'getch/options'
|
|
2
5
|
require_relative 'getch/states'
|
|
3
6
|
require_relative 'getch/gentoo'
|
|
7
|
+
require_relative 'getch/void'
|
|
4
8
|
require_relative 'getch/filesystem'
|
|
5
9
|
require_relative 'getch/command'
|
|
6
|
-
require_relative 'getch/helpers'
|
|
7
10
|
require_relative 'getch/log'
|
|
11
|
+
require_relative 'getch/config'
|
|
12
|
+
require_relative 'getch/guard'
|
|
13
|
+
require_relative 'getch/version'
|
|
8
14
|
|
|
9
15
|
module Getch
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
language
|
|
13
|
-
zoneinfo
|
|
14
|
-
keymap
|
|
15
|
-
disk
|
|
16
|
-
fs
|
|
17
|
-
username
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
OPTIONS = {
|
|
18
|
+
:language => 'en_US',
|
|
19
|
+
:zoneinfo => 'US/Eastern',
|
|
20
|
+
:keymap => 'us',
|
|
21
|
+
:disk => false,
|
|
22
|
+
:fs => 'ext4',
|
|
23
|
+
:username => false,
|
|
24
|
+
:os => 'gentoo',
|
|
25
|
+
:boot_disk => false,
|
|
26
|
+
:cache_disk => false,
|
|
27
|
+
:home_disk => false,
|
|
28
|
+
:encrypt => false,
|
|
29
|
+
:verbose => false
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
STATES = {
|
|
@@ -29,83 +36,127 @@ module Getch
|
|
|
29
36
|
:gentoo_base => false,
|
|
30
37
|
:gentoo_config => false,
|
|
31
38
|
:gentoo_update => false,
|
|
39
|
+
:gentoo_bootloader => false,
|
|
32
40
|
:gentoo_kernel => false
|
|
33
41
|
}
|
|
34
42
|
|
|
35
|
-
MOUNTPOINT =
|
|
43
|
+
MOUNTPOINT = '/mnt/gentoo'
|
|
44
|
+
|
|
36
45
|
DEFAULT_FS = {
|
|
37
46
|
true => {
|
|
38
|
-
ext4:
|
|
39
|
-
lvm:
|
|
40
|
-
zfs:
|
|
47
|
+
ext4: FileSystem::Ext4::Encrypt,
|
|
48
|
+
lvm: FileSystem::Lvm::Encrypt,
|
|
49
|
+
zfs: FileSystem::Zfs::Encrypt
|
|
41
50
|
},
|
|
42
51
|
false => {
|
|
43
|
-
ext4:
|
|
44
|
-
lvm:
|
|
45
|
-
zfs:
|
|
52
|
+
ext4: FileSystem::Ext4,
|
|
53
|
+
lvm: FileSystem::Lvm,
|
|
54
|
+
zfs: FileSystem::Zfs,
|
|
46
55
|
}
|
|
47
56
|
}.freeze
|
|
48
57
|
|
|
49
|
-
def self.
|
|
50
|
-
encrypt =
|
|
51
|
-
|
|
52
|
-
DEFAULT_FS[encrypt][
|
|
58
|
+
def self.select_fs
|
|
59
|
+
encrypt = OPTIONS[:encrypt]
|
|
60
|
+
fs_sym = OPTIONS[:fs].to_sym
|
|
61
|
+
DEFAULT_FS[encrypt][fs_sym]
|
|
53
62
|
end
|
|
54
63
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
puts "Filesystem: #{DEFAULT_OPTIONS[:fs]}"
|
|
62
|
-
puts "Username: #{DEFAULT_OPTIONS[:username]}"
|
|
63
|
-
puts "Encrypt: #{DEFAULT_OPTIONS[:encrypt]}"
|
|
64
|
-
puts
|
|
65
|
-
puts "separate-boot disk: #{DEFAULT_OPTIONS[:boot_disk]}"
|
|
66
|
-
puts "separate-cache disk: #{DEFAULT_OPTIONS[:cache_disk]}"
|
|
67
|
-
puts "separate-home disk: #{DEFAULT_OPTIONS[:home_disk]}"
|
|
68
|
-
puts
|
|
69
|
-
print "Continue? (n,y) "
|
|
70
|
-
case gets.chomp
|
|
71
|
-
when /^y|^Y/
|
|
72
|
-
return
|
|
73
|
-
else
|
|
74
|
-
exit 1
|
|
64
|
+
class Main
|
|
65
|
+
def initialize(argv)
|
|
66
|
+
argv[:cli]
|
|
67
|
+
@class_fs = Getch::select_fs
|
|
68
|
+
@log = Log.new
|
|
69
|
+
Getch::States.new # Update States
|
|
75
70
|
end
|
|
76
|
-
end
|
|
77
71
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
72
|
+
def resume
|
|
73
|
+
raise 'No disk, use at least getch with -d DISK' unless OPTIONS[:disk]
|
|
74
|
+
|
|
75
|
+
puts "\nBuild " + OPTIONS[:os].capitalize + " Linux with the following args:\n"
|
|
76
|
+
puts
|
|
77
|
+
puts "\tLang: #{OPTIONS[:language]}"
|
|
78
|
+
puts "\tZoneinfo: #{OPTIONS[:zoneinfo]}"
|
|
79
|
+
puts "\tKeymap: #{OPTIONS[:keymap]}"
|
|
80
|
+
puts "\tDisk: #{OPTIONS[:disk]}"
|
|
81
|
+
puts "\tFilesystem: #{OPTIONS[:fs]}"
|
|
82
|
+
puts "\tUsername: #{OPTIONS[:username]}"
|
|
83
|
+
puts "\tEncrypt: #{OPTIONS[:encrypt]}"
|
|
84
|
+
puts
|
|
85
|
+
puts "\tseparate-boot disk: #{OPTIONS[:boot_disk]}"
|
|
86
|
+
puts "\tseparate-cache disk: #{OPTIONS[:cache_disk]}"
|
|
87
|
+
puts "\tseparate-home disk: #{OPTIONS[:home_disk]}"
|
|
88
|
+
puts
|
|
89
|
+
print 'Continue? (y,N) '
|
|
90
|
+
case gets.chomp
|
|
91
|
+
when /^y|^Y/
|
|
92
|
+
return
|
|
93
|
+
else
|
|
94
|
+
exit
|
|
95
|
+
end
|
|
90
96
|
end
|
|
91
|
-
end
|
|
92
97
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
def partition
|
|
99
|
+
return if STATES[:partition]
|
|
100
|
+
|
|
101
|
+
puts
|
|
102
|
+
print "Partition and format disk #{OPTIONS[:disk]}, this will erase all data, continue? (y,N) "
|
|
103
|
+
case gets.chomp
|
|
104
|
+
when /^y|^Y/
|
|
105
|
+
@log.info('Partition start')
|
|
106
|
+
@class_fs::Partition.new
|
|
107
|
+
else
|
|
108
|
+
exit
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def format
|
|
113
|
+
return if STATES[:format]
|
|
101
114
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
115
|
+
@class_fs::Format.new
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def mount
|
|
119
|
+
return if STATES[:mount]
|
|
120
|
+
|
|
121
|
+
@class_fs::Mount.new.run
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def install
|
|
125
|
+
if OPTIONS[:os] == 'gentoo'
|
|
126
|
+
install_gentoo
|
|
127
|
+
elsif OPTIONS[:os] == 'void'
|
|
128
|
+
install_void
|
|
129
|
+
else
|
|
130
|
+
puts "Options #{OPTIONS[:os]} not supported...."
|
|
131
|
+
exit 1
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def install_gentoo
|
|
136
|
+
gentoo = Getch::Gentoo::Main.new
|
|
137
|
+
gentoo.stage3
|
|
138
|
+
gentoo.config
|
|
139
|
+
gentoo.chroot
|
|
140
|
+
gentoo.bootloader
|
|
141
|
+
gentoo.kernel
|
|
142
|
+
gentoo.boot
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def install_void
|
|
146
|
+
void = Getch::Void::Main.new
|
|
147
|
+
void.root_fs
|
|
148
|
+
void.config
|
|
149
|
+
void.chroot
|
|
150
|
+
void.boot
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
def configure
|
|
154
|
+
config = Getch::Config::Main.new
|
|
155
|
+
config.ethernet
|
|
156
|
+
config.wifi
|
|
157
|
+
config.dns
|
|
158
|
+
config.sysctl
|
|
159
|
+
config.shell
|
|
160
|
+
end
|
|
110
161
|
end
|
|
111
162
|
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.1.
|
|
4
|
+
version: 0.1.9
|
|
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:
|
|
38
|
+
date: 2022-01-26 00:00:00.000000000 Z
|
|
39
39
|
dependencies: []
|
|
40
40
|
description:
|
|
41
41
|
email:
|
|
@@ -43,17 +43,19 @@ email:
|
|
|
43
43
|
executables:
|
|
44
44
|
- getch
|
|
45
45
|
extensions: []
|
|
46
|
-
extra_rdoc_files:
|
|
46
|
+
extra_rdoc_files:
|
|
47
|
+
- README.md
|
|
47
48
|
files:
|
|
48
|
-
- ".gitignore"
|
|
49
|
-
- CHANGELOG.md
|
|
50
49
|
- README.md
|
|
51
|
-
-
|
|
50
|
+
- assets/network-stack.conf
|
|
51
|
+
- assets/system.conf
|
|
52
52
|
- bin/getch
|
|
53
|
-
-
|
|
54
|
-
- getch.gemspec
|
|
53
|
+
- lib/cmdline.rb
|
|
55
54
|
- lib/getch.rb
|
|
56
55
|
- lib/getch/command.rb
|
|
56
|
+
- lib/getch/config.rb
|
|
57
|
+
- lib/getch/config/gentoo.rb
|
|
58
|
+
- lib/getch/config/void.rb
|
|
57
59
|
- lib/getch/filesystem.rb
|
|
58
60
|
- lib/getch/filesystem/clean.rb
|
|
59
61
|
- lib/getch/filesystem/device.rb
|
|
@@ -68,9 +70,11 @@ files:
|
|
|
68
70
|
- lib/getch/filesystem/ext4/encrypt/format.rb
|
|
69
71
|
- lib/getch/filesystem/ext4/encrypt/mount.rb
|
|
70
72
|
- lib/getch/filesystem/ext4/encrypt/partition.rb
|
|
73
|
+
- lib/getch/filesystem/ext4/encrypt/void.rb
|
|
71
74
|
- lib/getch/filesystem/ext4/format.rb
|
|
72
75
|
- lib/getch/filesystem/ext4/mount.rb
|
|
73
76
|
- lib/getch/filesystem/ext4/partition.rb
|
|
77
|
+
- lib/getch/filesystem/ext4/void.rb
|
|
74
78
|
- lib/getch/filesystem/lvm.rb
|
|
75
79
|
- lib/getch/filesystem/lvm/config.rb
|
|
76
80
|
- lib/getch/filesystem/lvm/deps.rb
|
|
@@ -82,9 +86,11 @@ files:
|
|
|
82
86
|
- lib/getch/filesystem/lvm/encrypt/format.rb
|
|
83
87
|
- lib/getch/filesystem/lvm/encrypt/mount.rb
|
|
84
88
|
- lib/getch/filesystem/lvm/encrypt/partition.rb
|
|
89
|
+
- lib/getch/filesystem/lvm/encrypt/void.rb
|
|
85
90
|
- lib/getch/filesystem/lvm/format.rb
|
|
86
91
|
- lib/getch/filesystem/lvm/mount.rb
|
|
87
92
|
- lib/getch/filesystem/lvm/partition.rb
|
|
93
|
+
- lib/getch/filesystem/lvm/void.rb
|
|
88
94
|
- lib/getch/filesystem/mount.rb
|
|
89
95
|
- lib/getch/filesystem/partition.rb
|
|
90
96
|
- lib/getch/filesystem/zfs.rb
|
|
@@ -98,24 +104,36 @@ files:
|
|
|
98
104
|
- lib/getch/filesystem/zfs/encrypt/format.rb
|
|
99
105
|
- lib/getch/filesystem/zfs/encrypt/mount.rb
|
|
100
106
|
- lib/getch/filesystem/zfs/encrypt/partition.rb
|
|
107
|
+
- lib/getch/filesystem/zfs/encrypt/void.rb
|
|
101
108
|
- lib/getch/filesystem/zfs/format.rb
|
|
102
109
|
- lib/getch/filesystem/zfs/mount.rb
|
|
103
110
|
- lib/getch/filesystem/zfs/partition.rb
|
|
111
|
+
- lib/getch/filesystem/zfs/void.rb
|
|
104
112
|
- lib/getch/gentoo.rb
|
|
105
113
|
- lib/getch/gentoo/boot.rb
|
|
114
|
+
- lib/getch/gentoo/bootloader.rb
|
|
106
115
|
- lib/getch/gentoo/chroot.rb
|
|
107
116
|
- lib/getch/gentoo/config.rb
|
|
108
117
|
- lib/getch/gentoo/sources.rb
|
|
109
118
|
- lib/getch/gentoo/stage.rb
|
|
119
|
+
- lib/getch/gentoo/use.rb
|
|
120
|
+
- lib/getch/gentoo/use_flag.rb
|
|
121
|
+
- lib/getch/guard.rb
|
|
110
122
|
- lib/getch/helpers.rb
|
|
111
123
|
- lib/getch/log.rb
|
|
112
124
|
- lib/getch/options.rb
|
|
113
125
|
- lib/getch/states.rb
|
|
114
126
|
- lib/getch/version.rb
|
|
127
|
+
- lib/getch/void.rb
|
|
128
|
+
- lib/getch/void/boot.rb
|
|
129
|
+
- lib/getch/void/chroot.rb
|
|
130
|
+
- lib/getch/void/config.rb
|
|
131
|
+
- lib/getch/void/stage.rb
|
|
115
132
|
homepage: https://github.com/szorfein/getch
|
|
116
133
|
licenses:
|
|
117
134
|
- MIT
|
|
118
135
|
metadata:
|
|
136
|
+
source_code_uri: https://github.com/szorfein/getch
|
|
119
137
|
changelog_uri: https://github.com/szorfein/getch/blob/master/CHANGELOG.md
|
|
120
138
|
bug_tracker_uri: https://github.com/szorfein/getch/issues
|
|
121
139
|
wiki_uri: https://github.com/szorfein/getch
|
|
@@ -127,14 +145,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
127
145
|
requirements:
|
|
128
146
|
- - ">="
|
|
129
147
|
- !ruby/object:Gem::Version
|
|
130
|
-
version:
|
|
148
|
+
version: 2.5.0
|
|
131
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
150
|
requirements:
|
|
133
151
|
- - ">="
|
|
134
152
|
- !ruby/object:Gem::Version
|
|
135
153
|
version: '0'
|
|
136
154
|
requirements: []
|
|
137
|
-
rubygems_version: 3.
|
|
155
|
+
rubygems_version: 3.2.32
|
|
138
156
|
signing_key:
|
|
139
157
|
specification_version: 4
|
|
140
158
|
summary: A CLI tool to install Gentoo
|
metadata.gz.sig
CHANGED
|
Binary file
|
data/.gitignore
DELETED
data/CHANGELOG.md
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
## 0.1.2, release 2021-05-12
|
|
2
|
-
* DOCS update.
|
|
3
|
-
* Keep Nano for those who need :)
|
|
4
|
-
* ZFS use the last version >=2.0 with kernel stable =5.10
|
|
5
|
-
* ZFS create a Log device and Cache device if getch is used with `--separate-cache`.
|
|
6
|
-
* GRUB or Systemd-boot can now be installed on separate disk with `--separate-boot`.
|
|
7
|
-
* Adding flag for ZFS `-o autotrim=on` (used with `zpool create`).
|
|
8
|
-
* Encrypted swap use: `cipher=aes-xts-plain64:sha256,size=512` by default.
|
|
9
|
-
* In the make.conf: add `-fomit-frame-pointer`, designed to reduce generated code size.
|
|
10
|
-
|
|
11
|
-
## 0.1.1, release 2020-11-01
|
|
12
|
-
* Change mountpoint for the esp at /efi rather than /boot/efi
|
|
13
|
-
* Replace Garden by Bask https://github.com/szorfein/bask
|
|
14
|
-
* Correct option --username USERNAME, do not create a new partition.
|
|
15
|
-
* New set of options --separate-{boot,cache,home} to install them on another disk
|
|
16
|
-
* Refactor codes
|
|
17
|
-
* Add cpu name to COMMON_FLAGS
|
|
18
|
-
* Add cpuflags with app-portage/cpuid2cpuflags
|
|
19
|
-
+ Use the whole disk space available for / when option --username is unset
|
|
20
|
-
|
|
21
|
-
## 0.1.0, release 2020-10-15
|
|
22
|
-
* Add the (Zeta) filesystem ZFS
|
|
23
|
-
* `emerge --depclean` to save space.
|
|
24
|
-
* Add a message when getch have finish, keep /mnt/gentoo if you need to add something.
|
|
25
|
-
* Use systemd-detect-virt to detect a Virtual Guest.
|
|
26
|
-
|
|
27
|
-
## 0.0.9, release 2020-10-03
|
|
28
|
-
* Add encryption on ext4 and lvm (BIOS,UEFI)
|
|
29
|
-
* Correct KEYMAP="yes" with genkernel
|
|
30
|
-
* Renaming option keyboard with keymap
|
|
31
|
-
* GPG verification for ebuild
|
|
32
|
-
|
|
33
|
-
## 0.0.8, release 2020-09-30
|
|
34
|
-
* Adding LVM via the option fs, `--fs lvm`.
|
|
35
|
-
* Systemd-boot use the value of PARTUUID without initramfs.
|
|
36
|
-
* Include lib logger.
|
|
37
|
-
* Enhance functions to call program system Emerge, Make, ...
|
|
38
|
-
|
|
39
|
-
## 0.0.7, release 2020-09-22
|
|
40
|
-
* Correct fstab.
|
|
41
|
-
* Repair GRUB/fstab for BIOS system, add secure cmdline.
|
|
42
|
-
* Create a swap volume equal to the memory installed.
|
|
43
|
-
* Add vim and sudo
|
|
44
|
-
|
|
45
|
-
## 0.0.6, release 2020-09-19
|
|
46
|
-
* Add support for QEMU guest with KVM and Virtio driver
|
|
47
|
-
* Kernel compilation, initialize a config file with `make localyesconfig`.
|
|
48
|
-
* More modular codes to start with encryption and other filesystems.
|
|
49
|
-
* Add the new option --verbose to display output of compilation, etc...
|
|
50
|
-
|
|
51
|
-
## 0.0.5, release 2020-09-17
|
|
52
|
-
* Generate a hostname
|
|
53
|
-
* Configure systemd-boot for UEFI system
|
|
54
|
-
|
|
55
|
-
## 0.0.4, release 2020-09-16
|
|
56
|
-
* Boot on a BIOS system with VirtualBox
|
|
57
|
-
* Install Grub
|
|
58
|
-
* Create user
|
|
59
|
-
* Create passwd for root and user
|
|
60
|
-
* Check lsmod to install deps (like wpa_supplicant) and patch the kernel
|
|
61
|
-
|
|
62
|
-
## 0.0.3, release 2020-09-14
|
|
63
|
-
* Add dhcpcd, gentoo-sources, linux-firmware
|
|
64
|
-
* Kernel build by using https://github.com/szorfein/garden
|
|
65
|
-
* Populate /etc/portage (/etc/portage/package.{use,unmask,accept_keywords}/zzz_via_autounmask)
|
|
66
|
-
* Download all the lastest ebuild via emerge-webrsync
|
|
67
|
-
* Update gentoo via emerge -uDN @world
|
|
68
|
-
|
|
69
|
-
## 0.0.2, release 2020-09-12
|
|
70
|
-
* Getch genere a file /tmp/install_gentoo to avoid to remake same task over and over
|
|
71
|
-
* Support for ext4
|
|
72
|
-
* Mount partition on /mnt/gentoo during the install
|
|
73
|
-
* Download, verify the checksum and decompress the last stage3-amd64-systemd
|
|
74
|
-
|
|
75
|
-
## 0.0.1, release 2020-09-10
|
|
76
|
-
* Partition disk (at least 15G required) with sgdisk (create /boot, /, /home, and swap)
|
|
77
|
-
* Support for one disk with -d|--disk
|
|
78
|
-
* Add few options for the CLI
|
|
79
|
-
* Add bin/setup.sh to install ruby when boot on a ISO file
|
|
80
|
-
* Init project
|
data/Rakefile
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# https://github.com/seattlerb/minitest#running-your-tests-
|
|
2
|
-
require "rake/testtask"
|
|
3
|
-
require File.dirname(__FILE__) + "/lib/getch/version"
|
|
4
|
-
|
|
5
|
-
Rake::TestTask.new(:test) do |t|
|
|
6
|
-
t.libs << "test"
|
|
7
|
-
t.libs << "lib"
|
|
8
|
-
t.test_files = FileList["test/test_*.rb"]
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
# Usage: rake gem:build
|
|
12
|
-
namespace :gem do
|
|
13
|
-
desc "build the gem"
|
|
14
|
-
task :build do
|
|
15
|
-
Dir["getch*.gem"].each {|f| File.unlink(f) }
|
|
16
|
-
system("gem build getch.gemspec")
|
|
17
|
-
system("gem install getch-#{Getch::VERSION}.gem -P HighSecurity")
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
task :default => :test
|