getch 0.1.0 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/README.md +95 -22
  5. data/assets/network-stack.conf +63 -0
  6. data/bin/getch +12 -4
  7. data/lib/getch.rb +116 -66
  8. data/lib/getch/command.rb +19 -5
  9. data/lib/getch/config.rb +42 -0
  10. data/lib/getch/config/gentoo.rb +59 -0
  11. data/lib/getch/config/void.rb +49 -0
  12. data/lib/getch/filesystem.rb +5 -0
  13. data/lib/getch/filesystem/.mount.rb.swp +0 -0
  14. data/lib/getch/filesystem/clean.rb +58 -0
  15. data/lib/getch/filesystem/device.rb +61 -0
  16. data/lib/getch/filesystem/ext4.rb +1 -0
  17. data/lib/getch/filesystem/ext4/config.rb +8 -9
  18. data/lib/getch/filesystem/ext4/device.rb +2 -7
  19. data/lib/getch/filesystem/ext4/encrypt.rb +1 -0
  20. data/lib/getch/filesystem/ext4/encrypt/config.rb +8 -9
  21. data/lib/getch/filesystem/ext4/encrypt/deps.rb +3 -19
  22. data/lib/getch/filesystem/ext4/encrypt/device.rb +3 -8
  23. data/lib/getch/filesystem/ext4/encrypt/format.rb +3 -6
  24. data/lib/getch/filesystem/ext4/encrypt/mount.rb +5 -43
  25. data/lib/getch/filesystem/ext4/encrypt/partition.rb +29 -54
  26. data/lib/getch/filesystem/ext4/encrypt/void.rb +100 -0
  27. data/lib/getch/filesystem/ext4/format.rb +4 -6
  28. data/lib/getch/filesystem/ext4/mount.rb +7 -46
  29. data/lib/getch/filesystem/ext4/partition.rb +16 -39
  30. data/lib/getch/filesystem/ext4/void.rb +43 -0
  31. data/lib/getch/filesystem/lvm.rb +1 -0
  32. data/lib/getch/filesystem/lvm/config.rb +11 -15
  33. data/lib/getch/filesystem/lvm/deps.rb +4 -19
  34. data/lib/getch/filesystem/lvm/device.rb +33 -9
  35. data/lib/getch/filesystem/lvm/encrypt.rb +1 -0
  36. data/lib/getch/filesystem/lvm/encrypt/config.rb +9 -12
  37. data/lib/getch/filesystem/lvm/encrypt/deps.rb +4 -21
  38. data/lib/getch/filesystem/lvm/encrypt/device.rb +33 -9
  39. data/lib/getch/filesystem/lvm/encrypt/format.rb +3 -4
  40. data/lib/getch/filesystem/lvm/encrypt/mount.rb +7 -47
  41. data/lib/getch/filesystem/lvm/encrypt/partition.rb +30 -38
  42. data/lib/getch/filesystem/lvm/encrypt/void.rb +100 -0
  43. data/lib/getch/filesystem/lvm/format.rb +12 -8
  44. data/lib/getch/filesystem/lvm/mount.rb +7 -46
  45. data/lib/getch/filesystem/lvm/partition.rb +19 -31
  46. data/lib/getch/filesystem/lvm/void.rb +45 -0
  47. data/lib/getch/filesystem/mount.rb +56 -0
  48. data/lib/getch/filesystem/partition.rb +77 -0
  49. data/lib/getch/filesystem/zfs.rb +1 -0
  50. data/lib/getch/filesystem/zfs/config.rb +7 -8
  51. data/lib/getch/filesystem/zfs/deps.rb +24 -12
  52. data/lib/getch/filesystem/zfs/device.rb +54 -9
  53. data/lib/getch/filesystem/zfs/encrypt.rb +1 -0
  54. data/lib/getch/filesystem/zfs/encrypt/.mount.rb.swp +0 -0
  55. data/lib/getch/filesystem/zfs/encrypt/config.rb +11 -11
  56. data/lib/getch/filesystem/zfs/encrypt/deps.rb +24 -14
  57. data/lib/getch/filesystem/zfs/encrypt/device.rb +54 -9
  58. data/lib/getch/filesystem/zfs/encrypt/format.rb +84 -3
  59. data/lib/getch/filesystem/zfs/encrypt/mount.rb +8 -28
  60. data/lib/getch/filesystem/zfs/encrypt/partition.rb +26 -109
  61. data/lib/getch/filesystem/zfs/encrypt/void.rb +96 -0
  62. data/lib/getch/filesystem/zfs/format.rb +97 -4
  63. data/lib/getch/filesystem/zfs/mount.rb +10 -32
  64. data/lib/getch/filesystem/zfs/partition.rb +25 -106
  65. data/lib/getch/filesystem/zfs/void.rb +81 -0
  66. data/lib/getch/gentoo.rb +20 -16
  67. data/lib/getch/gentoo/boot.rb +24 -16
  68. data/lib/getch/gentoo/chroot.rb +16 -25
  69. data/lib/getch/gentoo/config.rb +67 -15
  70. data/lib/getch/gentoo/sources.rb +55 -13
  71. data/lib/getch/gentoo/stage.rb +0 -1
  72. data/lib/getch/gentoo/use.rb +43 -0
  73. data/lib/getch/gentoo/use_flag.rb +63 -0
  74. data/lib/getch/guard.rb +64 -0
  75. data/lib/getch/helpers.rb +133 -0
  76. data/lib/getch/log.rb +3 -2
  77. data/lib/getch/options.rb +46 -24
  78. data/lib/getch/version.rb +1 -1
  79. data/lib/getch/void.rb +59 -0
  80. data/lib/getch/void/boot.rb +80 -0
  81. data/lib/getch/void/chroot.rb +55 -0
  82. data/lib/getch/void/config.rb +87 -0
  83. data/lib/getch/void/stage.rb +70 -0
  84. metadata +46 -25
  85. metadata.gz.sig +0 -0
  86. data/.gitignore +0 -2
  87. data/CHANGELOG.md +0 -60
  88. data/Rakefile +0 -21
  89. data/bin/setup.sh +0 -90
  90. data/getch.gemspec +0 -25
