getch 0.0.5 → 0.1.0

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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/CHANGELOG.md +30 -0
  5. data/README.md +31 -6
  6. data/bin/setup.sh +29 -13
  7. data/lib/getch.rb +43 -30
  8. data/lib/getch/command.rb +163 -0
  9. data/lib/getch/filesystem.rb +8 -0
  10. data/lib/getch/filesystem/ext4.rb +14 -0
  11. data/lib/getch/filesystem/ext4/config.rb +59 -0
  12. data/lib/getch/filesystem/ext4/deps.rb +22 -0
  13. data/lib/getch/filesystem/ext4/device.rb +16 -0
  14. data/lib/getch/filesystem/ext4/encrypt.rb +15 -0
  15. data/lib/getch/filesystem/ext4/encrypt/config.rb +85 -0
  16. data/lib/getch/filesystem/ext4/encrypt/deps.rb +59 -0
  17. data/lib/getch/filesystem/ext4/encrypt/device.rb +21 -0
  18. data/lib/getch/filesystem/ext4/encrypt/format.rb +32 -0
  19. data/lib/getch/filesystem/ext4/encrypt/mount.rb +64 -0
  20. data/lib/getch/filesystem/ext4/encrypt/partition.rb +116 -0
  21. data/lib/getch/filesystem/ext4/format.rb +30 -0
  22. data/lib/getch/filesystem/ext4/mount.rb +62 -0
  23. data/lib/getch/filesystem/ext4/partition.rb +75 -0
  24. data/lib/getch/filesystem/lvm.rb +14 -0
  25. data/lib/getch/filesystem/lvm/config.rb +63 -0
  26. data/lib/getch/filesystem/lvm/deps.rb +57 -0
  27. data/lib/getch/filesystem/lvm/device.rb +19 -0
  28. data/lib/getch/filesystem/lvm/encrypt.rb +15 -0
  29. data/lib/getch/filesystem/lvm/encrypt/config.rb +74 -0
  30. data/lib/getch/filesystem/lvm/encrypt/deps.rb +63 -0
  31. data/lib/getch/filesystem/lvm/encrypt/device.rb +22 -0
  32. data/lib/getch/filesystem/lvm/encrypt/format.rb +32 -0
  33. data/lib/getch/filesystem/lvm/encrypt/mount.rb +64 -0
  34. data/lib/getch/filesystem/lvm/encrypt/partition.rb +92 -0
  35. data/lib/getch/filesystem/lvm/format.rb +25 -0
  36. data/lib/getch/filesystem/lvm/mount.rb +62 -0
  37. data/lib/getch/filesystem/lvm/partition.rb +81 -0
  38. data/lib/getch/filesystem/zfs.rb +14 -0
  39. data/lib/getch/filesystem/zfs/config.rb +58 -0
  40. data/lib/getch/filesystem/zfs/deps.rb +90 -0
  41. data/lib/getch/filesystem/zfs/device.rb +19 -0
  42. data/lib/getch/filesystem/zfs/encrypt.rb +15 -0
  43. data/lib/getch/filesystem/zfs/encrypt/config.rb +67 -0
  44. data/lib/getch/filesystem/zfs/encrypt/deps.rb +94 -0
  45. data/lib/getch/filesystem/zfs/encrypt/device.rb +21 -0
  46. data/lib/getch/filesystem/zfs/encrypt/format.rb +22 -0
  47. data/lib/getch/filesystem/zfs/encrypt/mount.rb +67 -0
  48. data/lib/getch/filesystem/zfs/encrypt/partition.rb +151 -0
  49. data/lib/getch/filesystem/zfs/format.rb +20 -0
  50. data/lib/getch/filesystem/zfs/mount.rb +67 -0
  51. data/lib/getch/filesystem/zfs/partition.rb +147 -0
  52. data/lib/getch/gentoo.rb +3 -2
  53. data/lib/getch/gentoo/boot.rb +29 -25
  54. data/lib/getch/gentoo/chroot.rb +18 -14
  55. data/lib/getch/gentoo/config.rb +18 -9
  56. data/lib/getch/gentoo/sources.rb +45 -31
  57. data/lib/getch/gentoo/stage.rb +2 -2
  58. data/lib/getch/helpers.rb +24 -6
  59. data/lib/getch/log.rb +54 -0
  60. data/lib/getch/options.rb +16 -7
  61. data/lib/getch/version.rb +1 -1
  62. metadata +48 -5
  63. metadata.gz.sig +0 -0
  64. data/lib/getch/disk.rb +0 -77
  65. data/lib/getch/mount.rb +0 -73
