getch 0.1.9 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/README.md +35 -29
  4. data/bin/getch +8 -6
  5. data/lib/clean.rb +149 -0
  6. data/lib/cryptsetup.rb +132 -0
  7. data/lib/devs.rb +199 -0
  8. data/lib/dracut/encrypt.rb +36 -0
  9. data/lib/dracut/hybrid.rb +15 -0
  10. data/lib/dracut/lvm.rb +14 -0
  11. data/lib/dracut/minimal.rb +11 -0
  12. data/lib/dracut/root.rb +45 -0
  13. data/lib/dracut/zfs.rb +35 -0
  14. data/lib/dracut.rb +11 -0
  15. data/lib/fstab/encrypt.rb +44 -0
  16. data/lib/fstab/hybrid.rb +34 -0
  17. data/lib/fstab/lvm.rb +25 -0
  18. data/lib/fstab/minimal.rb +6 -0
  19. data/lib/fstab/root.rb +93 -0
  20. data/lib/fstab/zfs.rb +23 -0
  21. data/lib/fstab.rb +11 -0
  22. data/lib/getch/assembly.rb +150 -0
  23. data/lib/getch/command.rb +88 -128
  24. data/lib/getch/config/account.rb +39 -0
  25. data/lib/getch/config/dhcp.rb +104 -0
  26. data/lib/getch/config/grub.rb +42 -0
  27. data/lib/getch/config/iwd.rb +60 -0
  28. data/lib/getch/config/keymap.rb +78 -0
  29. data/lib/getch/config/locale.rb +96 -0
  30. data/lib/getch/config/portage.rb +90 -0
  31. data/lib/getch/config/pre_network.rb +37 -0
  32. data/lib/getch/config/timezone.rb +52 -0
  33. data/lib/getch/config/void.rb +0 -36
  34. data/lib/getch/config.rb +16 -37
  35. data/lib/getch/device.rb +67 -0
  36. data/lib/getch/filesystem/ext4/encrypt/config.rb +9 -71
  37. data/lib/getch/filesystem/ext4/encrypt/deps.rb +15 -25
  38. data/lib/getch/filesystem/ext4/encrypt/device.rb +11 -5
  39. data/lib/getch/filesystem/ext4/encrypt/format.rb +6 -15
  40. data/lib/getch/filesystem/ext4/encrypt/mount.rb +7 -11
  41. data/lib/getch/filesystem/ext4/encrypt/partition.rb +10 -76
  42. data/lib/getch/filesystem/ext4/encrypt/void.rb +0 -38
  43. data/lib/getch/filesystem/ext4/encrypt.rb +2 -1
  44. data/lib/getch/filesystem/ext4/hybrid/config.rb +27 -0
  45. data/lib/getch/filesystem/ext4/hybrid/deps.rb +55 -0
  46. data/lib/getch/filesystem/ext4/hybrid/device.rb +24 -0
  47. data/lib/getch/filesystem/ext4/hybrid/format.rb +23 -0
  48. data/lib/getch/filesystem/ext4/hybrid/mount.rb +21 -0
  49. data/lib/getch/filesystem/ext4/hybrid/partition.rb +27 -0
  50. data/lib/getch/filesystem/{lvm/encrypt → ext4/hybrid}/void.rb +0 -39
  51. data/lib/getch/filesystem/ext4/hybrid.rb +19 -0
  52. data/lib/getch/filesystem/ext4/lvm/config.rb +25 -0
  53. data/lib/getch/filesystem/ext4/lvm/deps.rb +56 -0
  54. data/lib/getch/filesystem/ext4/lvm/device.rb +28 -0
  55. data/lib/getch/filesystem/ext4/lvm/format.rb +21 -0
  56. data/lib/getch/filesystem/ext4/lvm/mount.rb +21 -0
  57. data/lib/getch/filesystem/ext4/lvm/partition.rb +28 -0
  58. data/lib/getch/filesystem/{lvm.rb → ext4/lvm.rb} +6 -4
  59. data/lib/getch/filesystem/ext4/minimal/config.rb +25 -0
  60. data/lib/getch/filesystem/ext4/{device.rb → minimal/deps.rb} +3 -1
  61. data/lib/getch/filesystem/ext4/minimal/device.rb +22 -0
  62. data/lib/getch/filesystem/ext4/minimal/format.rb +23 -0
  63. data/lib/getch/filesystem/ext4/minimal/mount.rb +21 -0
  64. data/lib/getch/filesystem/ext4/minimal/partition.rb +28 -0
  65. data/lib/getch/filesystem/ext4/minimal.rb +19 -0
  66. data/lib/getch/filesystem/ext4.rb +7 -7
  67. data/lib/getch/filesystem/zfs/encrypt/config.rb +10 -39
  68. data/lib/getch/filesystem/zfs/encrypt/deps.rb +4 -55
  69. data/lib/getch/filesystem/zfs/encrypt/device.rb +7 -51
  70. data/lib/getch/filesystem/zfs/encrypt/format.rb +6 -90
  71. data/lib/getch/filesystem/zfs/encrypt/mount.rb +16 -35
  72. data/lib/getch/filesystem/zfs/encrypt/partition.rb +6 -54
  73. data/lib/getch/filesystem/zfs/encrypt.rb +2 -1
  74. data/lib/getch/filesystem/zfs/minimal/config.rb +37 -0
  75. data/lib/getch/filesystem/zfs/minimal/deps.rb +126 -0
  76. data/lib/getch/filesystem/zfs/minimal/device.rb +24 -0
  77. data/lib/getch/filesystem/zfs/minimal/format.rb +23 -0
  78. data/lib/getch/filesystem/zfs/minimal/mount.rb +23 -0
  79. data/lib/getch/filesystem/zfs/minimal/partition.rb +23 -0
  80. data/lib/getch/filesystem/zfs/minimal.rb +19 -0
  81. data/lib/getch/filesystem/zfs.rb +1 -7
  82. data/lib/getch/filesystem.rb +0 -6
  83. data/lib/getch/gentoo/bootloader.rb +23 -44
  84. data/lib/getch/gentoo/finalize.rb +25 -0
  85. data/lib/getch/gentoo/post_config.rb +75 -0
  86. data/lib/getch/gentoo/pre_config.rb +37 -0
  87. data/lib/getch/gentoo/services.rb +18 -0
  88. data/lib/getch/gentoo/sources.rb +39 -33
  89. data/lib/getch/gentoo/tarball.rb +91 -0
  90. data/lib/getch/gentoo/terraform.rb +34 -0
  91. data/lib/getch/gentoo/update.rb +54 -0
  92. data/lib/getch/gentoo/use.rb +9 -6
  93. data/lib/getch/gentoo/use_flag.rb +17 -20
  94. data/lib/getch/gentoo.rb +9 -75
  95. data/lib/getch/guard.rb +2 -2
  96. data/lib/getch/helpers.rb +63 -115
  97. data/lib/getch/log.rb +87 -25
  98. data/lib/getch/options.rb +41 -11
  99. data/lib/getch/states.rb +28 -8
  100. data/lib/getch/tree.rb +56 -0
  101. data/lib/getch/version.rb +1 -1
  102. data/lib/getch/void/bootloader.rb +18 -0
  103. data/lib/getch/void/finalize.rb +31 -0
  104. data/lib/getch/void/post_config.rb +19 -0
  105. data/lib/getch/void/pre_config.rb +18 -0
  106. data/lib/getch/void/services.rb +18 -0
  107. data/lib/getch/void/{stage.rb → tarball.rb} +34 -14
  108. data/lib/getch/void/terraform.rb +28 -0
  109. data/lib/getch/void/update.rb +33 -0
  110. data/lib/getch/void.rb +9 -59
  111. data/lib/getch.rb +58 -90
  112. data/lib/luks.rb +239 -0
  113. data/lib/lvm2.rb +112 -0
  114. data/lib/mkfs/zfs.rb +167 -0
  115. data/lib/mkfs.rb +140 -0
  116. data/lib/mountfs.rb +154 -0
  117. data/lib/nito.rb +131 -0
  118. data/lib/sgdisk.rb +160 -0
  119. data.tar.gz.sig +0 -0
  120. metadata +83 -47
  121. metadata.gz.sig +0 -0
  122. data/lib/getch/config/gentoo.rb +0 -58
  123. data/lib/getch/filesystem/clean.rb +0 -58
  124. data/lib/getch/filesystem/device.rb +0 -63
  125. data/lib/getch/filesystem/ext4/config.rb +0 -62
  126. data/lib/getch/filesystem/ext4/deps.rb +0 -24
  127. data/lib/getch/filesystem/ext4/format.rb +0 -31
  128. data/lib/getch/filesystem/ext4/mount.rb +0 -26
  129. data/lib/getch/filesystem/ext4/partition.rb +0 -55
  130. data/lib/getch/filesystem/ext4/void.rb +0 -44
  131. data/lib/getch/filesystem/lvm/config.rb +0 -44
  132. data/lib/getch/filesystem/lvm/deps.rb +0 -44
  133. data/lib/getch/filesystem/lvm/device.rb +0 -45
  134. data/lib/getch/filesystem/lvm/encrypt/config.rb +0 -74
  135. data/lib/getch/filesystem/lvm/encrypt/deps.rb +0 -49
  136. data/lib/getch/filesystem/lvm/encrypt/device.rb +0 -48
  137. data/lib/getch/filesystem/lvm/encrypt/format.rb +0 -35
  138. data/lib/getch/filesystem/lvm/encrypt/mount.rb +0 -27
  139. data/lib/getch/filesystem/lvm/encrypt/partition.rb +0 -84
  140. data/lib/getch/filesystem/lvm/encrypt.rb +0 -18
  141. data/lib/getch/filesystem/lvm/format.rb +0 -32
  142. data/lib/getch/filesystem/lvm/mount.rb +0 -26
  143. data/lib/getch/filesystem/lvm/partition.rb +0 -72
  144. data/lib/getch/filesystem/lvm/void.rb +0 -46
  145. data/lib/getch/filesystem/mount.rb +0 -63
  146. data/lib/getch/filesystem/partition.rb +0 -85
  147. data/lib/getch/filesystem/zfs/config.rb +0 -43
  148. data/lib/getch/filesystem/zfs/deps.rb +0 -67
  149. data/lib/getch/filesystem/zfs/device.rb +0 -66
  150. data/lib/getch/filesystem/zfs/encrypt/void.rb +0 -97
  151. data/lib/getch/filesystem/zfs/format.rb +0 -117
  152. data/lib/getch/filesystem/zfs/mount.rb +0 -47
  153. data/lib/getch/filesystem/zfs/partition.rb +0 -69
  154. data/lib/getch/filesystem/zfs/void.rb +0 -81
  155. data/lib/getch/gentoo/boot.rb +0 -64
  156. data/lib/getch/gentoo/chroot.rb +0 -75
  157. data/lib/getch/gentoo/config.rb +0 -167
  158. data/lib/getch/gentoo/stage.rb +0 -73
  159. data/lib/getch/void/boot.rb +0 -84
  160. data/lib/getch/void/chroot.rb +0 -56
  161. data/lib/getch/void/config.rb +0 -90
