getch 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +9 -0
- data/README.md +18 -4
- data/lib/getch.rb +14 -7
- data/lib/getch/command.rb +18 -4
- data/lib/getch/filesystem.rb +5 -0
- data/lib/getch/filesystem/clean.rb +51 -0
- data/lib/getch/filesystem/device.rb +55 -0
- data/lib/getch/filesystem/ext4/config.rb +8 -9
- data/lib/getch/filesystem/ext4/device.rb +2 -7
- data/lib/getch/filesystem/ext4/encrypt/config.rb +9 -9
- data/lib/getch/filesystem/ext4/encrypt/deps.rb +1 -1
- data/lib/getch/filesystem/ext4/encrypt/device.rb +3 -8
- data/lib/getch/filesystem/ext4/encrypt/format.rb +3 -5
- data/lib/getch/filesystem/ext4/encrypt/mount.rb +6 -43
- data/lib/getch/filesystem/ext4/encrypt/partition.rb +19 -38
- data/lib/getch/filesystem/ext4/format.rb +3 -5
- data/lib/getch/filesystem/ext4/mount.rb +7 -46
- data/lib/getch/filesystem/ext4/partition.rb +16 -39
- data/lib/getch/filesystem/lvm/config.rb +5 -5
- data/lib/getch/filesystem/lvm/deps.rb +3 -2
- data/lib/getch/filesystem/lvm/device.rb +23 -7
- data/lib/getch/filesystem/lvm/encrypt/config.rb +3 -3
- data/lib/getch/filesystem/lvm/encrypt/deps.rb +1 -1
- data/lib/getch/filesystem/lvm/encrypt/device.rb +23 -7
- data/lib/getch/filesystem/lvm/encrypt/format.rb +3 -3
- data/lib/getch/filesystem/lvm/encrypt/mount.rb +7 -46
- data/lib/getch/filesystem/lvm/encrypt/partition.rb +19 -31
- data/lib/getch/filesystem/lvm/format.rb +11 -7
- data/lib/getch/filesystem/lvm/mount.rb +7 -46
- data/lib/getch/filesystem/lvm/partition.rb +19 -31
- data/lib/getch/filesystem/mount.rb +56 -0
- data/lib/getch/filesystem/partition.rb +77 -0
- data/lib/getch/filesystem/zfs/config.rb +4 -5
- data/lib/getch/filesystem/zfs/deps.rb +3 -6
- data/lib/getch/filesystem/zfs/device.rb +30 -9
- data/lib/getch/filesystem/zfs/encrypt/config.rb +7 -7
- data/lib/getch/filesystem/zfs/encrypt/deps.rb +2 -6
- data/lib/getch/filesystem/zfs/encrypt/device.rb +30 -9
- data/lib/getch/filesystem/zfs/encrypt/format.rb +84 -1
- data/lib/getch/filesystem/zfs/encrypt/mount.rb +4 -20
- data/lib/getch/filesystem/zfs/encrypt/partition.rb +15 -111
- data/lib/getch/filesystem/zfs/format.rb +84 -2
- data/lib/getch/filesystem/zfs/mount.rb +5 -24
- data/lib/getch/filesystem/zfs/partition.rb +15 -108
- data/lib/getch/gentoo.rb +2 -1
- data/lib/getch/gentoo/boot.rb +2 -2
- data/lib/getch/gentoo/chroot.rb +10 -24
- data/lib/getch/gentoo/config.rb +22 -2
- data/lib/getch/gentoo/sources.rb +11 -11
- data/lib/getch/helpers.rb +13 -0
- data/lib/getch/options.rb +20 -5
- data/lib/getch/version.rb +1 -1
- metadata +6 -2
- metadata.gz.sig +0 -0
@@ -7,54 +7,17 @@ module Getch
|
|
7
7
|
class Mount < Getch::FileSystem::Ext4::Encrypt::Device
|
8
8
|
def initialize
|
9
9
|
super
|
10
|
-
@
|
11
|
-
@boot_dir = "#{@root_dir}/boot"
|
12
|
-
@boot_efi_dir = "#{@root_dir}/boot/efi"
|
13
|
-
@home_dir = @user ? "#{@root_dir}/home/#{@user}" : nil
|
10
|
+
@mount = Getch::FileSystem::Mount.new
|
14
11
|
@state = Getch::States.new()
|
15
12
|
end
|
16
13
|
|
17
14
|
def run
|
18
15
|
return if STATES[:mount]
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
@state.mount
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def mount_swap
|
30
|
-
return if ! @dev_swap
|
31
|
-
system("swapon #{@dev_swap}")
|
32
|
-
end
|
33
|
-
|
34
|
-
def mount_root
|
35
|
-
return if ! @dev_root
|
36
|
-
Dir.mkdir(@root_dir, 0700) if ! Dir.exist?(@root_dir)
|
37
|
-
system("mount #{@luks_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 ! @dev_home
|
54
|
-
if @user != nil then
|
55
|
-
FileUtils.mkdir_p @home_dir, mode: 0700 if ! Dir.exist?(@home_dir)
|
56
|
-
system("mount #{@luks_home} #{@home_dir}")
|
57
|
-
end
|
16
|
+
@mount.swap(@dev_swap)
|
17
|
+
@mount.root(@luks_root)
|
18
|
+
@mount.boot(@dev_boot)
|
19
|
+
@mount.esp(@dev_esp)
|
20
|
+
@mount.home(@luks_home)
|
58
21
|
@state.mount
|
59
22
|
end
|
60
23
|
end
|
@@ -5,15 +5,17 @@ module Getch
|
|
5
5
|
class Partition < Getch::FileSystem::Ext4::Encrypt::Device
|
6
6
|
def initialize
|
7
7
|
super
|
8
|
-
@state = Getch::States.new
|
8
|
+
@state = Getch::States.new
|
9
|
+
@partition = Getch::FileSystem::Partition.new
|
10
|
+
@clean = Getch::FileSystem::Clean
|
9
11
|
@log = Log.new
|
10
12
|
run_partition
|
11
13
|
end
|
12
14
|
|
13
15
|
def run_partition
|
14
16
|
return if STATES[:partition ]
|
15
|
-
|
16
|
-
|
17
|
+
@clean.struct(@disk, @cache_disk, @home_disk)
|
18
|
+
@clean.hdd(@disk, @cache_disk, @home_disk)
|
17
19
|
if Helpers::efi?
|
18
20
|
partition_efi
|
19
21
|
encrypt_efi
|
@@ -26,35 +28,16 @@ module Getch
|
|
26
28
|
|
27
29
|
private
|
28
30
|
|
29
|
-
def clear_struct
|
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
31
|
# Follow https://wiki.archlinux.org/index.php/Partitioning
|
47
32
|
def partition_efi
|
48
|
-
# /
|
49
|
-
#
|
50
|
-
#
|
51
|
-
# /home
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
exec("sgdisk -n3:0:+#{mem} -t3:8200 /dev/#{@disk}")
|
57
|
-
exec("sgdisk -n4:0:0 -t4:8309 /dev/#{@disk}") if @dev_home
|
33
|
+
# /efi - EFI system partition - 260MB
|
34
|
+
# swap - Linux Swap - size of the ram
|
35
|
+
# / - Root
|
36
|
+
# /home - Home
|
37
|
+
@partition.efi(@dev_esp)
|
38
|
+
@partition.swap(@dev_swap)
|
39
|
+
@partition.root(@dev_root, "8309")
|
40
|
+
@partition.home(@dev_home, "8309") if @dev_home
|
58
41
|
end
|
59
42
|
|
60
43
|
def encrypt_efi
|
@@ -90,20 +73,18 @@ module Getch
|
|
90
73
|
key_name = "crypto_keyfile.bin"
|
91
74
|
@key_path = "#{keys_dir}/#{key_name}"
|
92
75
|
FileUtils.mkdir keys_dir, mode: 0700 if ! Dir.exist?(keys_dir)
|
93
|
-
|
76
|
+
exec("dd bs=512 count=4 if=/dev/urandom of=#{@key_path}")
|
94
77
|
end
|
95
78
|
|
96
79
|
def partition_bios
|
97
80
|
# None - Bios Boot Partition - 1MiB
|
98
|
-
# / - Root
|
99
81
|
# swap - Linux Swap - size of the ram
|
82
|
+
# / - Root
|
100
83
|
# /home - Home
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
exec("sgdisk -n3:0:+#{mem} -t3:8200 /dev/#{@disk}")
|
106
|
-
exec("sgdisk -n4:0:0 -t4:8309 /dev/#{@disk}") if @dev_home
|
84
|
+
@partition.gpt(@dev_gpt)
|
85
|
+
@partition.swap(@dev_swap)
|
86
|
+
@partition.root(@dev_root, "8309")
|
87
|
+
@partition.home(@dev_home, "8309") if @dev_home
|
107
88
|
end
|
108
89
|
|
109
90
|
def exec(cmd)
|
@@ -4,18 +4,16 @@ module Getch
|
|
4
4
|
class Format < Getch::FileSystem::Ext4::Device
|
5
5
|
def initialize
|
6
6
|
super
|
7
|
-
@fs = 'ext4'
|
8
7
|
@state = Getch::States.new()
|
9
8
|
format
|
10
9
|
end
|
11
10
|
|
12
11
|
def format
|
13
12
|
return if STATES[:format]
|
14
|
-
|
15
|
-
exec("mkfs.fat -F32 #{@dev_boot_efi}") if Helpers::efi?
|
13
|
+
exec("mkfs.fat -F32 #{@dev_esp}") if @dev_esp
|
16
14
|
exec("mkswap -f #{@dev_swap}")
|
17
|
-
exec("mkfs
|
18
|
-
exec("mkfs
|
15
|
+
exec("mkfs.ext4 -F #{@dev_root}")
|
16
|
+
exec("mkfs.ext4 -F #{@dev_home}") if @dev_home
|
19
17
|
@state.format
|
20
18
|
end
|
21
19
|
|
@@ -1,59 +1,20 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
1
|
module Getch
|
4
2
|
module FileSystem
|
5
3
|
module Ext4
|
6
4
|
class Mount < Getch::FileSystem::Ext4::Device
|
7
5
|
def initialize
|
8
6
|
super
|
9
|
-
@
|
10
|
-
@
|
11
|
-
@boot_efi_dir = "#{@root_dir}/boot/efi"
|
12
|
-
@home_dir = @user ? "#{@root_dir}/home/#{@user}" : nil
|
13
|
-
@state = Getch::States.new()
|
7
|
+
@mount = Getch::FileSystem::Mount.new
|
8
|
+
@state = Getch::States.new
|
14
9
|
end
|
15
10
|
|
16
11
|
def run
|
17
12
|
return if STATES[:mount]
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
@state.mount
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def mount_swap
|
29
|
-
return if ! @dev_swap
|
30
|
-
system("swapon #{@dev_swap}")
|
31
|
-
end
|
32
|
-
|
33
|
-
def mount_root
|
34
|
-
return if ! @dev_root
|
35
|
-
Dir.mkdir(@root_dir, 0700) if ! Dir.exist?(@root_dir)
|
36
|
-
system("mount #{@dev_root} #{@root_dir}")
|
37
|
-
end
|
38
|
-
|
39
|
-
def mount_boot_efi
|
40
|
-
return if ! @dev_boot_efi
|
41
|
-
FileUtils.mkdir_p @boot_efi_dir, mode: 0700 if ! Dir.exist?(@boot_efi_dir)
|
42
|
-
system("mount #{@dev_boot_efi} #{@boot_efi_dir}")
|
43
|
-
end
|
44
|
-
|
45
|
-
def mount_boot
|
46
|
-
return if ! @dev_boot
|
47
|
-
FileUtils.mkdir_p @boot_dir, mode: 0700 if ! Dir.exist?(@boot_dir)
|
48
|
-
system("mount #{@dev_boot} #{@boot_dir}")
|
49
|
-
end
|
50
|
-
|
51
|
-
def mount_home
|
52
|
-
return if ! @dev_home
|
53
|
-
if @user != nil then
|
54
|
-
FileUtils.mkdir_p @home_dir, mode: 0700 if ! Dir.exist?(@home_dir)
|
55
|
-
system("mount #{@dev_home} #{@home_dir}")
|
56
|
-
end
|
13
|
+
@mount.swap(@dev_swap)
|
14
|
+
@mount.root(@dev_root)
|
15
|
+
@mount.boot(@dev_boot)
|
16
|
+
@mount.esp(@dev_esp)
|
17
|
+
@mount.home(@dev_home)
|
57
18
|
@state.mount
|
58
19
|
end
|
59
20
|
end
|
@@ -5,13 +5,15 @@ module Getch
|
|
5
5
|
def initialize
|
6
6
|
super
|
7
7
|
@state = Getch::States.new()
|
8
|
+
@clean = Getch::FileSystem::Clean
|
9
|
+
@partition = Getch::FileSystem::Partition.new
|
8
10
|
run_partition
|
9
11
|
end
|
10
12
|
|
11
13
|
def run_partition
|
12
14
|
return if STATES[:partition ]
|
13
|
-
|
14
|
-
|
15
|
+
@clean.struct(@disk, @cache_disk, @home_disk)
|
16
|
+
@clean.hdd(@disk, @cache_disk, @home_disk)
|
15
17
|
if Helpers::efi?
|
16
18
|
partition_efi
|
17
19
|
else
|
@@ -22,35 +24,16 @@ module Getch
|
|
22
24
|
|
23
25
|
private
|
24
26
|
|
25
|
-
def clear_struct
|
26
|
-
exec("sgdisk -Z /dev/#{@disk}")
|
27
|
-
exec("wipefs -a /dev/#{@disk}")
|
28
|
-
end
|
29
|
-
|
30
|
-
def cleaning
|
31
|
-
puts
|
32
|
-
print "Cleaning data on #{@disk}, can be long, avoid this on Flash Memory (SSD,USB,...) ? (n,y) "
|
33
|
-
case gets.chomp
|
34
|
-
when /^y|^Y/
|
35
|
-
bloc=`blockdev --getbsz /dev/#{@disk}`.chomp
|
36
|
-
exec("dd if=/dev/urandom of=/dev/#{@disk} bs=#{bloc} status=progress")
|
37
|
-
else
|
38
|
-
return
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
27
|
# Follow https://wiki.archlinux.org/index.php/Partitioning
|
43
28
|
def partition_efi
|
44
|
-
# /
|
45
|
-
#
|
46
|
-
#
|
47
|
-
# /home
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
exec("sgdisk -n3:0:+#{mem} -t3:8200 /dev/#{@disk}")
|
53
|
-
exec("sgdisk -n4:0:0 -t4:8302 /dev/#{@disk}") if @dev_home
|
29
|
+
# /efi - EFI system partition - 260MB
|
30
|
+
# swap - Linux Swap - size of the ram
|
31
|
+
# / - Root
|
32
|
+
# /home - Home
|
33
|
+
@partition.efi(@dev_esp)
|
34
|
+
@partition.swap(@dev_swap)
|
35
|
+
@partition.root(@dev_root, "8304")
|
36
|
+
@partition.home(@dev_home, "8302") if @dev_home
|
54
37
|
end
|
55
38
|
|
56
39
|
def partition_bios
|
@@ -58,16 +41,10 @@ module Getch
|
|
58
41
|
# / - Root
|
59
42
|
# swap - Linux Swap - size of the ram
|
60
43
|
# /home - Home
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
exec("sgdisk -n3:0:+#{mem} -t3:8200 /dev/#{@disk}")
|
66
|
-
exec("sgdisk -n4:0:0 -t4:8302 /dev/#{@disk}") if @dev_home
|
67
|
-
end
|
68
|
-
|
69
|
-
def exec(cmd)
|
70
|
-
Getch::Command.new(cmd).run!
|
44
|
+
@partition.gpt(@dev_gpt)
|
45
|
+
@partition.swap(@dev_swap)
|
46
|
+
@partition.root(@dev_root, "8304")
|
47
|
+
@partition.home(@dev_home, "8302") if @dev_home
|
71
48
|
end
|
72
49
|
end
|
73
50
|
end
|
@@ -16,8 +16,8 @@ module Getch
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def systemd_boot
|
19
|
-
return if !
|
20
|
-
esp = '/
|
19
|
+
return if ! @efi
|
20
|
+
esp = '/efi'
|
21
21
|
dir = "#{@root_dir}/#{esp}/loader/entries/"
|
22
22
|
datas_gentoo = [
|
23
23
|
'title Gentoo Linux',
|
@@ -44,18 +44,18 @@ module Getch
|
|
44
44
|
@uuid_root = `lsblk -o "UUID" #{@lv_root} | tail -1`.chomp() if @lv_root
|
45
45
|
@uuid_dev_root = `lsblk -o "UUID" #{@dev_root} | tail -1`.chomp() if @dev_root
|
46
46
|
@uuid_boot = `lsblk -o "UUID" #{@dev_boot} | tail -1`.chomp() if @dev_boot
|
47
|
-
@
|
47
|
+
@uuid_esp = `lsblk -o "UUID" #{@dev_esp} | tail -1`.chomp() if @dev_esp
|
48
48
|
@uuid_home = `lsblk -o "UUID" #{@lv_home} | tail -1`.chomp() if @lv_home
|
49
49
|
end
|
50
50
|
|
51
51
|
def data_fstab
|
52
|
-
|
52
|
+
efi = @dev_esp ? "UUID=#{@uuid_esp} /efi vfat noauto,noatime 1 2" : ''
|
53
53
|
boot = @dev_boot ? "UUID=#{@uuid_boot} /boot ext4 noauto,noatime 1 2" : ''
|
54
54
|
swap = @lv_swap ? "UUID=#{@uuid_swap} none swap discard 0 0" : ''
|
55
55
|
root = @lv_root ? "UUID=#{@uuid_root} / ext4 defaults 0 1" : ''
|
56
56
|
home = @lv_home ? "UUID=#{@uuid_home} /home/#{@user} ext4 defaults 0 2" : ''
|
57
57
|
|
58
|
-
[
|
58
|
+
[ efi, boot, swap, root, home ]
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
@@ -42,9 +42,10 @@ module Getch
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def install_deps
|
45
|
-
|
45
|
+
make_conf = "#{MOUNTPOINT}/etc/portage/make.conf"
|
46
|
+
exec("euse -E lvm") if ! Helpers::grep?(make_conf, /lvm/)
|
46
47
|
Getch::Emerge.new('genkernel lvm2').pkg!
|
47
|
-
Getch::
|
48
|
+
Getch::Bask.new('-a lvm').run!
|
48
49
|
exec("systemctl enable lvm2-monitor")
|
49
50
|
end
|
50
51
|
|
@@ -1,17 +1,33 @@
|
|
1
1
|
module Getch
|
2
2
|
module FileSystem
|
3
3
|
module Lvm
|
4
|
-
class Device
|
4
|
+
class Device < Getch::FileSystem::Device
|
5
5
|
def initialize
|
6
|
-
|
7
|
-
@user = DEFAULT_OPTIONS[:username]
|
8
|
-
@dev_boot_efi = Helpers::efi? ? "/dev/#{@disk}1" : nil
|
9
|
-
@dev_boot = Helpers::efi? ? nil : "/dev/#{@disk}2"
|
10
|
-
@dev_root = Helpers::efi? ? "/dev/#{@disk}2" : "/dev/#{@disk}3"
|
6
|
+
super
|
11
7
|
@vg = 'vg0'
|
12
8
|
@lv_root = "/dev/mapper/#{@vg}-root"
|
13
9
|
@lv_swap = "/dev/mapper/#{@vg}-swap"
|
14
|
-
@lv_home = @
|
10
|
+
@lv_home = @home_disk ? "/dev/mapper/#{@vg}-home" : nil
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def search_boot
|
16
|
+
if @boot_disk
|
17
|
+
@dev_gpt = @efi ? nil : "/dev/#{@boot_disk}1"
|
18
|
+
@dev_boot = @efi ? nil : "/dev/#{@boot_disk}2"
|
19
|
+
@dev_esp = @efi ? "/dev/#{@boot_disk}1" : nil
|
20
|
+
else
|
21
|
+
@dev_gpt = @efi ? nil : "/dev/#{@disk}1"
|
22
|
+
@dev_boot = @efi ? nil : "/dev/#{@disk}2"
|
23
|
+
@dev_esp = @efi ? "/dev/#{@disk}1" : nil
|
24
|
+
@root_part += 1
|
25
|
+
@root_part += 1 if ! @efi
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# The swap is a part of the LVM volume, so we clean the func
|
30
|
+
def search_swap
|
15
31
|
end
|
16
32
|
end
|
17
33
|
end
|
@@ -19,7 +19,7 @@ module Getch
|
|
19
19
|
|
20
20
|
def systemd_boot
|
21
21
|
return if ! Helpers::efi?
|
22
|
-
esp = '/
|
22
|
+
esp = '/efi'
|
23
23
|
dir = "#{@root_dir}/#{esp}/loader/entries/"
|
24
24
|
datas_gentoo = [
|
25
25
|
'title Gentoo Linux',
|
@@ -54,12 +54,12 @@ module Getch
|
|
54
54
|
@uuid_root = `lsblk -d -o "UUID" #{@lv_root} | tail -1`.chomp() if @lv_root
|
55
55
|
@uuid_dev_root = `lsblk -d -o "UUID" #{@dev_root} | tail -1`.chomp() if @dev_root
|
56
56
|
@uuid_boot = `lsblk -o "UUID" #{@dev_boot} | tail -1`.chomp() if @dev_boot
|
57
|
-
@
|
57
|
+
@uuid_esp = `lsblk -o "UUID" #{@dev_esp} | tail -1`.chomp() if @dev_esp
|
58
58
|
@uuid_home = `lsblk -o "UUID" #{@lv_home} | tail -1`.chomp() if @lv_home
|
59
59
|
end
|
60
60
|
|
61
61
|
def data_fstab
|
62
|
-
boot_efi = @
|
62
|
+
boot_efi = @dev_esp ? "UUID=#{@uuid_esp} /efi vfat noauto,noatime 1 2" : ''
|
63
63
|
boot = @dev_boot ? "UUID=#{@uuid_boot} /boot ext4 noauto,noatime 1 2" : ''
|
64
64
|
swap = @lv_swap ? "/dev/mapper/cryptswap none swap discard 0 0" : ''
|
65
65
|
root = @lv_root ? "UUID=#{@uuid_root} / ext4 defaults 0 1" : ''
|
@@ -49,7 +49,7 @@ module Getch
|
|
49
49
|
exec("euse -E lvm") if ! Helpers::grep?(make_conf, /lvm/)
|
50
50
|
exec("euse -E cryptsetup") if ! Helpers::grep?(make_conf, /cryptsetup/)
|
51
51
|
Getch::Emerge.new('genkernel systemd sys-fs/cryptsetup lvm2').pkg!
|
52
|
-
Getch::
|
52
|
+
Getch::Bask.new('-a lvm').run!
|
53
53
|
exec("systemctl enable lvm2-monitor")
|
54
54
|
end
|
55
55
|
|
@@ -2,18 +2,34 @@ module Getch
|
|
2
2
|
module FileSystem
|
3
3
|
module Lvm
|
4
4
|
module Encrypt
|
5
|
-
class Device
|
5
|
+
class Device < Getch::FileSystem::Device
|
6
6
|
def initialize
|
7
|
-
|
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"
|
7
|
+
super
|
12
8
|
@vg = 'vg0'
|
13
9
|
@lv_root = "/dev/mapper/#{@vg}-root"
|
14
10
|
@lv_swap = "/dev/mapper/#{@vg}-swap"
|
15
|
-
@lv_home = @
|
11
|
+
@lv_home = @home_disk ? "/dev/mapper/#{@vg}-home" : nil
|
16
12
|
@luks_root = "/dev/mapper/cryptroot"
|
13
|
+
@luks_home = @home_disk ? "/dev/mapper/crypthome" : nil
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def search_boot
|
19
|
+
if @boot_disk
|
20
|
+
@dev_gpt = @efi ? nil : "/dev/#{@boot_disk}1"
|
21
|
+
@dev_boot = @efi ? nil : "/dev/#{@boot_disk}2"
|
22
|
+
@dev_esp = @efi ? "/dev/#{@boot_disk}1" : nil
|
23
|
+
else
|
24
|
+
@dev_gpt = @efi ? nil : "/dev/#{@disk}1"
|
25
|
+
@dev_boot = @efi ? nil : "/dev/#{@disk}2"
|
26
|
+
@dev_esp = @efi ? "/dev/#{@disk}1" : nil
|
27
|
+
@root_part += 1
|
28
|
+
@root_part += 1 if ! @efi
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def search_swap
|
17
33
|
end
|
18
34
|
end
|
19
35
|
end
|