getch 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d697434a5e8a44edb8027582ece052145c440247524597afe5ad28118115154
4
- data.tar.gz: 42eb9e224e6581752f28d6997a9e10feb0e65c432e0dd80bc87236d7e597d828
3
+ metadata.gz: 05f332c1aa466828838d7968874705953bba34c2179426f4931a355d5c13963c
4
+ data.tar.gz: 47fa91c9b9086013db895772f4faece39afe9f4377ad96a53c4b6aee3822f79b
5
5
  SHA512:
6
- metadata.gz: 2e17128164b81b58d59f296e360197a2b9fbb33fd2b1cbd58128b1b04885eef4480d067c5588d40802c889e5a80861b63c37454b685bdb6263e9806b2e99b208
7
- data.tar.gz: f8eee6f6b37fb036a05003d109672615cc7439dcc5277f2d4604d58e66b2407fa648bdccb850269545f2aef5441777a0d936842326cecb7410b05dfb6dbcee64
6
+ metadata.gz: 0450bc2fbc6e7b3835802dae660ee878da6890bb2181826057442d3de3c580ff0d68d1348ca1d395c0820ce8d9fa5770fdaaee384e67b2619c0fc37c72190f28
7
+ data.tar.gz: 961a9019de0dc20e67da6042c2c61d2052cff31299f07c796fec71cb1b9a84e3db92cb1df276a5dd8de896faed53c967871e2d959fc3a317a7d2eccb9ba1622c
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,6 +1,14 @@
1
+ ## 0.0.9, release 2020-10-03
2
+ * Add encryption on ext4 and lvm (BIOS,UEFI)
3
+ * Correct KEYMAP="yes" with genkernel
4
+ * Renaming option keyboard with keymap
5
+ * GPG verification for ebuild
6
+
7
+ ## 0.0.8, release 2020-09-30
1
8
  * Adding LVM via the option fs, `--fs lvm`.
2
9
  * Systemd-boot use the value of PARTUUID without initramfs.
3
10
  * Include lib logger.
11
+ * Enhance functions to call program system Emerge, Make, ...
4
12
 
5
13
  ## 0.0.7, release 2020-09-22
6
14
  * Correct fstab.
