getch 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) 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 +64 -24
  5. data/assets/network-stack.conf +63 -0
  6. data/bin/getch +12 -4
  7. data/lib/getch.rb +113 -78
  8. data/lib/getch/command.rb +1 -1
  9. data/lib/getch/config.rb +33 -49
  10. data/lib/getch/config/gentoo.rb +59 -0
  11. data/lib/getch/config/void.rb +49 -0
  12. data/lib/getch/filesystem/.mount.rb.swp +0 -0
  13. data/lib/getch/filesystem/device.rb +5 -5
  14. data/lib/getch/filesystem/ext4.rb +1 -0
  15. data/lib/getch/filesystem/ext4/encrypt.rb +1 -0
  16. data/lib/getch/filesystem/ext4/encrypt/config.rb +2 -2
  17. data/lib/getch/filesystem/ext4/encrypt/format.rb +0 -1
  18. data/lib/getch/filesystem/ext4/encrypt/mount.rb +0 -1
  19. data/lib/getch/filesystem/ext4/encrypt/partition.rb +10 -16
  20. data/lib/getch/filesystem/ext4/encrypt/void.rb +100 -0
  21. data/lib/getch/filesystem/ext4/format.rb +1 -1
  22. data/lib/getch/filesystem/ext4/void.rb +43 -0
  23. data/lib/getch/filesystem/lvm.rb +1 -0
  24. data/lib/getch/filesystem/lvm/encrypt.rb +1 -0
  25. data/lib/getch/filesystem/lvm/encrypt/config.rb +2 -2
  26. data/lib/getch/filesystem/lvm/encrypt/format.rb +1 -2
  27. data/lib/getch/filesystem/lvm/encrypt/mount.rb +1 -2
  28. data/lib/getch/filesystem/lvm/encrypt/partition.rb +10 -7
  29. data/lib/getch/filesystem/lvm/encrypt/void.rb +100 -0
  30. data/lib/getch/filesystem/lvm/format.rb +1 -1
  31. data/lib/getch/filesystem/lvm/void.rb +45 -0
  32. data/lib/getch/filesystem/partition.rb +4 -4
  33. data/lib/getch/filesystem/zfs.rb +1 -0
  34. data/lib/getch/filesystem/zfs/config.rb +3 -3
  35. data/lib/getch/filesystem/zfs/deps.rb +11 -4
  36. data/lib/getch/filesystem/zfs/device.rb +6 -0
  37. data/lib/getch/filesystem/zfs/encrypt.rb +1 -0
  38. data/lib/getch/filesystem/zfs/encrypt/.mount.rb.swp +0 -0
  39. data/lib/getch/filesystem/zfs/encrypt/config.rb +5 -5
  40. data/lib/getch/filesystem/zfs/encrypt/deps.rb +11 -4
  41. data/lib/getch/filesystem/zfs/encrypt/device.rb +6 -0
  42. data/lib/getch/filesystem/zfs/encrypt/format.rb +9 -10
  43. data/lib/getch/filesystem/zfs/encrypt/mount.rb +5 -9
  44. data/lib/getch/filesystem/zfs/encrypt/partition.rb +3 -1
  45. data/lib/getch/filesystem/zfs/encrypt/void.rb +96 -0
  46. data/lib/getch/filesystem/zfs/format.rb +9 -9
  47. data/lib/getch/filesystem/zfs/mount.rb +5 -8
  48. data/lib/getch/filesystem/zfs/partition.rb +2 -1
  49. data/lib/getch/filesystem/zfs/void.rb +81 -0
  50. data/lib/getch/gentoo.rb +12 -15
  51. data/lib/getch/gentoo/boot.rb +7 -4
  52. data/lib/getch/gentoo/config.rb +8 -8
  53. data/lib/getch/gentoo/sources.rb +6 -3
  54. data/lib/getch/gentoo/stage.rb +0 -1
  55. data/lib/getch/gentoo/use_flag.rb +6 -7
  56. data/lib/getch/guard.rb +3 -1
  57. data/lib/getch/helpers.rb +107 -1
  58. data/lib/getch/log.rb +3 -2
  59. data/lib/getch/options.rb +41 -34
  60. data/lib/getch/version.rb +1 -1
  61. data/lib/getch/void.rb +59 -0
  62. data/lib/getch/void/boot.rb +80 -0
  63. data/lib/getch/void/chroot.rb +55 -0
  64. data/lib/getch/void/config.rb +87 -0
  65. data/lib/getch/void/stage.rb +70 -0
  66. metadata +22 -9
  67. metadata.gz.sig +0 -0
  68. data/.gitignore +0 -2
  69. data/CHANGELOG.md +0 -99
  70. data/Rakefile +0 -21
  71. data/bin/setup.sh +0 -90
  72. data/getch.gemspec +0 -25