@@ -3,63 +3,77 @@ module Getch
3
3
  class Sources
4
4
  def initialize
5
5
  @lsmod = `lsmod`.chomp
6
- @linux = '/usr/src/linux'
6
+ @filesystem = Getch.class_fs::Deps.new()
7
7
  end
8
8
 
9
9
  def build_others
10
- install_wifi if ismatch?('iwlwifi')
11
- install_zfs if ismatch?('zfs')
12
- exec("./kernel.sh -b -a virtualbox-guest -k #{@linux}") if ismatch?('vmwgfx')
10
+ virtualbox_guest
11
+ qemu_guest
12
+ install_wifi
13
+ install_audio
13
14
  end
14
15
 
15
16
  def build_kspp
16
17
  puts "Adding KSPP to the kernel source"
17
- exec("./kernel.sh -b -a systemd -k #{@linux}")
18
+ garden("-b -a systemd")
18
19
  end
19
20
 
20
21
  def make
21
- puts "Compiling kernel sources"
22
- only_make
23
- cmd = "cd #{@linux} && make modules_install && make install"
24
- exec_chroot(cmd)
22
+ if DEFAULT_OPTIONS[:fs] == 'lvm' || DEFAULT_OPTIONS[:fs] == 'zfs' || DEFAULT_OPTIONS[:encrypt]
23
+ @filesystem.make
24
+ else
25
+ make_kernel
26
+ end
25
27
  end
26
28
 
27
- def only_make
28
- exec_chroot("cd #{@linux} && make -j$(nproc)")
29
+ def init_config
30
+ Getch::Make.new("make localyesconfig").run!
29
31
  end
30
32
 
31
33
  private
32
34
 
35
+ def make_kernel
36
+ puts "Compiling kernel sources"
37
+ cmd = "make -j$(nproc) && make modules_install && make install"
38
+ Getch::Make.new(cmd).run!
39
+ is_kernel = Dir.glob("#{MOUNTPOINT}/boot/vmlinuz-*")
40
+ raise "No kernel installed, compiling source fail..." if is_kernel == []
41
+ end
42
+
43
+ def virtualbox_guest
44
+ systemd=`systemd-detect-virt`.chomp
45
+ return if ! ismatch?('vmwgfx') || systemd.match(/none/)
46
+ garden("-a virtualbox-guest")
47
+ Getch::Emerge.new("app-emulation/virtualbox-guest-additions").pkg!
48
+ end
49
+
50
+ def qemu_guest
51
+ garden("-a kvm-guest") if ismatch?('virtio')
52
+ garden("-a kvm") if ismatch?('kvm')
53
+ end
54
+
33
55
  def ismatch?(arg)