data/README.md CHANGED
@@ -5,8 +5,9 @@ A CLI tool to install Gentoo.
5
5
  Actually, Getch support only the [AMD64 handbook](https://wiki.gentoo.org/wiki/Handbook:AMD64) and only with the last `stage3-amd64-systemd`.
6
6
  It also require a disk (only one for now) with a minimum of 20G.
7
7
 
8
- Filesystem supported by Getch are: (the list will evolve...)
9
- + ext4 with GRUB2 for BIOS based system and systemd-boot for UEFI systems.
8
+ BIOS system will use Grub2 and UEFI, systemd-boot. Filesystem supported by Getch are for now:
9
+ + ext4
10
+ + lvm
10
11
 
11
12
  I would also add disk encryption soon.
12
13
 
@@ -33,7 +34,7 @@ When you boot from an `iso`, you can install `ruby`, `getch` and correct your `P
33
34
  ## Examples
34
35
  For a french user:
35
36
 
36
- # getch --username ninja --zoneinfo "Europe/Paris" --language fr_FR --keyboard fr
37
+ # getch --username ninja --zoneinfo "Europe/Paris" --language fr_FR --keymap fr
37
38
 
38
39
  After an install by Getch, take a look on the [wiki](https://github.com/szorfein/getch/wiki).
39
40
 
@@ -41,6 +42,11 @@ Install Gentoo on LVM:
41
42
 
42
43
  # getch --format lvm --disk sda
43
44
 
45
+ ## Troubleshooting
46
+
47
+ #### LVM
48
+ Unless than your older LVM volume group is named `vg0`, `getch` may fail to partition your disk, you have to clean your device before proceed with `vgremove` and `pvremove`.
49
+
44
50
  ## Issues
45
51
  If need more support for your hardware (network, sound card, ...), you can submit a [new issue](https://github.com/szorfein/getch/issues/new) and post the output of the following command:
46
52
  + lspci
@@ -11,7 +11,7 @@ module Getch
11
11
  DEFAULT_OPTIONS = {
12
12
  language: 'en_US',
13
13
  zoneinfo: 'US/Eastern',
14
- keyboard: 'us',
14
+ keymap: 'us',
15
15
  disk: 'sda',
16
16
  fs: 'ext4',
17
17
  username: nil,
@@ -30,16 +30,28 @@ module Getch
30
30
  }
31
31
 
32
32
  MOUNTPOINT = "/mnt/gentoo".freeze
33
- OPTIONS_FS = {
34
- 'ext4' => DEFAULT_OPTIONS[:encrypt] ? Getch::FileSystem::Ext4::Encrypt : Getch::FileSystem::Ext4,
35
- 'lvm' => DEFAULT_OPTIONS[:encrypt] ? Getch::FileSystem::Lvm::Encrypt : Getch::FileSystem::Lvm
33
+ DEFAULT_FS = {
34
+ true => {
35
+ ext4: Getch::FileSystem::Ext4::Encrypt,
36
+ lvm: Getch::FileSystem::Lvm::Encrypt
37
+ },
38
+ false => {
39
+ ext4: Getch::FileSystem::Ext4,
40
+ lvm: Getch::FileSystem::Lvm
41
+ }
36
42
  }.freeze
37
43
 
44
+ def self.class_fs
45
+ encrypt = DEFAULT_OPTIONS[:encrypt]
46
+ fs = DEFAULT_OPTIONS[:fs].to_sym
47
+ DEFAULT_FS[encrypt][fs]
48
+ end
49
+
38
50
  def self.resume_options(opts)
39
51
  puts "\nBuild Gentoo with the following args:\n"
40
52
  puts "lang: #{DEFAULT_OPTIONS[:language]}"
41
53
  puts "zoneinfo: #{DEFAULT_OPTIONS[:zoneinfo]}"
42
- puts "keyboard: #{DEFAULT_OPTIONS[:keyboard]}"
54
+ puts "keymap: #{DEFAULT_OPTIONS[:keymap]}"
43
55
  puts "disk: #{DEFAULT_OPTIONS[:disk]}"
44
56
  puts "fs: #{DEFAULT_OPTIONS[:fs]}"
45
57
  puts "username: #{DEFAULT_OPTIONS[:username]}"
@@ -62,8 +74,8 @@ module Getch
62
74
  case gets.chomp
63
75
  when /^y|^Y/
64
76
  log.info("Partition start")
65
- OPTIONS_FS[fs]::Partition.new
66
- OPTIONS_FS[fs]::Format.new
77
+ class_fs::Partition.new
78
+ class_fs::Format.new
67
79
  else
68
80
  exit 1
69
81
  end
@@ -84,7 +96,7 @@ module Getch
84
96
  resume_options(options)
85
97
  Getch::States.new # Update States
86
98
  format(options.disk, options.fs, options.username)
87
- OPTIONS_FS[DEFAULT_OPTIONS[:fs]]::Mount.new.run
99
+ class_fs::Mount.new.run
88
100
  init_gentoo(options)
89
101
  end
90
102
  end
@@ -17,7 +17,7 @@ module Getch
17
17
 
18
18
  # only stderr
19
19
  begin
20
- @log.error stderr.readline until stderr.eof.nil?
20
+ @log.debug stderr.readline until stderr.eof.nil?
21
21
  rescue EOFError
22
22
  end
23
23
 
@@ -11,3 +11,4 @@ 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/encrypt'
@@ -30,7 +30,7 @@ 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} 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=#{@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"
34
34
  File.write(file, cmdline, mode: 'a')
35
35
  end
36
36
 
@@ -1,60 +1,83 @@
1
+ require 'fileutils'
2
+
1
3
  module Getch
2
4
  module FileSystem
3
5
  module Ext4
4
- class Config < Getch::FileSystem::Ext4::Encrypt::Device
5
- def initialize
6
- super
7
- gen_uuid
8
- @root_dir = MOUNTPOINT
9
- @init = '/usr/lib/systemd/systemd'
10
- end
6
+ module Encrypt
7
+ class Config < Getch::FileSystem::Ext4::Encrypt::Device
8
+ def initialize
9
+ super
10
+ gen_uuid
11
+ @root_dir = MOUNTPOINT
12
+ @init = '/usr/lib/systemd/systemd'
13
+ move_secret_keys
14
+ crypttab
15
+ end
11
16
 
12
- def fstab
13
- file = "#{@root_dir}/etc/fstab"
14
- datas = data_fstab
15
- File.write(file, datas.join("\n"))
16
- end
17
+ def fstab
18
+ file = "#{@root_dir}/etc/fstab"
19
+ datas = data_fstab
20
+ File.write(file, datas.join("\n"))
21
+ end
17
22
 
18
- def systemd_boot
19
- return if ! Helpers::efi?
20
- esp = '/boot/efi'
21
- dir = "#{@root_dir}/#{esp}/loader/entries/"
22
- datas_gentoo = [
23
- 'title Gentoo Linux',
24
- 'linux /vmlinuz',
25
- "options crypt_root=UUID=#{uuid_dev_root} root=/dev/mapper/#{@vg}-root init=#{@init} dolvm rw"
26
- ]
27
- File.write("#{dir}/gentoo.conf", datas_gentoo.join("\n"))
28
- end
23
+ def systemd_boot
24
+ return if ! Helpers::efi?
25
+ esp = '/boot/efi'
26
+ dir = "#{@root_dir}/#{esp}/loader/entries/"
27
+ datas_gentoo = [
28
+ 'title Gentoo Linux',
29
+ 'linux /vmlinuz',
30
+ 'initrd /initramfs',
31
+ "options crypt_root=UUID=#{@uuid_root} root=/dev/mapper/root init=#{@init} keymap=#{DEFAULT_OPTIONS[:keymap]} rw"
32
+ ]
33
+ File.write("#{dir}/gentoo.conf", datas_gentoo.join("\n"))
34
+ end
29
35
 
30
- def grub
31
- return if Helpers::efi?
32
- file = "#{@root_dir}/etc/default/grub"
33
- cmdline = [
34
- "GRUB_CMDLINE_LINUX=\"resume=UUID=#{@uuid_swap} crypt_root=UUID=#{@uuid_dev_root} root=/dev/mapper/#{@vg}-root init=#{@init} dolvm rw\"",
35
- "GRUB_ENABLE_CRYPTODISK=y"
36
- ]
37
- File.write("#{file}", cmdline.join("\n"), mode: 'a')
38
- end
36
+ def crypttab
37
+ home = @dev_home ? "crypthome UUID=#{@uuid_home} /root/secretkeys/crypto_keyfile.bin luks" : ''
38
+ datas = [
39
+ "cryptswap UUID=#{@uuid_swap} /dev/urandom swap,cipher=aes-xts-plain64:sha256,size=256",
40
+ home
41
+ ]
42
+ File.write("#{@root_dir}/etc/crypttab", datas.join("\n"))
43
+ end
39
44
 
40
- private
45
+ def grub
46
+ return if Helpers::efi?
47
+ file = "#{@root_dir}/etc/default/grub"
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]}\"",
50
+ "GRUB_ENABLE_CRYPTODISK=y"
51
+ ]
52
+ File.write(file, cmdline.join("\n"), mode: 'a')
53
+ end
41
54
 
42
- def gen_uuid
43
- @uuid_swap = `lsblk -o "UUID" #{@lv_swap} | tail -1`.chomp() if @lv_swap
44
- @uuid_root = `lsblk -o "UUID" #{@lv_root} | tail -1`.chomp() if @lv_root
45
- @uuid_dev_root = `lsblk -o "UUID" #{@dev_root} | tail -1`.chomp() if @dev_root
46
- @uuid_boot = `lsblk -o "UUID" #{@dev_boot} | tail -1`.chomp() if @dev_boot
47
- @uuid_boot_efi = `lsblk -o "UUID" #{@dev_boot_efi} | tail -1`.chomp() if @dev_boot_efi
48
- @uuid_home = `lsblk -o "UUID" #{@lv_home} | tail -1`.chomp() if @lv_home
49
- end
55
+ private
56
+
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
60
+ @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
62
+ @uuid_root = `lsblk -d -o "UUID" #{@luks_root} | tail -1`.chomp() if @dev_root
63
+ @uuid_home = `lsblk -d -o "UUID" #{@dev_home} | tail -1`.chomp() if @luks_home
64
+ end
65
+
66
+ def data_fstab
67
+ boot_efi = @dev_boot_efi ? "UUID=#{@uuid_boot_efi} /boot/efi vfat noauto,noatime 1 2" : ''
68
+ swap = @dev_swap ? "#{@luks_swap} none swap discard 0 0 " : ''
69
+ root = @dev_root ? "UUID=#{@uuid_root} / ext4 defaults 0 1" : ''
70
+ home = @dev_home ? "#{@luks_home} /home/#{@user} ext4 defaults 0 2" : ''
50
71
 
51
- def data_fstab
52
- boot_efi = @lv_boot_efi ? "UUID=#{@uuid_boot_efi} /boot/efi vfat noauto,noatime 1 2" : ''
53
- swap = @lv_swap ? "UUID=#{@uuid_swap} none swap discard 0 0" : ''
54
- root = @lv_root ? "UUID=#{@uuid_root} / ext4 defaults 0 1" : ''
55
- home = @lv_home ? "UUID=#{@uuid_home} /home/#{@user} ext4 defaults 0 2" : ''
72
+ [ boot_efi, swap, root, home ]
73
+ end
56
74
 
57
- [ boot_efi, swap, root, home ]
75
+ def move_secret_keys
76
+ return if ! @luks_home
77
+ puts "Moving secret keys"
78
+ keys_path = "#{@root_dir}/root/secretkeys"
79
+ FileUtils.mv("/root/secretkeys", keys_path) if ! Dir.exist?(keys_path)
80
+ end
58
81
  end
59
82
  end
60
83
  end
@@ -12,19 +12,41 @@ module Getch
12
12
  install_deps
13
13
  end
14
14
 
15
+ def make
16
+ genkernel
17
+ Getch::Make.new("genkernel --kernel-config=/usr/src/linux/.config all").run!
18
+ end
19
+
15
20
  private
16
21
  def install_efi
17
22
  end
18
23
 
24
+ def genkernel
25
+ grub = Helpers::efi? ? 'BOOTLOADER="no"' : 'BOOTLOADER="grub2"'
26
+ datas = [
27
+ '',
28
+ grub,
29
+ 'INSTALL="yes"',
30
+ 'MENUCONFIG="no"',
31
+ 'CLEAN="yes"',
32
+ 'KEYMAP="yes"',
33
+ 'SAVE_CONFIG="yes"',
34
+ 'MOUNTBOOT="yes"',
35
+ 'MRPROPER="no"',
36
+ 'LUKS="yes"',
37
+ ]
38
+ file = "#{MOUNTPOINT}/etc/genkernel.conf"
39
+ File.write(file, datas.join("\n"), mode: 'a')
40
+ end
41
+
19
42
  def install_bios
20
43
  exec("euse -p sys-boot/grub -E device-mapper")
44
+ exec("euse -p sys-fs/cryptsetup -E luks1_default")
21
45
  end
22
46
 
23
47
  def install_deps
24
- exec("euse -p sys-apps/systemd -E cryptsetup")
25
- Getch::Emerge.new('genkernel cryptsetup lvm2').pkg!
26
- exec("genkernel --install --luks --keymap #{DEFAULT_OPTIONS[:keyboard]} --lvm --kernel-config=/usr/src/linux/.config initramfs")
27
- exec("systemctl enable lvm2-monitor")
48
+ exec("euse -E cryptsetup") if ! Helpers::grep?("#{MOUNTPOINT}/etc/portage/make.conf", /cryptsetup/)
49
+ Getch::Emerge.new('genkernel sys-apps/systemd sys-fs/cryptsetup').pkg!
28
50
  end
29
51
 
30
52
  def exec(cmd)
@@ -8,10 +8,11 @@ module Getch
8
8
  @user = DEFAULT_OPTIONS[:username]
9
9
  @dev_boot_efi = Helpers::efi? ? "/dev/#{@disk}1" : nil
10
10
  @dev_root = "/dev/#{@disk}2"
11
- @vg = 'vg0'
12
- @lv_root = "/dev/mapper/#{@vg}-root"
13
- @lv_swap = "/dev/mapper/#{@vg}-swap"
14
- @lv_home = @user ? "/dev/mapper/#{@vg}-home" : nil
11
+ @dev_swap = "/dev/#{@disk}3"
12
+ @dev_home = @user ? "/dev/#{@disk}4" : nil
13
+ @luks_root = "/dev/mapper/cryptroot"
14
+ @luks_home = @user ? "/dev/mapper/crypthome" : nil
15
+ @luks_swap = "/dev/mapper/cryptswap"
15
16
  end
16
17
  end
17
18
  end
@@ -13,12 +13,18 @@ module Getch
13
13
  def format
14
14
  return if STATES[:format]
15
15
  puts "Format #{@disk} with #{@fs}"
16
- system("mkfs.fat -F32 #{@dev_boot_efi}") if Helpers::efi?
17
- system("mkswap #{@lv_swap}")
18
- system("mkfs.#{@fs} #{@lv_root}")
19
- system("mkfs.#{@fs} #{@lv_home}") if @lv_home
16
+ exec("mkfs.fat -F32 #{@dev_boot_efi}") if Helpers::efi?
17
+ exec("mkfs.#{@fs} -F #{@luks_root}")
18
+ exec("mkswap -f #{@dev_swap}")
19
+ exec("mkfs.#{@fs} -F #{@luks_home}") if @dev_home
20
20
  @state.format
21
21
  end
22
+
23
+ private
24
+
25
+ def exec(cmd)
26
+ Getch::Command.new(cmd).run!
27
+ end
22
28
  end
23
29
  end
24
30
  end
@@ -16,7 +16,7 @@ module Getch
16
16
 
17
17
  def run
18
18
  return if STATES[:mount]
19
- mount_swap
19
+ #mount_swap
20
20
  mount_root
21
21
  mount_boot
22
22
  mount_home
@@ -27,14 +27,14 @@ module Getch
27
27
  private
28
28
 
29
29
  def mount_swap
30
- return if ! @lv_swap
31
- system("swapon #{@lv_swap}")
30
+ return if ! @dev_swap
31
+ system("swapon #{@dev_swap}")
32
32
  end
33
33
 
34
34
  def mount_root
35
- return if ! @lv_root
35
+ return if ! @dev_root
36
36
  Dir.mkdir(@root_dir, 0700) if ! Dir.exist?(@root_dir)
37
- system("mount #{@lv_root} #{@root_dir}")
37
+ system("mount #{@luks_root} #{@root_dir}")
38
38
  end
39
39
 
40
40
  def mount_boot_efi
@@ -50,10 +50,10 @@ module Getch
50
50
  end
51
51
 
52
52
  def mount_home
53
- return if ! @lv_home
53
+ return if ! @dev_home
54
54
  if @user != nil then
55
55
  FileUtils.mkdir_p @home_dir, mode: 0700 if ! Dir.exist?(@home_dir)
56
- system("mount #{@lv_home} #{@home_dir}")
56
+ system("mount #{@luks_home} #{@home_dir}")
57
57
  end
58
58
  @state.mount
59
59
  end
@@ -6,6 +6,7 @@ module Getch
6
6
  def initialize
7
7
  super
8
8
  @state = Getch::States.new()
9
+ @log = Log.new
9
10
  run_partition
10
11
  end
11
12
 
@@ -13,10 +14,13 @@ module Getch
13
14
  return if STATES[:partition ]
14
15
  clear_struct
15
16
  cleaning
16
- boot
17
- others
18
- luks
19
- lvm
17
+ if Helpers::efi?
18
+ partition_efi
19
+ encrypt_efi
20
+ else
21
+ partition_bios
22
+ encrypt_bios
23
+ end
20
24
  @state.partition
21
25
  end
22
26
 
@@ -39,51 +43,68 @@ module Getch
39
43
  end
40
44
  end
41
45
 
42
- def boot
43
- if Helpers::efi?
44
- exec("sgdisk -n1:1M:+260M -t1:EF00 /dev/#{@disk}}")
45
- else
46
- exec("sgdisk -n1:1MiB:+1MiB -t1:EF02 /dev/#{@disk}")
47
- end
46
+ # Follow https://wiki.archlinux.org/index.php/Partitioning
47
+ def partition_efi
48
+ # /boot/efi - EFI system partition - 260MB
49
+ # / - Root
50
+ # swap - Linux Swap - size of the ram
51
+ # /home - Home
52
+ mem=`awk '/MemTotal/ {print $2}' /proc/meminfo`.chomp + 'K'
53
+
54
+ exec("sgdisk -n1:1M:+260M -t1:EF00 /dev/#{@disk}")
55
+ exec("sgdisk -n2:0:+15G -t2:8309 /dev/#{@disk}")
56
+ exec("sgdisk -n3:0:+#{mem} -t3:8200 /dev/#{@disk}")
57
+ exec("sgdisk -n4:0:0 -t4:8309 /dev/#{@disk}") if @dev_home
48
58
  end
49
59
 
50
- def others
51
- exec("sgdisk -n2:0:+0 -t2:8309 /dev/#{@disk}")
60
+ def encrypt_efi
61
+ @log.info("Format root")
62
+ Helpers::sys("cryptsetup luksFormat #{@dev_root}")
63
+ @log.debug("Opening root")
64
+ Helpers::sys("cryptsetup open --type luks #{@dev_root} cryptroot")
65
+ encrypt_home
52
66
  end
53
67
 
54
- def luks
55
- if Helpers::efi?
56
- exec("cryptsetup --use-random luksFormat /dev/#{@disk}2")
57
- exec("cryptsetup open --type luks /dev/#{@disk}2 crypt-lvm")
58
- else
59
- # GRUB do not support LUKS2
60
- exec("cryptsetup --use-random luksFormat --type luks1 /dev/#{@disk}2")
61
- exec("cryptsetup open --type luks1 /dev/#{@disk}2 crypt-lvm")
62
- end
68
+ def encrypt_bios
69
+ @log.info("Format root for bios")
70
+ Helpers::sys("cryptsetup luksFormat --type luks1 #{@dev_root}")
71
+ @log.debug("Opening root")
72
+ Helpers::sys("cryptsetup open --type luks1 #{@dev_root} cryptroot")
73
+ encrypt_home
63
74
  end
64
75
 
65
- def lvm
66
- mem=`awk '/MemTotal/ {print $2}' /proc/meminfo`.chomp + 'K'
67
- exec("pvcreate /dev/mapper/crypt-lvm")
68
- exec("vgcreate #{@vg} /dev/mapper/crypt-lvm")
69
- exec("lvcreate -L 15G -n root #{@vg}")
70
- exec("lvcreate -L #{mem} -n swap #{@vg}")
71
- exec("lvcreate -l 100%FREE -n home #{@vg}") if @user
72
- exec("vgchange --available y")
76
+ def encrypt_home
77
+ if @dev_home then
78
+ create_secret_keys
79
+ @log.info("Format home with #{@key_path}")
80
+ Helpers::sys("cryptsetup luksFormat #{@dev_home} #{@key_path}")
81
+ @log.debug("Open home with key #{@key_path}")
82
+ exec("cryptsetup open --type luks -d #{@key_path} #{@dev_home} crypthome")
83
+ end
73
84
  end
74
85
 
75
- # Follow https://wiki.archlinux.org/index.php/Partitioning
76
- # Partition_efi
77
- # /boot/efi - EFI system partition - 260MB
78
- # / - Root
79
- # swap - Linux Swap - size of the ram
80
- # /home - Home
86
+ def create_secret_keys
87
+ return if ! @dev_home
88
+ @log.info("Creating secret keys")
89
+ keys_dir = "/root/secretkeys"
90
+ key_name = "crypto_keyfile.bin"
91
+ @key_path = "#{keys_dir}/#{key_name}"
92
+ FileUtils.mkdir keys_dir, mode: 0700 if ! Dir.exist?(keys_dir)
93
+ Getch::Command.new("dd bs=512 count=4 if=/dev/urandom of=#{@key_path}").run!
94
+ end
81
95
 
82
- # Partition_bios
96
+ def partition_bios
83
97
  # None - Bios Boot Partition - 1MiB
84
98
  # / - Root
85
99
  # swap - Linux Swap - size of the ram
86
100
  # /home - Home
101
+ mem=`awk '/MemTotal/ {print $2}' /proc/meminfo`.chomp + 'K'
102
+
103
+ exec("sgdisk -n1:1MiB:+1MiB -t1:EF02 /dev/#{@disk}")
104
+ exec("sgdisk -n2:0:+15G -t2:8309 /dev/#{@disk}")
105
+ exec("sgdisk -n3:0:+#{mem} -t3:8200 /dev/#{@disk}")
106
+ exec("sgdisk -n4:0:0 -t4:8309 /dev/#{@disk}") if @dev_home
107
+ end
87
108
 
88
109
  def exec(cmd)
89
110
  Getch::Command.new(cmd).run!
@@ -11,3 +11,4 @@ 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/encrypt'
@@ -50,11 +50,12 @@ module Getch
50
50
 
51
51
  def data_fstab
52
52
  boot_efi = @dev_boot_efi ? "UUID=#{@uuid_boot_efi} /boot/efi vfat noauto,noatime 1 2" : ''
53
+ boot = @dev_boot ? "UUID=#{@uuid_boot} /boot ext4 noauto,noatime 1 2" : ''
53
54
  swap = @lv_swap ? "UUID=#{@uuid_swap} none swap discard 0 0" : ''
54
55
  root = @lv_root ? "UUID=#{@uuid_root} / ext4 defaults 0 1" : ''
55
56
  home = @lv_home ? "UUID=#{@uuid_home} /home/#{@user} ext4 defaults 0 2" : ''
56
57
 
57
- [ boot_efi, swap, root, home ]
58
+ [ boot_efi, boot, swap, root, home ]
58
59
  end
59
60
  end
60
61
  end
@@ -0,0 +1,15 @@
1
+ module Getch
2
+ module FileSystem
3
+ module Lvm
4
+ module Encrypt
5
+ end
6
+ end
7
+ end
8
+ end
9
+
10
+ require_relative 'encrypt/device'
11
+ require_relative 'encrypt/partition'
12
+ require_relative 'encrypt/format'
13
+ require_relative 'encrypt/mount'
14
+ require_relative 'encrypt/config'
15
+ require_relative 'encrypt/deps'
@@ -0,0 +1,74 @@
1
+ module Getch
2
+ module FileSystem
3
+ module Lvm
4
+ module Encrypt
5
+ class Config < Getch::FileSystem::Lvm::Encrypt::Device
6
+ def initialize
7
+ super
8
+ gen_uuid
9
+ @root_dir = MOUNTPOINT
10
+ @init = '/usr/lib/systemd/systemd'
11
+ crypttab
12
+ end
13
+
14
+ def fstab
15
+ file = "#{@root_dir}/etc/fstab"
16
+ datas = data_fstab
17
+ File.write(file, datas.join("\n"))
18
+ end
19
+
20
+ def systemd_boot
21
+ return if ! Helpers::efi?
22
+ esp = '/boot/efi'
23
+ dir = "#{@root_dir}/#{esp}/loader/entries/"
24
+ datas_gentoo = [
25
+ 'title Gentoo Linux',
26
+ 'linux /vmlinuz',
27
+ 'initrd /initramfs',
28
+ "options crypt_root=UUID=#{@uuid_dev_root} root=#{@lv_root} init=#{@init} keymap=#{DEFAULT_OPTIONS[:keymap]} dolvm rw"
29
+ ]
30
+ File.write("#{dir}/gentoo.conf", datas_gentoo.join("\n"))
31
+ end
32
+
33
+ def crypttab
34
+ datas = [
35
+ "cryptswap #{@lv_swap} /dev/urandom swap,cipher=aes-xts-plain64:sha256,size=256"
36
+ ]
37
+ File.write("#{@root_dir}/etc/crypttab", datas.join("\n"))
38
+ end
39
+
40
+ def grub
41
+ return if Helpers::efi?
42
+ file = "#{@root_dir}/etc/default/grub"
43
+ cmdline = [
44
+ "GRUB_CMDLINE_LINUX=\"crypt_root=UUID=#{@uuid_dev_root} 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]}\"",
45
+ "GRUB_ENABLE_CRYPTODISK=y"
46
+ ]
47
+ File.write("#{file}", cmdline.join("\n"), mode: 'a')
48
+ end
49
+
50
+ private
51
+
52
+ def gen_uuid
53
+ @uuid_swap = `lsblk -o "UUID" #{@lv_swap} | tail -1`.chomp() if @lv_swap
54
+ @uuid_root = `lsblk -d -o "UUID" #{@lv_root} | tail -1`.chomp() if @lv_root
55
+ @uuid_dev_root = `lsblk -d -o "UUID" #{@dev_root} | tail -1`.chomp() if @dev_root
56
+ @uuid_boot = `lsblk -o "UUID" #{@dev_boot} | tail -1`.chomp() if @dev_boot
57
+ @uuid_boot_efi = `lsblk -o "UUID" #{@dev_boot_efi} | tail -1`.chomp() if @dev_boot_efi
58
+ @uuid_home = `lsblk -o "UUID" #{@lv_home} | tail -1`.chomp() if @lv_home
59
+ end
60
+
61
+ def data_fstab
62
+ boot_efi = @dev_boot_efi ? "UUID=#{@uuid_boot_efi} /boot/efi vfat noauto,noatime 1 2" : ''
63
+ boot = @dev_boot ? "UUID=#{@uuid_boot} /boot ext4 noauto,noatime 1 2" : ''
64
+ swap = @lv_swap ? "/dev/mapper/cryptswap none swap discard 0 0" : ''
65
+ root = @lv_root ? "UUID=#{@uuid_root} / ext4 defaults 0 1" : ''
66
+ home = @lv_home ? "UUID=#{@uuid_home} /home/#{@user} ext4 defaults 0 2" : ''
67
+
68
+ [ boot_efi, boot, swap, root, home ]
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,63 @@
1
+ module Getch
2
+ module FileSystem
3
+ module Lvm
4
+ module Encrypt
5
+ class Deps
6
+ def initialize
7
+ if Helpers::efi?
8
+ install_efi
9
+ else
10
+ install_bios
11
+ end
12
+ install_deps
13
+ end
14
+
15
+ def make
16
+ options_make
17
+ Getch::Make.new("genkernel --kernel-config=/usr/src/linux/.config all").run!
18
+ end
19
+
20
+ private
21
+ def options_make
22
+ grub = Helpers::efi? ? 'BOOTLOADER="no"' : 'BOOTLOADER="grub2"'
23
+ datas = [
24
+ '',
25
+ grub,
26
+ 'INSTALL="yes"',
27
+ 'MENUCONFIG="no"',
28
+ 'CLEAN="yes"',
29
+ 'KEYMAP="yes"',
30
+ 'SAVE_CONFIG="yes"',
31
+ 'MOUNTBOOT="yes"',
32
+ 'MRPROPER="no"',
33
+ 'LVM="yes"',
34
+ 'LUKS="yes"',
35
+ ]
36
+ file = "#{MOUNTPOINT}/etc/genkernel.conf"
37
+ File.write(file, datas.join("\n"), mode: 'a')
38
+ end
39
+
40
+ def install_efi
41
+ end
42
+
43
+ def install_bios
44
+ exec("euse -p sys-boot/grub -E device-mapper")
45
+ end
46
+
47
+ def install_deps
48
+ make_conf = "#{MOUNTPOINT}/etc/portage/make.conf"
49
+ exec("euse -E lvm") if ! Helpers::grep?(make_conf, /lvm/)
50
+ exec("euse -E cryptsetup") if ! Helpers::grep?(make_conf, /cryptsetup/)
51
+ Getch::Emerge.new('genkernel systemd sys-fs/cryptsetup lvm2').pkg!
52
+ Getch::Garden.new('-a lvm').run!
53
+ exec("systemctl enable lvm2-monitor")
54
+ end
55
+
56
+ def exec(cmd)
57
+ Helpers::run_chroot(cmd, MOUNTPOINT)
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,22 @@
1
+ module Getch
2
+ module FileSystem
3
+ module Lvm
4
+ module Encrypt
5
+ class Device
6
+ def initialize
7
+ @disk = DEFAULT_OPTIONS[:disk]
8
+ @user = DEFAULT_OPTIONS[:username]
9
+ @dev_boot_efi = Helpers::efi? ? "/dev/#{@disk}1" : nil
10
+ @dev_boot = Helpers::efi? ? nil : "/dev/#{@disk}2"
11
+ @dev_root = Helpers::efi? ? "/dev/#{@disk}2" : "/dev/#{@disk}3"
12
+ @vg = 'vg0'
13
+ @lv_root = "/dev/mapper/#{@vg}-root"
14
+ @lv_swap = "/dev/mapper/#{@vg}-swap"
15
+ @lv_home = @user ? "/dev/mapper/#{@vg}-home" : nil
16
+ @luks_root = "/dev/mapper/cryptroot"
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,32 @@
1
+ module Getch
2
+ module FileSystem
3
+ module Lvm
4
+ module Encrypt
5
+ class Format < Getch::FileSystem::Lvm::Encrypt::Device
6
+ def initialize
7
+ super
8
+ @fs = 'ext4'
9
+ @state = Getch::States.new()
10
+ format
11
+ end
12
+
13
+ def format
14
+ return if STATES[:format]
15
+ puts "Format #{@disk} with #{@fs}"
16
+ exec("mkfs.fat -F32 #{@dev_boot_efi}") if @dev_boot_efi
17
+ exec("mkfs.#{@fs} -F #{@dev_boot}") if @dev_boot
18
+ #exec("mkswap -f #{@lv_swap}")
19
+ exec("mkfs.#{@fs} -F #{@lv_root}")
20
+ exec("mkfs.#{@fs} -F #{@lv_home}") if @lv_home
21
+ @state.format
22
+ end
23
+
24
+ private
25
+ def exec(cmd)
26
+ Getch::Command.new(cmd).run!
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,64 @@
1
+ require 'fileutils'
2
+
3
+ module Getch
4
+ module FileSystem
5
+ module Lvm
6
+ module Encrypt
7
+ class Mount < Getch::FileSystem::Lvm::Encrypt::Device
8
+ def initialize
9
+ super
10
+ @root_dir = MOUNTPOINT
11
+ @boot_dir = "#{@root_dir}/boot"
12
+ @boot_efi_dir = "#{@root_dir}/boot/efi"
13
+ @home_dir = @user ? "#{@root_dir}/home/#{@user}" : nil
14
+ @state = Getch::States.new()
15
+ end
16
+
17
+ def run
18
+ return if STATES[:mount]
19
+ mount_swap
20
+ mount_root
21
+ mount_boot
22
+ mount_home
23
+ mount_boot_efi
24
+ @state.mount
25
+ end
26
+
27
+ private
28
+
29
+ def mount_swap
30
+ return if ! @lv_swap
31
+ system("swapon #{@lv_swap}")
32
+ end
33
+
34
+ def mount_root
35
+ return if ! @lv_root
36
+ Dir.mkdir(@root_dir, 0700) if ! Dir.exist?(@root_dir)
37
+ system("mount #{@lv_root} #{@root_dir}")
38
+ end
39
+
40
+ def mount_boot_efi
41
+ return if ! @dev_boot_efi
42
+ FileUtils.mkdir_p @boot_efi_dir, mode: 0700 if ! Dir.exist?(@boot_efi_dir)
43
+ system("mount #{@dev_boot_efi} #{@boot_efi_dir}")
44
+ end
45
+
46
+ def mount_boot
47
+ return if ! @dev_boot
48
+ FileUtils.mkdir_p @boot_dir, mode: 0700 if ! Dir.exist?(@boot_dir)
49
+ system("mount #{@dev_boot} #{@boot_dir}")
50
+ end
51
+
52
+ def mount_home
53
+ return if ! @lv_home
54
+ if @user != nil then
55
+ FileUtils.mkdir_p @home_dir, mode: 0700 if ! Dir.exist?(@home_dir)
56
+ system("mount #{@lv_home} #{@home_dir}")
57
+ end
58
+ @state.mount
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,92 @@
1
+ module Getch
2
+ module FileSystem
3
+ module Lvm
4
+ module Encrypt
5
+ class Partition < Getch::FileSystem::Lvm::Encrypt::Device
6
+ def initialize
7
+ super
8
+ @state = Getch::States.new()
9
+ @log = Log.new
10
+ run_partition
11
+ end
12
+
13
+ def run_partition
14
+ return if STATES[:partition ]
15
+ clear_struct
16
+ cleaning
17
+ partition
18
+ encrypt
19
+ lvm
20
+ @state.partition
21
+ end
22
+
23
+ private
24
+
25
+ def clear_struct
26
+ oldvg = `vgdisplay | grep #{@vg}`.chomp
27
+ exec("vgremove -f #{@vg}") if oldvg != '' # remove older volume group
28
+ exec("pvremove -f #{@dev_root}") if oldvg != '' and File.exist? @dev_root # remove older volume group
29
+
30
+ exec("sgdisk -Z /dev/#{@disk}")
31
+ exec("wipefs -a /dev/#{@disk}")
32
+ end
33
+
34
+ def cleaning
35
+ puts
36
+ print "Cleaning data on #{@disk}, can be long, avoid this on Flash Memory (SSD,USB,...) ? (n,y) "
37
+ case gets.chomp
38
+ when /^y|^Y/
39
+ bloc=`blockdev --getbsz /dev/#{@disk}`.chomp
40
+ exec("dd if=/dev/urandom of=/dev/#{@disk} bs=#{bloc} status=progress")
41
+ else
42
+ return
43
+ end
44
+ end
45
+
46
+ def partition
47
+ if Helpers::efi?
48
+ exec("sgdisk -n1:1M:+260M -t1:EF00 /dev/#{@disk}")
49
+ exec("sgdisk -n2:0:+0 -t2:8e00 /dev/#{@disk}")
50
+ else
51
+ exec("sgdisk -n1:1MiB:+1MiB -t1:EF02 /dev/#{@disk}")
52
+ exec("sgdisk -n2:0:+128MiB -t2:8300 /dev/#{@disk}")
53
+ exec("sgdisk -n3:0:+0 -t3:8e00 /dev/#{@disk}")
54
+ end
55
+ end
56
+
57
+ def encrypt
58
+ @log.info("Format root")
59
+ Helpers::sys("cryptsetup luksFormat #{@dev_root}")
60
+ @log.debug("Opening root")
61
+ Helpers::sys("cryptsetup open --type luks #{@dev_root} cryptroot")
62
+ end
63
+
64
+ def lvm
65
+ mem=`awk '/MemTotal/ {print $2}' /proc/meminfo`.chomp + 'K'
66
+ exec("pvcreate -f #{@luks_root}")
67
+ exec("vgcreate -f #{@vg} #{@luks_root}")
68
+ # Wipe old signature: https://github.com/chef-cookbooks/lvm/issues/45
69
+ exec("lvcreate -y -Wy -Zy -L 15G -n root #{@vg}")
70
+ exec("lvcreate -y -Wy -Zy -L #{mem} -n swap #{@vg}")
71
+ exec("lvcreate -y -Wy -Zy -l 100%FREE -n home #{@vg}") if @user
72
+ exec("vgchange --available y")
73
+ end
74
+
75
+ # Follow https://wiki.archlinux.org/index.php/Partitioning
76
+ # Partition_efi
77
+ # /boot/efi - EFI system partition - 260MB
78
+ # / - Root
79
+
80
+ # Partition_bios
81
+ # None - Bios Boot Partition - 1MiB
82
+ # /boot - Boot - 8300
83
+ # / - Root
84
+
85
+ def exec(cmd)
86
+ Getch::Command.new(cmd).run!
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
@@ -51,8 +51,8 @@ module Getch
51
51
  return if STATES[:gentoo_kernel]
52
52
  source = Getch::Gentoo::Sources.new()
53
53
  new
54
- source.init_config
55
54
  source.build_kspp
55
+ source.init_config
56
56
  source.build_others
57
57
  source.make
58
58
  @state.kernel
@@ -6,7 +6,7 @@ module Getch
6
6
  def initialize(opts)
7
7
  @disk = opts.disk
8
8
  @user = opts.username
9
- @config = OPTIONS_FS[DEFAULT_OPTIONS[:fs]]::Config.new()
9
+ @config = Getch.class_fs::Config.new()
10
10
  end
11
11
 
12
12
  def start
@@ -11,7 +11,7 @@ module Getch
11
11
  return if STATES[:gentoo_update]
12
12
  puts "Downloading the last ebuilds for Gentoo..."
13
13
  Helpers::create_dir("#{MOUNTPOINT}/var/db/repos/gentoo")
14
- cmd = "emerge-webrsync"
14
+ cmd = "emaint sync --auto"
15
15
  exec_chroot(cmd)
16
16
  end
17
17
 
@@ -24,18 +24,25 @@ module Getch
24
24
  File.write(@make, data.join("\n"), mode: "a")
25
25
  end
26
26
 
27
+ # Write a repos.conf/gentoo.conf with the gpg verification
27
28
  def repo
28
29
  src = "#{MOUNTPOINT}/usr/share/portage/config/repos.conf"
29
30
  dest = "#{MOUNTPOINT}/etc/portage/repos.conf"
30
31
  FileUtils.mkdir dest, mode: 0644 if ! Dir.exist?(dest)
32
+ tmp = Tempfile.new('gentoo.conf')
31
33
  line_count = 0
32
- tmp_file = Tempfile.new('gentoo.conf')
34
+
33
35
  File.open(src).each { |l|
34
- File.write(tmp_file, "sync-allow-hardlinks = yes\n", mode: 'a') if line_count == 2
35
- File.write(tmp_file, l, mode: 'a')
36
+ File.write(tmp, "sync-allow-hardlinks = yes\n", mode: 'a') if line_count == 2
37
+ if l.match(/^sync-type = rsync/)
38
+ File.write(tmp, "sync-type = webrsync\n", mode: 'a')
39
+ else
40
+ File.write(tmp, l, mode: 'a')
41
+ end
36
42
  line_count += 1
37
43
  }
38
- FileUtils.copy_file(tmp_file, "#{dest}/gentoo.conf", preserve = false)
44
+
45
+ FileUtils.copy_file(tmp, "#{dest}/gentoo.conf", preserve = false)
39
46
  end
40
47
 
41
48
  def network
@@ -50,7 +57,7 @@ module Getch
50
57
  File.write("#{MOUNTPOINT}/etc/locale.conf", "LANG=#{@lang}\n")
51
58
  File.write("#{MOUNTPOINT}/etc/locale.conf", 'LC_COLLATE=C', mode: 'a')
52
59
  File.write("#{MOUNTPOINT}/etc/timezone", "#{options.zoneinfo}")
53
- File.write("#{MOUNTPOINT}/etc/vconsole.conf", "KEYMAP=#{options.keyboard}")
60
+ File.write("#{MOUNTPOINT}/etc/vconsole.conf", "KEYMAP=#{options.keymap}")
54
61
  end
55
62
 
56
63
  def hostname
@@ -74,7 +81,7 @@ module Getch
74
81
  def control_options(options)
75
82
  search_zone(options.zoneinfo)
76
83
  search_utf8(options.language)
77
- search_key(options.keyboard)
84
+ search_key(options.keymap)
78
85
  end
79
86
 
80
87
  def search_key(keys)
@@ -3,7 +3,7 @@ module Getch
3
3
  class Sources
4
4
  def initialize
5
5
  @lsmod = `lsmod`.chomp
6
- @filesystem = OPTIONS_FS[DEFAULT_OPTIONS[:fs]]::Deps.new()
6
+ @filesystem = Getch.class_fs::Deps.new()
7
7
  end
8
8
 
9
9
  def build_others
@@ -20,7 +20,7 @@ module Getch
20
20
  end
21
21
 
22
22
  def make
23
- if DEFAULT_OPTIONS[:fs] == 'lvm'
23
+ if DEFAULT_OPTIONS[:fs] == 'lvm' or DEFAULT_OPTIONS[:encrypt]
24
24
  @filesystem.make
25
25
  else
26
26
  just_make
@@ -77,6 +77,7 @@ module Getch
77
77
  end
78
78
 
79
79
  def install_zfs
80
+ return if ! DEFAULT_OPTIONS[:fs] == 'zfs'
80
81
  garden("-a zfs")
81
82
  only_make # a first 'make' is necessary before emerge zfs
82
83
  Getch::Emerge.new("sys-fs/zfs").pkg!
@@ -46,4 +46,22 @@ module Helpers
46
46
  \""
47
47
  Getch::Command.new(script).run!
48
48
  end
49
+
50
+ def self.grep?(file, regex)
51
+ is_found = false
52
+ return is_found if ! File.exist? file
53
+ File.open(file) do |f|
54
+ f.each do |line|
55
+ is_found = true if line.match(regex)
56
+ end
57
+ end
58
+ is_found
59
+ end
60
+
61
+ def self.sys(cmd)
62
+ system(cmd)
63
+ unless $?.success?
64
+ raise "Error with #{cmd}"
65
+ end
66
+ end
49
67
  end
@@ -2,12 +2,12 @@ require 'optparse'
2
2
 
3
3
  module Getch
4
4
  class Options
5
- attr_reader :language, :zoneinfo, :keyboard, :disk, :fs, :username, :encrypt, :verbose
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
9
  @zoneinfo = DEFAULT_OPTIONS[:zoneinfo]
10
- @keyboard = DEFAULT_OPTIONS[:keyboard]
10
+ @keymap = DEFAULT_OPTIONS[:keymap]
11
11
  @disk = DEFAULT_OPTIONS[:disk]
12
12
  @fs = DEFAULT_OPTIONS[:fs]
13
13
  @username = DEFAULT_OPTIONS[:username]
@@ -26,8 +26,8 @@ module Getch
26
26
  opts.on("-z", "--zoneinfo ZONE", "Default is US/Eastern") do |zone|
27
27
  @zoneinfo = zone
28
28
  end
29
- opts.on("-k", "--keyboard KEY", "Default is us") do |key|
30
- @keyboard = key
29
+ opts.on("-k", "--keymap KEY", "Default is us") do |key|
30
+ @keymap = key
31
31
  end
32
32
  opts.on("-d", "--disk DISK", "Disk where install Gentoo (sda,sdb)") do |disk|
33
33
  @disk = disk
@@ -39,7 +39,7 @@ module Getch
39
39
  opts.on("-u", "--username USERNAME", "Initialize /home/username") do |user|
40
40
  @username = user
41
41
  end
42
- opts.on("--encrypt", "Encrypt your filesystem.!! NOT YET READY !!") do
42
+ opts.on("--encrypt", "Encrypt your system with Luks2.") do
43
43
  @encrypt = true
44
44
  end
45
45
  opts.on("--verbose", "Write more messages to the standard output.") do
@@ -1,3 +1,3 @@
1
1
  module Getch
2
- VERSION = '0.0.8'.freeze
2
+ VERSION = '0.0.9'.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.8
4
+ version: 0.0.9
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-30 00:00:00.000000000 Z
38
+ date: 2020-10-03 00:00:00.000000000 Z
39
39
  dependencies: []
40
40
  description:
41
41
  email:
@@ -73,6 +73,13 @@ files:
73
73
  - lib/getch/filesystem/lvm/config.rb
74
74
  - lib/getch/filesystem/lvm/deps.rb
75
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
76
83
  - lib/getch/filesystem/lvm/format.rb
77
84
  - lib/getch/filesystem/lvm/mount.rb
78
85
  - lib/getch/filesystem/lvm/partition.rb
metadata.gz.sig CHANGED
Binary file