@@ -0,0 +1,43 @@
1
+ require_relative '../../helpers'
2
+
3
+ module Getch
4
+ module FileSystem
5
+ module Ext4
6
+ class Void < Device
7
+ include Helpers::Void
8
+ attr_reader :boot_disk
9
+
10
+ def fstab
11
+ conf = "#{MOUNTPOINT}/etc/fstab"
12
+ File.write(conf, "\n", mode: 'w', chmod: 0644)
13
+ line_fstab(@dev_esp, "/efi vfat noauto,rw,relatime 0 0") if @dev_esp
14
+ line_fstab(@dev_swap, "swap swap rw,noatime,discard 0 0") if @dev_swap
15
+ line_fstab(@dev_root, "/ ext4 rw,relatime 0 1")
16
+ add_line(conf, "tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0")
17
+ end
18
+
19
+ def config_dracut
20
+ conf = "#{MOUNTPOINT}/etc/dracut.conf.d/ext4.conf"
21
+ # dracut: value+= should be surrounding by white space
22
+ content = [
23
+ "hostonly=\"yes\"",
24
+ "omit_dracutmodules+=\" btrfs lvm \"",
25
+ ""
26
+ ]
27
+ File.write(conf, content.join("\n"), mode: 'w', chmod: 0644)
28
+ end
29
+
30
+ def kernel_cmdline_dracut
31
+ conf = "#{MOUNTPOINT}/etc/dracut.conf.d/cmdline.conf"
32
+ c="kernel_cmdline=\"root=#{@dev_root} rootfstype=ext4 rootflags=rw,relatime\""
33
+ File.write(conf, "#{c}\n", mode: 'w', chmod: 0644)
34
+ end
35
+
36
+ def finish
37
+ puts "+ Enter in your system: chroot /mnt /bin/bash"
38
+ puts "+ Reboot with: shutdown -r now"
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -11,4 +11,5 @@ require_relative 'lvm/format'
11
11
  require_relative 'lvm/mount'
12
12
  require_relative 'lvm/config'
13
13
  require_relative 'lvm/deps'
14
+ require_relative 'lvm/void'
14
15
  require_relative 'lvm/encrypt'
@@ -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'
@@ -25,7 +25,7 @@ module Getch
25
25
  'title Gentoo Linux',
26
26
  'linux /vmlinuz',
27
27
  'initrd /initramfs',
28
- "options crypt_root=UUID=#{@uuid_dev_root} root=/dev/mapper/root real_root=#{@lv_root} init=#{@init} keymap=#{DEFAULT_OPTIONS[:keymap]} dolvm rw"
28
+ "options crypt_root=UUID=#{@uuid_dev_root} root=/dev/mapper/root real_root=#{@lv_root} init=#{@init} keymap=#{Getch::OPTIONS[:keymap]} dolvm rw"
29
29
  ]
30
30
  File.write("#{dir}/gentoo.conf", datas_gentoo.join("\n"))
31
31
  end
@@ -41,7 +41,7 @@ module Getch
41
41
  return if Helpers::efi?
42
42
  file = "#{@root_dir}/etc/default/grub"
43
43
  cmdline = [
44
- "GRUB_CMDLINE_LINUX=\"crypt_root=UUID=#{@uuid_dev_root} root=/dev/mapper/root real_root=#{@lv_root} init=#{@init} dolvm 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]}\"",
44
+ "GRUB_CMDLINE_LINUX=\"crypt_root=UUID=#{@uuid_dev_root} root=/dev/mapper/root real_root=#{@lv_root} init=#{@init} dolvm 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]}\"",
45
45
  "GRUB_ENABLE_CRYPTODISK=y"
46
46
  ]
47
47
  File.write("#{file}", cmdline.join("\n"), mode: 'a')
@@ -2,7 +2,7 @@ module Getch
2
2
  module FileSystem