data/lib/getch/command.rb CHANGED
@@ -59,7 +59,7 @@ module Getch
59
59
  block.each do |f|
60
60
  begin
61
61
  data = f.read_nonblock(@block_size)
62
- puts data if DEFAULT_OPTIONS[:verbose]
62
+ puts data if OPTIONS[:verbose]
63
63
  rescue EOFError
64
64
  puts ""
65
65
  rescue => e
@@ -127,19 +127,21 @@ module Getch
127
127
  end
128
128
  end
129
129
 
130
- class Garden
130
+ class Bask
131
131
  def initialize(cmd)
132
132
  @gentoo = MOUNTPOINT
133
133
  @cmd = cmd
134
134
  @log = Getch::Log.new
135
+ @version = "0.5"
135
136
  end
136
137
 
137
138
  def run!
138
- @log.info "Running Garden: #{@cmd}"
139
+ download_bask if ! Dir.exist? "#{MOUNTPOINT}/root/bask-#{@version}"
140
+ @log.info "Running Bask: #{@cmd}"
139
141
  cmd = "chroot #{@gentoo} /bin/bash -c \"source /etc/profile \
140
142
  && env-update \
141
- && cd /root/garden-master \
142
- && ./kernel.sh #{@cmd} -k /usr/src/linux\""
143
+ && cd /root/bask-#{@version} \
144
+ && ./bask.sh #{@cmd} -k /usr/src/linux\""
143
145
  Open3.popen2e(cmd) do |stdin, stdout_err, wait_thr|
144
146
  while line = stdout_err.gets
145
147
  puts line
@@ -152,6 +154,18 @@ module Getch
152
154
  end
153
155
  end