data/lib/dracut/lvm.rb ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dracut
4
+ class Lvm < Root
5
+ def initialize(devs, options)
6
+ super
7
+ @vg = options[:vg_name] ||= 'vg0'
8
+ end
9
+
10
+ def get_line
11
+ "rd.lvm.vg=#{@vg} root=/dev/#{@vg}/root resume=/dev/#{@vg}/swap rootfstype=#{@fs}"
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_litteral: true
2
+
3
+ module Dracut
4
+ class Minimal < Root
5
+ def get_line
6
+ swap = Getch::Helpers.uuid @swap
7
+ root = Getch::Helpers.uuid @root
8
+ "root=UUID=#{root} rootfstype=#{@fs} resume=UUID=#{swap} rootflags=rw,relatime"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_litteral: true
2
+
3
+ require 'nito'
4
+ require_relative '../getch/log'
5
+
6
+ module Dracut
7
+ class Root
8
+ include NiTo
9
+
10
+ def initialize(devs, options)
11
+ @log = Getch::Log.new
12
+ @root = devs[:root] ||= nil
13
+ @swap = devs[:swap] ||= nil
14
+ @fs = options[:fs] ||= 'ext4'
15
+ @mountpoint = options[:mountpoint] ||= '/mnt/getch'
16
+ end
17
+
18
+ def generate
19
+ host_only
20
+ cmdline
21
+ others
22
+ end
23
+
24
+ protected
25
+
26
+ def host_only
27
+ file = "#{@mountpoint}/etc/dracut.conf.d/host.conf"
28
+ echo file, 'hostonly="yes"'
29
+ echo_a file, 'use_fstab="yes"'
30
+ end
31
+
32
+ # man dracut.cmdline(7)
33
+ def cmdline
34
+ file = "#{@mountpoint}/etc/dracut.conf.d/cmdline.conf"
35
+ line = get_line
36
+ echo file, "kernel_cmdline=\"#{line}\""
37
+ end
38
+
39
+ def get_line
40
+ end
41
+
42
+ def others
43
+ end
44
+ end
45
+ end
data/lib/dracut/zfs.rb ADDED
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dracut
4
+ class Zfs < Root
5
+ def initialize(devs, options)
6
+ super
7
+ @zfs = options[:zfs_name] ||= 'pool'
8
+ @encrypt = options[:encrypt]
9
+ @os = options[:os]
10
+ end
11
+
12
+ def others
13
+ file = "#{@mountpoint}/etc/dracut.conf.d/zfs.conf"
14
+ echo file, 'nofsck="yes"'
15
+ echo_a file, 'omit_dracutmodules+=" btrfs "'
16
+ end
17
+
18
+ # See https://wiki.gentoo.org/wiki/ZFS#ZFS_root
19
+ # https://github.com/openzfs/zfs/blob/master/contrib/dracut/README.dracut.markdown
20
+ def get_line
21
+ @encrypt ?
22
+ without :
23
+ with_swap
24
+ end
25
+
26
+ def without
27
+ "root=zfs:r#{@zfs}/ROOT/#{@os} zfs.force=1 zfs.zfs_arc_max=536870912"
28
+ end
29
+
30
+ def with_swap
31
+ swap = Getch::Helpers.uuid @swap
32
+ "resume=UUID=#{swap} root=zfs:r#{@zfs}/ROOT/#{@os} zfs.force=1 zfs.zfs_arc_max=536870912"
33
+ end
34
+ end
35
+ end
data/lib/dracut.rb ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_litteral: true
2
+
3
+ module Dracut
4
+ end
5
+
6
+ require_relative 'dracut/root'
7
+ require_relative 'dracut/minimal'
8
+ require_relative 'dracut/lvm'
9
+ require_relative 'dracut/encrypt'
10
+ require_relative 'dracut/hybrid'
11
+ require_relative 'dracut/zfs'
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Fstab
4
+ class Encrypt < Root
5
+ def initialize(devs, options)
6
+ super
7
+ @luks = options[:luks_name]
8
+ end
9
+
10
+ def write_boot
11
+ @boot || return
12
+
13
+ dm = Getch::Helpers.get_dm "boot-#{@luks}"
14
+ uuid = gen_uuid dm
15
+ line = "UUID=#{uuid} /boot #{@fs} noauto,rw,relatime 0 0"
16
+ echo_a @conf, line
17
+ end
18
+
19
+ def write_swap
20
+ @swap || return
21
+
22
+ line = "/dev/mapper/swap-#{@luks} none swap rw,noatime,discard 0 0"
23
+ echo_a @conf, line
24
+ end
25
+
26
+ def write_root
27
+ @root || return
28
+
29
+ dm = Getch::Helpers.get_dm "root-#{@luks}"
30
+ uuid = gen_uuid dm
31
+ line = "UUID=#{uuid} / #{@fs} rw,relatime 0 1"
32
+ echo_a @conf, line
33
+ end
34
+
35
+ def write_home
36
+ @home || return
37
+
38
+ dm = Getch::Helpers.get_dm "home-#{@luks}"
39
+ uuid = gen_uuid dm
40
+ line = "UUID=#{uuid} /home #{@fs} rw,relatime 0 2"
41
+ echo_a @conf, line
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,34 @@
1
+
2
+ module Fstab
3
+ # Hybrid for Lvm + Encryption
4
+ class Hybrid < Encrypt
5
+ def initialize(devs, options)
6
+ super
7
+ @vg = options[:vg_name] ||= 'vg0'
8
+ @luks = options[:luks_name]
9
+ end
10
+
11
+ # The swap UUID based on the lvm volume /dev/vg/swap
12
+ def write_swap
13
+ # The both use /etc/crypttab
14
+ if Helpers.runit? or Helpers.systemd?
15
+ echo_a @conf, "/dev/mapper/swap-#{@luks} none swap sw 0 0"
16
+ else
17
+ dm = Getch::Helpers.get_dm "#{@vg}-swap"
18
+ uuid = Getch::Helpers.uuid dm
19
+ line = "UUID=#{uuid} none swap sw 0 0"
20
+ echo_a @conf, line
21
+ end
22
+ end
23
+
24
+ def write_root
25
+ line = "/dev/#{@vg}/root / #{@fs} rw,relatime 0 1"
26
+ echo_a @conf, line
27
+ end
28
+
29
+ def write_home
30
+ line = "/dev/#{@vg}/home /home #{@fs} rw,relatime 0 2"
31
+ echo_a @conf, line
32
+ end
33
+ end
34
+ end
data/lib/fstab/lvm.rb ADDED
@@ -0,0 +1,25 @@
1
+ # frozen_string_litteral: true
2
+
3
+ module Fstab
4
+ class Lvm < Root
5
+ def initialize(devs, options)
6
+ super
7
+ @vg = options[:vg_name]
8
+ end
9
+
10
+ def write_swap
11
+ line = "/dev/#{@vg}/swap swap swap rw,noatime,discard 0 0"
12
+ echo_a @conf, line
13
+ end
14
+
15
+ def write_root
16
+ line = "/dev/#{@vg}/root / #{@fs} rw,relatime 0 1"
17
+ echo_a @conf, line
18
+ end
19
+
20
+ def write_home
21
+ line = "/dev/#{@vg}/home /home #{@fs} rw,relatime 0 2"
22
+ echo_a @conf, line
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_litteral: true
2
+
3
+ module Fstab
4
+ class Minimal < Root
5
+ end
6
+ end
data/lib/fstab/root.rb ADDED
@@ -0,0 +1,93 @@
1
+ # frozen_string_litteral: true
2
+
3
+ require 'nito'
4
+ require_relative '../getch/log'
5
+
6
+ module Fstab
7
+ class Root
8
+ include NiTo
9
+
10
+ def initialize(devs, options)
11
+ @log = Getch::Log.new
12
+ @efi = devs[:efi] ||= nil
13
+ @boot = devs[:boot] ||= nil
14
+ @swap = devs[:swap] ||= nil
15
+ @root = devs[:root] ||= nil
16
+ @home = devs[:home] ||= nil
17
+ @fs = options[:fs] ||= 'ext4'
18
+ @mountpoint = options[:mountpoint] ||= '/mnt/getch'
19
+ @conf = "#{@mountpoint}/etc/fstab"
20
+ end
21
+
22
+ def generate
23
+ @log.info 'Generating fstab...'
24
+ write_efi
25
+ write_boot
26
+ write_swap
27
+ write_root
28
+ write_home
29
+ write_tmp
30
+ @log.result_ok
31
+ end
32
+
33
+ protected
34
+
35
+ def write_efi
36
+ @efi || return
37
+
38
+ uuid = gen_uuid @efi
39
+ line = "UUID=#{uuid} /efi vfat noauto,rw,relatime 0 0"
40
+ echo_a @conf, line
41
+ end
42
+
43
+ def write_boot
44
+ @boot || return
45
+
46
+ uuid = gen_uuid @boot
47
+ line = "UUID=#{uuid} /boot #{@fs} noauto,rw,relatime 0 0"
48
+ echo_a @conf, line
49
+ end
50
+
51
+ def write_swap
52
+ @swap || return
53
+
54
+ uuid = gen_uuid @swap
55
+ line = "UUID=#{uuid} swap swap rw,noatime,discard 0 0"
56
+ echo_a @conf, line
57
+ end
58
+
59
+ def write_root
60
+ @root || return
61
+
62
+ uuid = gen_uuid @root
63
+ line = "UUID=#{uuid} / #{@fs} rw,relatime 0 1"
64
+ echo_a @conf, line
65
+ end
66
+
67
+ def write_home
68
+ @home || return
69
+
70
+ uuid = gen_uuid @home
71
+ line = "UUID=#{uuid} /home #{@fs} rw,relatime 0 2"
72
+ echo_a @conf, line
73
+ end
74
+
75
+ def write_tmp
76
+ Getch::Helpers.systemd? && return
77
+
78
+ line = 'tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0'
79
+ echo_a @conf, line
80
+ end
81
+
82
+ private
83
+
84
+ def gen_uuid(dev)
85
+ device = dev.delete_prefix('/dev/')
86
+ Dir.glob('/dev/disk/by-uuid/*').each do |f|
87
+ link = File.readlink(f)
88
+ return f.delete_prefix('/dev/disk/by-uuid/') if link.match(/#{device}$/)
89
+ end
90
+ @log.fatal "No uuid found for #{device}"
91
+ end
92
+ end
93
+ end
data/lib/fstab/zfs.rb ADDED
@@ -0,0 +1,23 @@
1
+ module Fstab
2
+ class Zfs < Root
3
+ def initialize(devs, options)
4
+ super
5
+ @encrypt = options[:encrypt]
6
+ end
7
+
8
+ def generate
9
+ @log.info 'Generating fstab...'
10
+ write_efi
11
+ write_swap
12
+ @log.result_ok
13
+ end
14
+
15
+ def write_swap
16
+ uuid = gen_uuid @swap
17
+ @encrypt ?
18
+ line = "/dev/mapper/swap-luks none swap sw 0 0" :
19
+ line = "UUID=#{uuid} swap swap rw,noatime,discard 0 0"
20
+ echo_a @conf, line
21
+ end
22
+ end
23
+ end
data/lib/fstab.rb ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_litteral: true
2
+
3
+ module Fstab
4
+ end
5
+
6
+ require_relative 'fstab/root'
7
+ require_relative 'fstab/minimal'
8
+ require_relative 'fstab/lvm'
9
+ require_relative 'fstab/encrypt'
10
+ require_relative 'fstab/hybrid'
11
+ require_relative 'fstab/zfs'
@@ -0,0 +1,150 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'clean'
4
+ require 'nito'
5
+ require 'cryptsetup'
6
+
7
+ module Getch
8
+ class Assembly
9
+ include NiTo
10
+
11
+ def initialize
12
+ @os = Tree::Os.new.select
13
+ @fs = Tree::FS.new.select
14
+ @state = Getch::States.new
15
+ Getch::Device.new
16
+ init_devs
17
+ end
18
+
19
+ def init_devs
20
+ DEVS[:root] && return
21
+
22
+ @fs::Device.new
23
+ DEVS[:root] || Log.new.fatal('No root, device prob !')
24
+ end
25
+
26
+ def clean
27
+ return if STATES[:partition]
28
+
29
+ print "\nPartition and format disk #{OPTIONS[:disk]}, this will erase all data, continue? (y,N) "
30
+ case gets.chomp
31
+ when /^y|^Y/
32
+ else
33
+ exit
34
+ end
35
+
36
+ Clean.new(OPTIONS).x
37
+ end
38
+
39
+ def partition
40
+ return if STATES[:partition]
41
+
42
+ @fs::Partition.new
43
+ @state.partition
44
+ end
45
+
46
+ def format
47
+ return if STATES[:format]
48
+
49
+ @fs::Format.new
50
+ @state.format
51
+ end
52
+
53
+ def mount
54
+ return if STATES[:mount]
55
+
56
+ @fs::Mount.new
57
+ @state.mount
58
+ end
59
+
60
+ def tarball
61
+ return if STATES[:tarball]
62
+
63
+ @os::Tarball.new.x
64
+ @state.tarball
65
+ end
66
+
67
+ # pre_config
68
+ # Pre configuration before updates and install packages
69
+ # Can contain config for a repository, CPU compilation flags, etc...
70
+ def pre_config
71
+ return if STATES[:pre_config]
72
+
73
+ @os::PreConfig.new
74
+ @state.pre_config
75
+ end
76
+
77
+ # update
78
+ # Synchronise and Update the new system
79
+ def update
80
+ return if STATES[:update]
81
+
82
+ Helpers.mount_all
83
+ @os::Update.new
84
+ @state.update
85
+ end
86
+
87
+ def post_config
88
+ return if STATES[:post_config]
89
+
90
+ @os::PostConfig.new
91
+ @state.post_config
92
+ end
93
+
94
+ # terraform
95
+ # Install all the required packages
96
+ # Also add services
97
+ def terraform
98
+ return if STATES[:terraform]
99
+
100
+ #@fs::PreDeps.new
101
+ @os::Terraform.new
102
+ @fs::Deps.new
103
+ @state.terraform
104
+ end
105
+
106
+ def services
107
+ return if STATES[:services]
108
+
109
+ @os::Services.new
110
+ @state.services
111
+ end
112
+
113
+ # Luks_keys
114
+ # Install external keys to avoid enter password multiple times
115
+ def luks_keys
116
+ return if not OPTIONS[:encrypt] or OPTIONS[:fs] == 'zfs'
117
+
118
+ return if STATES[:luks_keys]
119
+
120
+ CryptSetup.new(DEVS, OPTIONS).keys
121
+ @state.luks_keys
122
+ end
123
+
124
+ # bootloader
125
+ # Install and configure Grub2 or Systemd-boot with Dracut
126
+ # Adding keys for Luks
127
+ def bootloader
128
+ return if STATES[:bootloader]
129
+
130
+ bootloader = @os::Bootloader.new
131
+ bootloader.dependencies
132
+ @fs::Config.new
133
+ bootloader.install
134
+ @state.bootloader
135
+ end
136
+
137
+ # finalize
138
+ # Password for root, etc
139
+ def finalize
140
+ return if STATES[:finalize]
141
+
142
+ @os::Finalize.new
143
+ puts
144
+ puts '[*!*] Installation finished [*!*]'
145
+ puts
146
+ @fs.end
147
+ @state.finalize
148
+ end
149
+ end
150
+ end