3
3
  module Lvm
4
4
  module Encrypt
5
- class Format < Getch::FileSystem::Lvm::Encrypt::Device
5
+ class Format < Device
6
6
  def initialize
7
7
  super
8
8
  @fs = 'ext4'
@@ -15,7 +15,6 @@ module Getch
15
15
  puts "Format #{@disk}"
16
16
  exec("mkfs.fat -F32 #{@dev_esp}") if @dev_esp
17
17
  exec("mkfs.#{@fs} -F #{@dev_boot}") if @dev_boot
18
- exec("mkswap -f #{@lv_swap}")
19
18
  exec("mkfs.#{@fs} -F #{@lv_root}")
20
19
  exec("mkfs.#{@fs} -F #{@lv_home}") if @lv_home
21
20
  @state.format
@@ -2,7 +2,7 @@ module Getch
2
2
  module FileSystem
3
3
  module Lvm
4
4
  module Encrypt
5
- class Mount < Getch::FileSystem::Lvm::Encrypt::Device
5
+ class Mount < Device
6
6
  def initialize
7
7
  super
8
8
  @mount = Getch::FileSystem::Mount.new
@@ -11,7 +11,6 @@ module Getch
11
11
 
12
12
  def run
13
13
  return if STATES[:mount]
14
- @mount.swap(@lv_swap)
15
14
  @mount.root(@lv_root)
16
15
  @mount.boot(@dev_boot)
17
16
  @mount.esp(@dev_esp)
@@ -1,8 +1,12 @@
1
+ require_relative '../../../helpers'
2
+
1
3
  module Getch
2
4
  module FileSystem
3
5
  module Lvm
4
6
  module Encrypt
5
- class Partition < Getch::FileSystem::Lvm::Encrypt::Device
7
+ class Partition < Device
8
+ include Helpers::Cryptsetup
9
+
6
10
  def initialize
7
11
  super
8
12
  @state = Getch::States.new()
@@ -19,7 +23,7 @@ module Getch
19
23
  @clean.external_disk(@disk, @boot_disk, @cache_disk, @home_disk)
20
24
 
21
25
  partition
22
- encrypt
26
+ encrypting
23
27
  lvm
24
28
  @state.partition
25
29
  end
@@ -37,11 +41,10 @@ module Getch
37
41
  end
38
42
  end
39
43
 
40
- def encrypt
41
- @log.info("Format root")
42
- Helpers::sys("cryptsetup luksFormat #{@dev_root}")
43
- @log.debug("Opening root")
44
- Helpers::sys("cryptsetup open --type luks #{@dev_root} cryptroot")
44
+ def encrypting
45
+ @log.info("Cryptsetup")
46
+ encrypt(@dev_root)
47
+ open_crypt(@dev_root, "cryptroot")
45
48
  end
46
49
 
47
50
  def lvm