154
156
  end
157
+
158
+ private
159
+
160
+ def download_bask
161
+ @log.info "Installing Bask..."
162
+ url = "https://github.com/szorfein/bask/archive/v#{@version}.tar.gz"
163
+ file = "bask-#{@version}.tar.gz"
164
+
165
+ Dir.chdir("#{MOUNTPOINT}/root")
166
+ Helpers::get_file_online(url, file)
167
+ Getch::Command.new("tar xzf #{file}").run!
168
+ end
155
169
  end
156
170
 
157
171
  class Chroot < Command
@@ -0,0 +1,42 @@
1
+ require_relative 'config/gentoo'
2
+ require_relative 'config/void'
3
+
4
+ CONFIG_LOAD = {
5
+ gentoo: Getch::Config::Gentoo,
6
+ void: Getch::Config::Void
7
+ }.freeze
8
+
9
+ module Getch
10
+ module Config
11
+ class Main
12
+ def initialize
13
+ os = OPTIONS[:os].to_sym
14
+ @load = CONFIG_LOAD[os].new
15
+ end
16
+
17
+ def ethernet
18
+ @load.ethernet
19
+ end
20
+
21
+ def dns
22
+ @load.dns
23
+ end
24
+
25
+ def wifi
26
+ @load.wifi
27
+ end
28
+
29
+ def sysctl
30
+ pwd = File.expand_path(File.dirname(__FILE__))
31
+ dest = "#{Getch::MOUNTPOINT}/etc/sysctl.d/"
32
+
33
+ Helpers::mkdir dest
34
+ Helpers::cp("#{pwd}/../../assets/network-stack.conf", dest)
35
+ end
36
+
37
+ def shell
38
+ @load.shell
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,59 @@
1
+ module Getch
2
+ module Config
3
+ class Gentoo
4
+ def initialize
5
+ @systemd_net_dir = "#{MOUNTPOINT}/etc/systemd"
6
+ end
7
+
8
+ def ethernet
9
+ conf = "#{@systemd_net_dir}/network/20-ethernet.network"
10
+ datas = [
11
+ "[Match]",
12
+ "Name=en*",
13
+ "Name=eth*",
14
+ "[Network]",
15
+ "DHCP=yes",
16
+ "IPv6PrivacyExtensions=yes",
17
+ "[DHCP]",
18
+ "RouteMetric=512",
19
+ "",
20
+ ]
21
+ File.write(conf, datas.join("\n"), mode: 'w')
22
+ end
23
+
24
+ def wifi
25
+ conf = "#{@systemd_net_dir}/network/20-wireless.network"
26
+ datas = [
27
+ "[Match]",
28
+ "Name=wlp*",
29
+ "Name=wlan*",
30
+ "[Network]",
31
+ "DHCP=yes",
32
+ "IPv6PrivacyExtensions=yes",
33
+ "[DHCP]",
34
+ "RouteMetric=1024",
35
+ "",
36
+ ]
37
+ File.write(conf, datas.join("\n"), mode: 'w')
38
+ end
39
+
40
+ def dns
41
+ conf = "#{@systemd_net_dir}/resolved.conf.d/dns_over_tls.conf"
42
+ datas = [
43
+ "[Resolve]",
44
+ "DNS=9.9.9.9#dns.quad9.net",
45
+ "DNSOverTLS=yes",
46
+ "",
47
+ ]
48
+ Helpers::create_dir("#{@systemd_net_dir}/resolved.conf.d")
49
+ File.write(conf, datas.join("\n"), mode: 'w')
50
+
51
+ Getch::Chroot.new('systemctl enable systemd-networkd').run!
52
+ Getch::Chroot.new('systemctl enable systemd-resolved').run!
53
+ end
54
+
55
+ def shell
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,49 @@
1
+ require_relative '../helpers'
2
+
3
+ module Getch
4
+ module Config
5
+ class Void
6
+ include Helpers::Void
7
+
8
+ def initialize
9
+ @service_dir = "/etc/runit/runsvdir/default/"
10
+ end
11
+
12
+ # Enable dhcpcd service
13
+ def ethernet
14
+ command "ln -fs /etc/sv/dhcpcd #{@service_dir}"
15
+ end
16
+
17
+ # with Quad9
18
+ # https://www.dnsknowledge.com/tutorials/how-to-setup-quad9-dns-on-a-linux/
19
+ def dns
20
+ conf = "#{MOUNTPOINT}/etc/resolv.conf"
21
+ content = [
22
+ "nameserver 9.9.9.9",
23
+ "nameserver 2620:fe::fe",
24
+ "options rotate",
25
+ "",
26
+ ]
27
+ File.write(conf, content.join("\n"), mode: 'w', chmod: 0644)
28
+ end
29
+
30
+ # https://docs.voidlinux.org/config/network/iwd.html
31
+ def wifi
32
+ conf = "#{MOUNTPOINT}/etc/iwd/main.conf"
33
+ content = [
34
+ "[General]",
35
+ "UseDefaultInterface=true",
36
+ "",
37
+ ]
38
+ File.write(conf, content.join("\n"), mode: 'a', chmod: 0644)
39
+ # Enabling dbus and iwd
40
+ command "ln -fs /etc/sv/dbus #{@service_dir}"
41
+ command "ln -fs /etc/sv/iwd #{@service_dir}"
42
+ end
43
+
44
+ def shell
45
+ command "chsh -s /bin/bash"
46
+ end
47
+ end
48
+ end
49
+ end
@@ -3,6 +3,11 @@ module Getch
3
3
  end