34
56
  @lsmod.match?(/#{arg}/)
35
57
  end
36
58
 
37
- def exec(cmd)
38
- script = "chroot #{MOUNTPOINT} /bin/bash -c \"
39
- source /etc/profile
40
- cd /root/garden-master
41
- #{cmd}
42
- \""
43
- Helpers::exec_or_die(script)
59
+ def garden(cmd)
60
+ Getch::Garden.new(cmd).run!
44
61
  end
45
62
 
46
- def exec_chroot(cmd)
47
- script = "chroot #{MOUNTPOINT} /bin/bash -c \"
48
- source /etc/profile
49
- #{cmd}
50
- \""
51
- Helpers::exec_or_die(script)
63
+ def install_wifi
64
+ return if ! ismatch?('cfg80211')
65
+ garden("-a wifi")
66
+ wifi_drivers
67
+ Getch::Emerge.new("net-wireless/iw wpa_supplicant net-wireless/iwd").pkg!
52
68
  end
53
69
 
54
- def install_wifi
55
- exec("./kernel.sh -b -a wifi -k #{@linux}")
56
- Helpers::emerge("net-wireless/iw wpa_supplicant", MOUNTPOINT)
70
+ def install_audio
71
+ return if ! ismatch?('snd_pcm')
72
+ garden("-a sound")
57
73
  end
58
74
 
59
- def install_zfs
60
- exec("./kernel.sh -b -a zfs -k #{@linux}")
61
- only_make # a first make is necessary before emerge zfs
62
- Helpers::emerge("zfs", MOUNTPOINT)
75
+ def wifi_drivers
76
+ garden("-a ath9k-driver") if ismatch?('ath9k')
63
77
  end
64
78
  end
65
79
  end
@@ -60,8 +60,8 @@ module Getch
60
60
  # https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Stage
61
61
  def decompress
62
62
  puts "Decompressing archive #{@stage_file}..."
63
- cmd = "tar xpvf #{@stage_file} --xattrs-include='*.*' --numeric-owner"
64
- Helpers::exec_or_die(cmd)
63
+ cmd = "tar xpf #{@stage_file} --xattrs-include=\'*.*\' --numeric-owner"
64
+ Getch::Command.new(cmd).run!
65
65
  end
66
66
 
67
67
  def cleaning
@@ -30,11 +30,29 @@ module Helpers
30
30
  File.write path, content if ! File.exist? path
31
31
  end
32
32
 
33
- def self.emerge(pkgs, path)
34
- cmd = "chroot #{path} /bin/bash -c \"
35
- source /etc/profile
36
- emerge --changed-use #{pkgs}
37
- \""
38
- exec_or_die(cmd)
33
+ def self.mkdir(dir)
34
+ FileUtils.mkdir_p dir if ! Dir.exist? dir
35
+ end
36
+
37
+ def self.touch(file)
38
+ File.write file, '' if ! File.exist? file
39
+ end
40
+
41
+ def self.grep?(file, regex)
42
+ is_found = false
43
+ return is_found if ! File.exist? file
44
+ File.open(file) do |f|
45
+ f.each do |line|
46
+ is_found = true if line.match(regex)
47
+ end
48
+ end
49
+ is_found
50
+ end
51
+
52
+ def self.sys(cmd)
53
+ system(cmd)
54
+ unless $?.success?
55
+ raise "Error with #{cmd}"
56
+ end
39
57
  end
40
58
  end
@@ -0,0 +1,54 @@
1
+ require 'logger'
2
+
3
+ module Getch
4
+ class Log
5
+ def initialize
6
+ @log_file = '/tmp/log_install.txt'
7
+ check_file
8
+ init_log
9
+ init_log_text
10
+ end
11
+
12
+ def info(msg)
13
+ @logger.info(msg)
14
+ @logger_text.info(msg)
15
+ end
16
+
17
+ def error(msg)
18
+ @logger.error(msg)
19
+ @logger_text.error(msg)
20
+ end
21
+
22
+ def debug(msg)
23
+ @logger.debug(msg)
24
+ @logger_text.debug(msg)
25
+ end
26
+
27
+ def fatal(msg)
28
+ @logger.fatal(msg)
29
+ @logger_text.fatal(msg)
30
+ end
31
+
32
+ private
33
+
34
+ def check_file
35
+ puts "Creating log at #{@log_file}" if ! File.exist? @log_file
36
+ end
37
+
38
+ def init_log
39
+ @logger = Logger.new(STDOUT)
40
+ @logger.level = DEFAULT_OPTIONS[:verbose] ? Logger::DEBUG : Logger::INFO
41
+ @logger.formatter = proc { |severity, datetime, progname, msg|
42
+ "#{severity}, #{msg}\n"
43
+ }
44
+ end
45
+
46
+ def init_log_text
47
+ @logger_text = Logger.new(@log_file, 1)
48
+ @logger_text.level = Logger::DEBUG
49
+ @logger_text.formatter = proc { |severity, datetime, progname, msg|
50
+ "#{severity}, #{datetime}, #{msg}\n"
51
+ }
52
+ end
53
+ end
54
+ end
@@ -2,15 +2,17 @@ require 'optparse'
2
2
 
3
3
  module Getch
4
4
  class Options
5
- attr_reader :language, :zoneinfo, :keyboard, :disk, :fs, :username
5
+ attr_reader :language, :zoneinfo, :keymap, :disk, :fs, :username, :encrypt, :verbose
6
6
 
7
7
  def initialize(argv)
8
8
  @language = DEFAULT_OPTIONS[:language]
9
- @zoneinfo = DEFAULT_OPTIONS[:location]
10
- @keyboard = DEFAULT_OPTIONS[:keyboard]
9
+ @zoneinfo = DEFAULT_OPTIONS[:zoneinfo]
10
+ @keymap = DEFAULT_OPTIONS[:keymap]
11
11
  @disk = DEFAULT_OPTIONS[:disk]
12
12
  @fs = DEFAULT_OPTIONS[:fs]
13
13
  @username = DEFAULT_OPTIONS[:username]
14
+ @encrypt = DEFAULT_OPTIONS[:encrypt]
15
+ @verbose = DEFAULT_OPTIONS[:verbose]
14
16
  parse(argv)
15
17
  end
16
18
 
@@ -24,23 +26,30 @@ module Getch
24
26
  opts.on("-z", "--zoneinfo ZONE", "Default is US/Eastern") do |zone|
25
27
  @zoneinfo = zone
26
28
  end
27
- opts.on("-k", "--keyboard KEY", "Default is us") do |key|
28
- @keyboard = key
29
+ opts.on("-k", "--keymap KEY", "Default is us") do |key|
30
+ @keymap = key
29
31
  end
30
32
  opts.on("-d", "--disk DISK", "Disk where install Gentoo (sda,sdb)") do |disk|
31
33
  @disk = disk
32
34
  end
33
- opts.on("-f", "--format FS", "Default use ext4") do |fs|
35
+ opts.on("-f", "--format FS", "Can be ext4, lvm. Default use ext4") do |fs|
34
36
  @fs = fs
37
+ DEFAULT_OPTIONS[:fs] = fs # dont known why, but it should be enforce
35
38
  end
36
39
  opts.on("-u", "--username USERNAME", "Initialize /home/username") do |user|
37
40
  @username = user
38
41
  end
42
+ opts.on("--encrypt", "Encrypt your system with Luks2.") do
43
+ @encrypt = true
44
+ end
45
+ opts.on("--verbose", "Write more messages to the standard output.") do
46
+ @verbose = true
47
+ end
39
48
  opts.on("-h", "--help", "Display this") do
40
49
  puts opts
41
50
  exit
42
51
  end
43
- end.parse!
52
+ end.parse!(into: DEFAULT_OPTIONS)
44
53
  end
45
54
  end
46
55
  end
@@ -1,3 +1,3 @@
1
1
  module Getch
2
- VERSION = '0.0.5'.freeze
2
+ VERSION = '0.1.0'.freeze
3
3
  end
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.0.5
4
+ version: 0.1.0
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-09-17 00:00:00.000000000 Z
38
+ date: 2020-10-15 00:00:00.000000000 Z
39
39
  dependencies: []
40
40
  description:
41
41
  email:
@@ -53,7 +53,50 @@ files:
53
53
  - bin/setup.sh
54
54
  - getch.gemspec
55
55
  - lib/getch.rb
56
- - lib/getch/disk.rb
56
+ - lib/getch/command.rb
57
+ - lib/getch/filesystem.rb
58
+ - lib/getch/filesystem/ext4.rb
59
+ - lib/getch/filesystem/ext4/config.rb
60
+ - lib/getch/filesystem/ext4/deps.rb
61
+ - lib/getch/filesystem/ext4/device.rb
62
+ - lib/getch/filesystem/ext4/encrypt.rb
63
+ - lib/getch/filesystem/ext4/encrypt/config.rb
64
+ - lib/getch/filesystem/ext4/encrypt/deps.rb
65
+ - lib/getch/filesystem/ext4/encrypt/device.rb
66
+ - lib/getch/filesystem/ext4/encrypt/format.rb
67
+ - lib/getch/filesystem/ext4/encrypt/mount.rb
68
+ - lib/getch/filesystem/ext4/encrypt/partition.rb
69
+ - lib/getch/filesystem/ext4/format.rb
70
+ - lib/getch/filesystem/ext4/mount.rb
71
+ - lib/getch/filesystem/ext4/partition.rb
72
+ - lib/getch/filesystem/lvm.rb
73
+ - lib/getch/filesystem/lvm/config.rb
74
+ - lib/getch/filesystem/lvm/deps.rb
75
+ - lib/getch/filesystem/lvm/device.rb
76
+ - lib/getch/filesystem/lvm/encrypt.rb
77
+ - lib/getch/filesystem/lvm/encrypt/config.rb
78
+ - lib/getch/filesystem/lvm/encrypt/deps.rb
79
+ - lib/getch/filesystem/lvm/encrypt/device.rb
80
+ - lib/getch/filesystem/lvm/encrypt/format.rb
81
+ - lib/getch/filesystem/lvm/encrypt/mount.rb
82
+ - lib/getch/filesystem/lvm/encrypt/partition.rb
83
+ - lib/getch/filesystem/lvm/format.rb
84
+ - lib/getch/filesystem/lvm/mount.rb
85
+ - lib/getch/filesystem/lvm/partition.rb
86
+ - lib/getch/filesystem/zfs.rb
87
+ - lib/getch/filesystem/zfs/config.rb
88
+ - lib/getch/filesystem/zfs/deps.rb
89
+ - lib/getch/filesystem/zfs/device.rb
90
+ - lib/getch/filesystem/zfs/encrypt.rb
91
+ - lib/getch/filesystem/zfs/encrypt/config.rb
92
+ - lib/getch/filesystem/zfs/encrypt/deps.rb
93
+ - lib/getch/filesystem/zfs/encrypt/device.rb
94
+ - lib/getch/filesystem/zfs/encrypt/format.rb
95
+ - lib/getch/filesystem/zfs/encrypt/mount.rb
96
+ - lib/getch/filesystem/zfs/encrypt/partition.rb
97
+ - lib/getch/filesystem/zfs/format.rb
98
+ - lib/getch/filesystem/zfs/mount.rb
99
+ - lib/getch/filesystem/zfs/partition.rb
57
100
  - lib/getch/gentoo.rb
58
101
  - lib/getch/gentoo/boot.rb
59
102
  - lib/getch/gentoo/chroot.rb
@@ -61,7 +104,7 @@ files:
61
104
  - lib/getch/gentoo/sources.rb
62
105
  - lib/getch/gentoo/stage.rb
63
106
  - lib/getch/helpers.rb
64
- - lib/getch/mount.rb
107
+ - lib/getch/log.rb
65
108
  - lib/getch/options.rb
66
109
  - lib/getch/states.rb
67
110
  - lib/getch/version.rb
@@ -87,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
130
  - !ruby/object:Gem::Version
88
131
  version: '0'
89
132
  requirements: []
90
- rubygems_version: 3.1.3
133
+ rubygems_version: 3.0.3
91
134
  signing_key:
92
135
  specification_version: 4
93
136
  summary: A CLI tool to install Gentoo
metadata.gz.sig CHANGED
Binary file
@@ -1,77 +0,0 @@
1
- module Getch
2
- class Disk
3
- def initialize(disk, fs)
4
- @hdd = disk
5
- @fs = fs
6
- @state = Getch::States.new()
7
- end
8
-
9
- # https://wiki.archlinux.org/index.php/Securely_wipe_disk
10
- def cleaning
11
- return if STATES[:partition ]
12
- puts
13
- print "Cleaning data on #{@hdd}, can be long, avoid this on Flash Memory (SSD,USB,...) ? (n,y) "
14
- case gets.chomp
15
- when /^y|^Y/
16
- system("dd if=/dev/urandom of=/dev/#{@hdd} bs=4M status=progress")
17
- else
18
- return
19
- end
20
- end
21
-
22
- def partition
23
- return if STATES[:partition]
24
- system("sgdisk --zap-all /dev/#{@hdd}")
25
- system("wipefs -a /dev/#{@hdd}")
26
- if Helpers::efi? then
27
- puts "Partition disk #{@hdd} for an EFI system"
28
- partition_efi
29
- else
30
- puts "Partition disk #{@hdd} for a Bios system"
31
- partition_bios
32
- end
33
- @state.partition
34
- end
35
-
36
- def format
37
- return if STATES[:format]
38
- puts "Format #{@hdd} with #{@fs}"
39
- if Helpers::efi? then
40
- system("mkfs.fat -F32 /dev/#{@hdd}1")
41
- system("mkswap /dev/#{@hdd}2")
42
- system("mkfs.ext4 /dev/#{@hdd}3")
43
- system("mkfs.ext4 /dev/#{@hdd}4")
44
- else
45
- system("mkswap /dev/#{@hdd}2")
46
- system("mkfs.ext4 /dev/#{@hdd}3")
47
- system("mkfs.ext4 /dev/#{@hdd}4")
48
- end
49
- @state.format
50
- end
51
-
52
- private
53
-
54
- # follow https://wiki.archlinux.org/index.php/Partitioning
55
- def partition_efi
56
- # /boot/efi - EFI system partition - 260MB
57
- # swap - Linux Swap - size of the ram
58
- # / - Root
59
- # /home - Home
60
- system("sgdisk -n1:1M:+260M -t1:EF00 /dev/#{@hdd}") # boot EFI
61
- system("sgdisk -n2:0:+2G -t2:8200 /dev/#{@hdd}") # swap
62
- system("sgdisk -n3:0:+15G -t3:8304 /dev/#{@hdd}") # root
63
- system("sgdisk -n4:0:0 -t3:8302 /dev/#{@hdd}") # home
64
- end
65
-
66
- def partition_bios
67
- # None - Bios Boot Partition - 1MiB
68
- # swap - Linux Swap - size of the ram
69
- # / - Root
70
- # /home - Home
71
- system("sgdisk -n1:1MiB:+1MiB -t1:EF02 /dev/#{@hdd}") # Bios boot
72
- system("sgdisk -n2:0:+2G -t2:8200 /dev/#{@hdd}") # swap
73
- system("sgdisk -n3:0:+15G -t3:8304 /dev/#{@hdd}") # root
74
- system("sgdisk -n4:0:0 -t3:8302 /dev/#{@hdd}") # home
75
- end
76
- end
77
- end
@@ -1,73 +0,0 @@
1
- require 'fileutils'
2
-
3
- module Getch
4
- class Mount
5
- def initialize(disk, user)
6
- @disk = disk
7
- @user = user
8
- @dest = MOUNTPOINT
9
- @boot_efi = MOUNTPOINT + '/boot/efi'
10
- @home = @user == nil ? MOUNTPOINT + '/home' : MOUNTPOINT + "/home/#{@user}"
11
- @state = Getch::States.new()
12
- end
13
-
14
- def swap
15
- return if STATES[:mount]
16
- system("swapon /dev/#{@disk}2")
17
- end
18
-
19
- def root
20
- return if STATES[:mount]
21
- Dir.mkdir(@dest, 0700) if ! Dir.exist?(@dest)
22
- system("mount /dev/#{@disk}3 #{@dest}")
23
- end
24
-
25
- def boot
26
- return if STATES[:mount]
27
- if Helpers::efi? then
28
- FileUtils.mkdir_p @boot_efi, mode: 0700 if ! Dir.exist?(@boot_efi)
29
- system("mount /dev/#{@disk}1 #{@boot_efi}")
30
- end
31
- end
32
-
33
- def home
34
- return if STATES[:mount]
35
- if @user != nil then
36
- FileUtils.mkdir_p @home, mode: 0700 if ! Dir.exist?(@home)
37
- system("mount /dev/#{@disk}4 #{@home}")
38
- #FileUtils.chown @user, @user, @home
39
- end
40
- @state.mount
41
- end
42
-
43
- def gen_fstab
44
- gen_uuid
45
- datas = gen_data
46
- File.write("#{MOUNTPOINT}/etc/fstab", datas.join("\n"), mode: "a")
47
- end
48
-
49
- private
50
-
51
- def gen_uuid
52
- @hdd1_uuid = `lsblk -o "UUID" /dev/#{@disk}1 | tail -1`.chomp()
53
- @hdd2_uuid = `lsblk -o "UUID" /dev/#{@disk}2 | tail -1`.chomp()
54
- @hdd3_uuid = `lsblk -o "UUID" /dev/#{@disk}3 | tail -1`.chomp()
55
- @hdd4_uuid = `lsblk -o "UUID" /dev/#{@disk}4 | tail -1`.chomp()
56
- end
57
-
58
- def gen_data
59
- boot = Helpers::efi? ? "UUID=#{@hdd1_uuid} /boot/efi vfat noauto,defaults 0 2" : ''
60
- swap = "UUID=#{@hdd2_uuid} none swap discard 0 0"
61
- root = "UUID=#{@hdd3_uuid} / ext4 defaults 0 1"
62
- home = @user != nil ? "UUID=#{@hdd4_uuid} /home/#{@user} ext4 defaults 0 2" : ''
63
-
64
- datas = [
65
- boot,
66
- swap,
67
- root,
68
- home
69
- ]
70
- return datas
71
- end
72
- end
73
- end