@@ -0,0 +1,100 @@
1
+ require_relative '../../../helpers'
2
+
3
+ module Getch
4
+ module FileSystem
5
+ module Lvm
6
+ module Encrypt
7
+ class Void < Device
8
+ include Helpers::Void
9
+ attr_reader :boot_disk
10
+
11
+ # Create key to avoid enter password twice
12
+ def create_key
13
+ add_key("volume.key", @dev_root)
14
+ add_key("home.key", @dev_home) if @home_disk
15
+ end
16
+
17
+ # Key need to be added in dracut.conf.d and crypttab
18
+ def add_key(name, dev)
19
+ command "dd bs=1 count=64 if=/dev/urandom of=/boot/#{name}"
20
+ puts " => Creating a key for #{dev}, password required:"
21
+ chroot "cryptsetup luksAddKey #{dev} /boot/#{name}"
22
+ command "chmod 000 /boot/#{name}"
23
+ #command "chmod -R g-rwx,o-rwx /boot"
24
+ end
25
+
26
+ def fstab
27
+ conf = "#{MOUNTPOINT}/etc/fstab"
28
+ File.write(conf, "\n", mode: 'w', chmod: 0644)
29
+ line_fstab(@dev_esp, "/efi vfat noauto,rw,relatime 0 0") if @dev_esp
30
+ line_fstab(@dev_boot, "/boot ext4 noauto,rw,relatime 0 0") if @dev_boot
31
+ add_line(conf, "/dev/mapper/cryptswap none swap sw 0 0")
32
+ add_line(conf, "#{@lv_home} /home ext4 rw,discard 0 0") if @home_disk
33
+ add_line(conf, "#{@lv_root} / ext4 rw,relatime 0 1")
34
+ add_line(conf, "tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0")
35
+ end
36
+
37
+ def crypttab
38
+ conf = "#{MOUNTPOINT}/etc/crypttab"
39
+ File.write(conf, "\n", mode: 'w', chmod: 0644)
40
+ add_line(conf, "cryptswap #{@lv_swap} /dev/urandom swap,discard,cipher=aes-xts-plain64:sha256,size=512")
41
+ line_crypttab(@vg, @dev_root, "/boot/volume.key", "luks")
42
+ line_crypttab("crypthome", @dev_home, "/boot/home.key", "luks") if @home_disk
43
+ end
44
+
45
+ def config_grub
46
+ conf = "#{MOUNTPOINT}/etc/default/grub"
47
+ content = "GRUB_ENABLE_CRYPTODISK=y"
48
+ unless search(conf, content)
49
+ File.write(conf, "#{content}\n", mode: 'a')
50
+ end
51
+ end
52
+
53
+ def config_dracut
54
+ conf = "#{MOUNTPOINT}/etc/dracut.conf.d/lvm.conf"
55
+ content = [
56
+ "hostonly=\"yes\"",
57
+ "omit_dracutmodules+=\" btrfs \"",
58
+ "install_items+=\" /boot/volume.key /etc/crypttab \"",
59
+ ""
60
+ ]
61
+ File.write(conf, content.join("\n"), mode: 'w', chmod: 0644)
62
+ #add_line(conf, "install_items+=\" /boot/home.key \"") if @home_disk
63
+ end
64
+
65
+ def kernel_cmdline_dracut
66
+ conf = "#{MOUNTPOINT}/etc/dracut.conf.d/cmdline.conf"
67
+ root_uuid = b_uuid(@dev_root)
68
+ args = "rd.lvm.vg=#{@vg} rd.luks.uuid=#{root_uuid} rootflags=rw,relatime"
69
+ line = "kernel_cmdline=\"#{args}\""
70
+ File.write(conf, "#{line}\n", mode: 'w', chmod: 0644)
71
+ end
72
+
73
+ def finish
74
+ puts "+ Enter in your system: chroot /mnt /bin/bash"
75
+ puts "+ Reboot with: shutdown -r now"
76
+ end
77
+
78
+ private
79
+
80
+ def b_uuid(dev)
81
+ device = dev.delete_prefix("/dev/")
82
+ Dir.glob("/dev/disk/by-uuid/*").each { |f|
83
+ link = File.readlink(f)
84
+ return f.delete_prefix("/dev/disk/by-uuid/") if link.match(/#{device}$/)
85
+ }
86
+ end
87
+
88
+ # line_crypttab("cryptswap", "sda2", "/dev/urandom", "luks")
89
+ def line_crypttab(mapname, dev, point, rest)
90
+ conf = "#{MOUNTPOINT}/etc/crypttab"
91
+ device = s_uuid(dev)
92
+ raise "No partuuid for #{dev} #{device}" if !device
93
+ raise "Bad partuuid for #{dev} #{device}" if device.kind_of? Array
94
+ add_line(conf, "#{mapname} PARTUUID=#{device} #{point} #{rest}")
95
+ end
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
@@ -4,7 +4,7 @@ module Getch
4
4
  class Format < Getch::FileSystem::Lvm::Device
5
5
  def initialize
6
6
  super
7
- @state = Getch::States.new()
7
+ @state = Getch::States.new
8
8
  format
9
9
  end
10
10
 
@@ -0,0 +1,45 @@
1
+ require_relative '../../helpers'
2
+
3
+ module Getch
4
+ module FileSystem
5
+ module Lvm
6
+ class Void < Device
7
+ include Helpers::Void
8
+ attr_reader :boot_disk
9
+
10
+ def fstab
11
+ conf = "#{MOUNTPOINT}/etc/fstab"
12
+ File.write(conf, "\n", mode: 'w', chmod: 0644)
13
+ line_fstab(@dev_esp, "/efi vfat noauto,rw,relatime 0 0") if @dev_esp
14
+ line_fstab(@dev_boot, "/boot ext4 noauto,rw,relatime 0 0") if @dev_boot
15
+ add_line(conf, "#{@lv_swap} swap swap rw,noatime,discard 0 0") if @lv_swap
16
+ add_line(conf, "#{@lv_home} /home/#{@user} ext4 rw,noatime,discard 0 2") if @lv_home
17
+ add_line(conf, "#{@lv_root} / ext4 rw,relatime 0 1")
18
+ add_line(conf, "tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0")
19
+ end
20
+
21
+ def config_dracut
22
+ conf = "#{MOUNTPOINT}/etc/dracut.conf.d/lvm.conf"
23
+ # dracut: value+= should be surrounding by white space
24
+ content = [
25
+ "hostonly=\"yes\"",
26
+ "omit_dracutmodules+=\" btrfs \"",
27
+ ""
28
+ ]
29
+ File.write(conf, content.join("\n"), mode: 'w', chmod: 0644)
30
+ end
31
+
32
+ def kernel_cmdline_dracut
33
+ conf = "#{MOUNTPOINT}/etc/dracut.conf.d/cmdline.conf"
34
+ c="kernel_cmdline=\"rd.lvm.vg=#{@vg} rootflags=rw,relatime\""
35
+ File.write(conf, "#{c}\n", mode: 'w', chmod: 0644)
36
+ end
37
+
38
+ def finish
39
+ puts "+ Enter in your system: chroot /mnt /bin/bash"
40
+ puts "+ Reboot with: shutdown -r now"
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -16,7 +16,7 @@ module Getch
16
16
  return if ! dev
17
17
  disk = disk_name(dev)
18
18
  part = dev.match(/[0-9]/)
19
- if DEFAULT_OPTIONS[:fs] == "zfs"
19
+ if Getch::OPTIONS[:fs] == "zfs"
20
20
  exec("sgdisk -n#{part}:0:+2G -t#{part}:BE00 #{disk}")
21
21
  else
22
22
  exec("sgdisk -n#{part}:0:+128MiB -t#{part}:8300 #{disk}")
@@ -34,7 +34,7 @@ module Getch
34
34
  return if ! dev
35
35
  disk = disk_name(dev)
36
36
  part = dev.match(/[0-9]/)
37
- if DEFAULT_OPTIONS[:cache_disk]
37
+ if Getch::OPTIONS[:cache_disk]
38
38
  exec("sgdisk -n#{part}:0:0 -t#{part}:8200 #{disk}")
39
39
  else
40
40
  mem=`awk '/MemTotal/ {print $2}' /proc/meminfo`.chomp + 'K'
@@ -53,7 +53,7 @@ module Getch
53
53
  return if ! dev
54
54
  disk = disk_name(dev)
55
55
  part = dev.match(/[0-9]/)
56
- if DEFAULT_OPTIONS[:home_disk]
56
+ if Getch::OPTIONS[:home_disk]
57
57
  exec("sgdisk -n#{part}:0:0 -t#{part}:#{code} #{disk}")
58
58
  end
59
59
  end
@@ -66,7 +66,7 @@ module Getch
66
66
 
67
67
  def exec(cmd)
68
68
  @log.debug "Partition disk with #{cmd}"
69
- if DEFAULT_OPTIONS[:encrypt]
69
+ if Getch::OPTIONS[:encrypt]
70
70
  Helpers::sys(cmd)
71
71
  else
72
72
  Getch::Command.new(cmd).run!
@@ -11,4 +11,5 @@ require_relative 'zfs/format'
11
11
  require_relative 'zfs/mount'
12
12
  require_relative 'zfs/config'
13
13
  require_relative 'zfs/deps'
14
+ require_relative 'zfs/void'
14
15
  require_relative 'zfs/encrypt'
@@ -1,7 +1,7 @@
1
1
  module Getch
2
2
  module FileSystem
3
3
  module Zfs
4
- class Config < Getch::FileSystem::Zfs::Device
4
+ class Config < Device
5
5
  def initialize
6
6
  super
7
7
  gen_uuid
@@ -23,7 +23,7 @@ module Getch
23
23
  'title Gentoo Linux',
24
24
  'linux /vmlinuz',
25
25
  'initrd /initramfs',
26
- "options resume=UUID=#{@uuid_swap} root=ZFS=#{@pool_name}/ROOT/gentoo init=#{@init} dozfs"
26
+ "options resume=UUID=#{@uuid_swap} root=ZFS=#{@pool_name}/ROOT/#{@n} init=#{@init} dozfs"
27
27
  ]