4
4
  end
5
5
 
6
+ require_relative 'filesystem/device'
7
+ require_relative 'filesystem/clean'
8
+ require_relative 'filesystem/partition'
9
+ require_relative 'filesystem/mount'
10
+
6
11
  require_relative 'filesystem/ext4'
7
12
  require_relative 'filesystem/lvm'
8
13
  require_relative 'filesystem/zfs'
Binary file
@@ -0,0 +1,58 @@
1
+ module Getch
2
+ module FileSystem
3
+ module Clean
4
+ def self.clean_hdd(disk)
5
+ return if ! disk
6
+ raise ArgumentError, "Disk #{disk} is no found." if ! File.exist? "/dev/#{disk}"
7
+ puts
8
+ print "Cleaning data on #{disk}, can be long, avoid this on Flash Memory (SSD,USB,...) ? [y,N] "
9
+ case gets.chomp
10
+ when /^y|^Y/
11
+ bloc=`blockdev --getbsz /dev/#{disk}`.chomp
12
+ Helpers::sys("dd if=/dev/urandom of=/dev/#{disk} bs=#{bloc} status=progress")
13
+ else
14
+ return
15
+ end
16
+ end
17
+
18
+ def self.clean_struct(disk)
19
+ return if ! disk
20
+ raise ArgumentError, "Disk #{disk} is no found." if ! File.exist? "/dev/#{disk}"
21
+ Helpers::sys("sgdisk -Z /dev/#{disk}")
22
+ Helpers::sys("wipefs -a /dev/#{disk}")
23
+ end
24
+
25
+ def self.hdd(*disks)
26
+ disks.each { |d|
27
+ clean_struct(d)
28
+ clean_hdd(d)
29
+ }
30
+ end
31
+ # See https://wiki.archlinux.org/index.php/Solid_state_drive/Memory_cell_clearing
32
+ # for SSD
33
+ def self.sdd
34
+ end
35
+
36
+ def self.external_disk(root_disk, *disks)
37
+ disks.each { |d|
38
+ unless d && d != "" && d != nil && d == root_disk
39
+ hdd(d)
40
+ end
41
+ }
42
+ end
43
+
44
+ def self.old_vg(disk, vg)
45
+ oldvg = `vgdisplay | grep #{vg}`.chomp
46
+ Helpers::sys("vgremove -f #{vg}") if oldvg != ''
47
+ Helpers::sys("pvremove -f #{disk}") if oldvg != '' and File.exist? disk
48
+ end
49
+
50
+ def self.old_zpool
51
+ oldzpool = `zpool status | grep pool:`.gsub(/pool: /, '').delete(' ').split("\n")
52
+ if oldzpool[0] != "" and $?.success?
53
+ oldzpool.each { |p| Helpers::sys("zpool destroy #{p}") if p }
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,61 @@
1
+ module Getch
2
+ module FileSystem
3
+ class Device
4
+ def initialize
5
+ @efi = Helpers::efi?
6
+ @root_part = 1
7
+ @user = Getch::OPTIONS[:username]
8
+
9
+ @disk = Getch::OPTIONS[:disk]
10
+ @boot_disk = Getch::OPTIONS[:boot_disk]
11
+ @cache_disk = Getch::OPTIONS[:cache_disk]
12
+ @home_disk = Getch::OPTIONS[:home_disk]
13
+
14
+ search_boot
15
+ search_swap
16
+ search_root
17
+ search_home
18
+ end
19
+
20
+ private
21
+ def search_boot
22
+ if @efi
23
+ if @boot_disk
24
+ @dev_esp = "/dev/#{@boot_disk}#{@root_part}"
25
+ else
26
+ @dev_esp = "/dev/#{@disk}#{@root_part}"
27
+ @root_part += 1
28
+ end
29
+ else
30
+ if @boot_disk
31
+ @dev_gpt = "/dev/#{@boot_disk}#{@root_part}"
32
+ @dev_grub = "/dev/#{@boot_disk}"
33
+ else
34
+ @dev_gpt = "/dev/#{@disk}#{@root_part}"
35
+ @dev_grub = "/dev/#{@disk}"
36
+ @root_part += 1
37
+ end
38
+ end
39
+ end
40
+
41
+ def search_swap
42
+ if @cache_disk
43
+ @dev_swap = "/dev/#{@cache_disk}1"
44
+ else
45
+ @dev_swap = "/dev/#{@disk}#{@root_part}"
46
+ @root_part += 1
47
+ end
48
+ end
49
+
50
+ def search_root
51
+ @dev_root = "/dev/#{@disk}#{@root_part}"
52
+ end
53
+
54
+ def search_home
55
+ if @home_disk
56
+ @dev_home = "/dev/#{@home_disk}1"
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -11,4 +11,5 @@ require_relative 'ext4/format'
11
11
  require_relative 'ext4/mount'