28
28
  File.write("#{dir}/gentoo.conf", datas_gentoo.join("\n"))
29
29
  end
@@ -33,7 +33,7 @@ module Getch
33
33
  return if Helpers::efi?
34
34
  file = "#{@root_dir}/etc/default/grub"
35
35
  cmdline = [
36
- "GRUB_CMDLINE_LINUX=\"resume=UUID=#{@uuid_swap} root=ZFS=#{@pool_name}/ROOT/gentoo init=#{@init} dozfs\""
36
+ "GRUB_CMDLINE_LINUX=\"resume=UUID=#{@uuid_swap} root=ZFS=#{@pool_name}/ROOT/#{@n} init=#{@init} dozfs\""
37
37
  ]
38
38
  File.write("#{file}", cmdline.join("\n"), mode: 'a')
39
39
  end
@@ -1,7 +1,7 @@
1
1
  module Getch
2
2
  module FileSystem
3
3
  module Zfs
4
- class Deps < Getch::FileSystem::Zfs::Device
4
+ class Deps < Device
5
5
  def make
6
6
  unstable_zfs
7
7
  install_deps
@@ -10,6 +10,7 @@ module Getch
10
10
  hostid
11
11
  options_make
12
12
  Getch::Make.new("genkernel --kernel-config=/usr/src/linux/.config all").run!
13
+ zed_update_path
13
14
  end
14
15
 
15
16
  private
@@ -37,11 +38,18 @@ module Getch
37
38
  Helpers::touch("#{MOUNTPOINT}/etc/zfs/zfs-list.cache/#{@pool_name}")
38
39
  exec("ln -fs /usr/libexec/zfs/zed.d/history_event-zfs-list-cacher.sh /etc/zfs/zed.d/")
39
40
  exec("systemctl start zfs-zed.service")
40
- Helpers::sys("sed -Ei \"s|/mnt/?|/|\" #{MOUNTPOINT}/etc/zfs/zfs-list.cache/*")
41
41
  exec("systemctl enable zfs-zed.service")
42
42
  exec("systemctl enable zfs.target")
43
43
  end
44
44
 
45
+ def zed_update_path
46
+ Dir.glob("#{MOUNTPOINT}/etc/zfs/zfs-list.cache/*").each { |f|
47
+ if !system("sed", "-Ei", "s|#{MOUNTPOINT}/?|/|", f)
48
+ raise "system exec sed"
49
+ end
50
+ }
51
+ end
52
+
45
53
  def auto_module_rebuild
46
54
  g_dir="#{MOUNTPOINT}/etc/portage/env/sys-kernel"
47
55
  Helpers::mkdir(g_dir)
@@ -64,8 +72,7 @@ EOF
64
72
  end
65
73
 
66
74
  def hostid
67
- hostid_value=`hostid`.chomp
68
- File.write("#{MOUNTPOINT}/etc/hostid", hostid_value, mode: 'w')
75
+ exec "zgenhostid $(hostid)"
69
76
  end
70
77
 
71
78
  def options_make
@@ -8,6 +8,7 @@ module Getch
8
8
  @boot_pool_name = "bpool-#{@id}"
9
9
  @pool_name = "rpool-#{@id}"
10
10
  @zfs_home = @user ? true : false
11
+ @n = Getch::OPTIONS[:os]
11
12
  end
12
13
 
13
14
  private
@@ -16,9 +17,14 @@ module Getch
16
17
  if @efi
17
18
  if @boot_disk
18
19
  @dev_esp = "/dev/#{@boot_disk}1"
20
+ @dev_boot = "/dev/#{@boot_disk}2" if Getch::OPTIONS[:os] == 'void'
19
21
  else
20
22
  @dev_esp = "/dev/#{@disk}1"
21
23
  @root_part += 1
24
+ if Getch::OPTIONS[:os] == 'void'
25
+ @dev_boot = "/dev/#{@disk}#{@root_part}"
26
+ @root_part += 1
27
+ end
22
28
  end
23
29
  else
24
30
  if @boot_disk