12
12
  require_relative 'ext4/config'
13
13
  require_relative 'ext4/deps'
14
+ require_relative 'ext4/void'
14
15
  require_relative 'ext4/encrypt'
@@ -17,7 +17,7 @@ module Getch
17
17
 
18
18
  def systemd_boot
19
19
  return if ! Helpers::efi?
20
- esp = '/boot/efi'
20
+ esp = '/efi'
21
21
  dir = "#{@root_dir}/#{esp}/loader/entries/"
22
22
  datas_gentoo = [
23
23
  'title Gentoo Linux',
@@ -30,28 +30,27 @@ module Getch
30
30
  def grub
31
31
  return if Helpers::efi?
32
32
  file = "#{@root_dir}/etc/default/grub"
33
- cmdline = "GRUB_CMDLINE_LINUX=\"resume=#{@dev_swap} root=#{@dev_root} init=#{@init} rw slub_debug=P page_poison=1 slab_nomerge pti=on vsyscall=none spectre_v2=on spec_store_bypass_disable=seccomp iommu=force\"\n"
33
+ cmdline = "GRUB_CMDLINE_LINUX=\"resume=PARTUUID=#{@partuuid_swap} root=PARTUUID=#{@partuuid_root} init=#{@init} rw slub_debug=P page_poison=1 slab_nomerge pti=on vsyscall=none spectre_v2=on spec_store_bypass_disable=seccomp iommu=force\"\n"
34
34
  File.write(file, cmdline, mode: 'a')
35
35
  end
36
36
 
37
37
  private
38
38
 
39
39
  def gen_uuid
40
- @partuuid_root = `lsblk -o "PARTUUID" #{@dev_root} | tail -1`.chomp() if @dev_root
41
- @uuid_swap = `lsblk -o "UUID" #{@dev_swap} | tail -1`.chomp() if @dev_swap
40
+ @partuuid_root = Helpers::partuuid(@dev_root)
41
+ @partuuid_swap = Helpers::partuuid(@dev_swap)
42
42
  @uuid_root = `lsblk -o "UUID" #{@dev_root} | tail -1`.chomp() if @dev_root
43
- @uuid_boot = `lsblk -o "UUID" #{@dev_boot} | tail -1`.chomp() if @dev_boot
44
- @uuid_boot_efi = `lsblk -o "UUID" #{@dev_boot_efi} | tail -1`.chomp() if @dev_boot_efi
43
+ @uuid_esp = `lsblk -o "UUID" #{@dev_esp} | tail -1`.chomp() if @dev_esp
45
44
  @uuid_home = `lsblk -o "UUID" #{@dev_home} | tail -1`.chomp() if @dev_home
46
45
  end
47
46
 
48
47
  def data_fstab
49
- boot_efi = @dev_boot_efi ? "UUID=#{@uuid_boot_efi} /boot/efi vfat noauto,noatime 1 2" : ''
50
- swap = @dev_swap ? "UUID=#{@uuid_swap} none swap discard 0 0" : ''
48
+ esp = @dev_esp ? "UUID=#{@uuid_esp} /efi vfat noauto,noatime 1 2" : ''
49
+ swap = @dev_swap ? "PARTUUID=#{@partuuid_swap} none swap discard 0 0" : ''
51
50
  root = @dev_root ? "UUID=#{@uuid_root} / ext4 defaults 0 1" : ''
52
51
  home = @dev_home ? "UUID=#{@uuid_home} /home/#{@user} ext4 defaults 0 2" : ''
53
52
 
54
- [ boot_efi, swap, root, home ]
53
+ [ esp, swap, root, home ]
55
54
  end
56
55
  end
57
56
  end
@@ -1,14 +1,9 @@
1
1
  module Getch
2
2
  module FileSystem
3
3
  module Ext4
4
- class Device
4
+ class Device < Getch::FileSystem::Device
5
5
  def initialize
6
- @disk = DEFAULT_OPTIONS[:disk]
7
- @user = DEFAULT_OPTIONS[:username]
8
- @dev_boot_efi = Helpers::efi? ? "/dev/#{@disk}1" : nil
9
- @dev_root = "/dev/#{@disk}2"
10
- @dev_swap = "/dev/#{@disk}3"
11
- @dev_home = @user ? "/dev/#{@disk}4" : nil
6
+ super
12
7
  end
13
8
  end
14
9
  end
@@ -13,3 +13,4 @@ require_relative 'encrypt/format'
13
13
  require_relative 'encrypt/mount'
14
14
  require_relative 'encrypt/config'
15
15
  require_relative 'encrypt/deps'
16
+ require_relative 'encrypt/void'
@@ -22,21 +22,21 @@ module Getch
22
22
 
23
23
  def systemd_boot
24
24
  return if ! Helpers::efi?
25
- esp = '/boot/efi'
25
+ esp = '/efi'
26
26
  dir = "#{@root_dir}/#{esp}/loader/entries/"
27
27
  datas_gentoo = [
28
28
  'title Gentoo Linux',
29
29
  'linux /vmlinuz',
30
30
  'initrd /initramfs',
31
- "options crypt_root=UUID=#{@uuid_root} root=/dev/mapper/root init=#{@init} keymap=#{DEFAULT_OPTIONS[:keymap]} rw"
31
+ "options crypt_root=UUID=#{@uuid_dev_root} root=/dev/mapper/root init=#{@init} keymap=#{Getch::OPTIONS[:keymap]} rw"
32
32
  ]
33
33
  File.write("#{dir}/gentoo.conf", datas_gentoo.join("\n"))
34
34
  end
35
35
 
36
36
  def crypttab
37
- home = @dev_home ? "crypthome UUID=#{@uuid_home} /root/secretkeys/crypto_keyfile.bin luks" : ''
37
+ home = @home_disk ? "crypthome UUID=#{@uuid_home} /root/secretkeys/crypto_keyfile.bin luks" : ''
38
38
  datas = [
39
- "cryptswap UUID=#{@uuid_swap} /dev/urandom swap,cipher=aes-xts-plain64:sha256,size=256",
39
+ "cryptswap PARTUUID=#{@partuuid_swap} /dev/urandom swap,cipher=aes-xts-plain64:sha256,size=512",
40
40
  home
41
41
  ]
42
42
  File.write("#{@root_dir}/etc/crypttab", datas.join("\n"))
@@ -46,7 +46,7 @@ module Getch
46
46
  return if Helpers::efi?
47
47
  file = "#{@root_dir}/etc/default/grub"
48
48
  cmdline = [
49
- "GRUB_CMDLINE_LINUX=\"crypt_root=UUID=#{@uuid_dev_root} init=#{@init} rw slub_debug=P page_poison=1 slab_nomerge pti=on vsyscall=none spectre_v2=on spec_store_bypass_disable=seccomp iommu=force keymap=#{DEFAULT_OPTIONS[:keymap]}\"",
49
+ "GRUB_CMDLINE_LINUX=\"crypt_root=UUID=#{@uuid_dev_root} root=/dev/mapper/root init=#{@init} rw slub_debug=P page_poison=1 slab_nomerge pti=on vsyscall=none spectre_v2=on spec_store_bypass_disable=seccomp iommu=force keymap=#{Getch::OPTIONS[:keymap]}\"",
50
50
  "GRUB_ENABLE_CRYPTODISK=y"
51
51
  ]
52
52
  File.write(file, cmdline.join("\n"), mode: 'a')
@@ -55,16 +55,15 @@ module Getch
55
55
  private
56
56
 
57
57
  def gen_uuid
58
- @partuuid_root = `lsblk -o "PARTUUID" #{@dev_root} | tail -1`.chomp() if @dev_root
59
- @uuid_swap = `lsblk -o "UUID" #{@dev_swap} | tail -1`.chomp() if @dev_swap
58
+ @partuuid_swap = Helpers::partuuid(@dev_swap)
60
59
  @uuid_dev_root = `lsblk -d -o "UUID" #{@dev_root} | tail -1`.chomp() if @dev_root
61
- @uuid_boot_efi = `lsblk -o "UUID" #{@dev_boot_efi} | tail -1`.chomp() if @dev_boot_efi
60
+ @uuid_esp = Helpers::uuid(@dev_esp) if @dev_esp
62
61
  @uuid_root = `lsblk -d -o "UUID" #{@luks_root} | tail -1`.chomp() if @dev_root
63
62
  @uuid_home = `lsblk -d -o "UUID" #{@dev_home} | tail -1`.chomp() if @luks_home
64
63
  end
65
64
 
66
65
  def data_fstab
67
- boot_efi = @dev_boot_efi ? "UUID=#{@uuid_boot_efi} /boot/efi vfat noauto,noatime 1 2" : ''
66
+ boot_efi = @dev_esp ? "UUID=#{@uuid_esp} /efi vfat noauto,noatime 1 2" : ''
68
67
  swap = @dev_swap ? "#{@luks_swap} none swap discard 0 0 " : ''
69
68
  root = @dev_root ? "UUID=#{@uuid_root} / ext4 defaults 0 1" : ''
70
69
  home = @dev_home ? "#{@luks_home} /home/#{@user} ext4 defaults 0 2" : ''