getch 0.1.1 → 0.1.2
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 +11 -0
- data/README.md +21 -5
- data/lib/getch/filesystem/device.rb +15 -9
- data/lib/getch/filesystem/ext4/encrypt/deps.rb +2 -11
- data/lib/getch/filesystem/lvm/config.rb +2 -2
- data/lib/getch/filesystem/lvm/deps.rb +2 -12
- data/lib/getch/filesystem/lvm/device.rb +17 -9
- data/lib/getch/filesystem/lvm/encrypt/config.rb +1 -1
- data/lib/getch/filesystem/lvm/encrypt/deps.rb +2 -12
- data/lib/getch/filesystem/lvm/encrypt/device.rb +17 -9
- data/lib/getch/filesystem/zfs/deps.rb +10 -0
- data/lib/getch/filesystem/zfs/device.rb +27 -9
- data/lib/getch/filesystem/zfs/encrypt/config.rb +1 -1
- data/lib/getch/filesystem/zfs/encrypt/deps.rb +10 -0
- data/lib/getch/filesystem/zfs/encrypt/device.rb +27 -9
- data/lib/getch/filesystem/zfs/encrypt/format.rb +2 -2
- data/lib/getch/filesystem/zfs/encrypt/partition.rb +10 -0
- data/lib/getch/filesystem/zfs/format.rb +16 -4
- data/lib/getch/filesystem/zfs/partition.rb +10 -0
- data/lib/getch/gentoo.rb +0 -1
- data/lib/getch/gentoo/boot.rb +1 -6
- data/lib/getch/gentoo/chroot.rb +1 -0
- data/lib/getch/gentoo/config.rb +4 -6
- data/lib/getch/gentoo/sources.rb +0 -4
- data/lib/getch/version.rb +1 -1
- metadata +18 -18
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 476822c82abc15e37ab19b3e111b4b4109beb127fb775a9075757948c9e202a4
|
4
|
+
data.tar.gz: 1a2290c23d28c9fb0fa45ac47882698ad4f61dfe10f699804ab53162ea337e00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b299fd1b7b9daa4be76a482ed768e85c2372c847a7f18e4ffaebf173d8d80fddbfe9b4fccc42f3037e51d53751acaf7d12f26e87b7e68fad385d280223c8471
|
7
|
+
data.tar.gz: 2e97a961aaa0e8a5380fa61f1dafaa958d8941287d2c16e6d493038e6bb52f94153aeb35d5762f1b8347eef8f85f0be496ca372fac6ff070caaf03b94c237b0e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## 0.1.2, release 2021-05-12
|
2
|
+
* DOCS update.
|
3
|
+
* Keep Nano for those who need :)
|
4
|
+
* ZFS use the last version >=2.0 with kernel stable =5.10
|
5
|
+
* ZFS create a Log device and Cache device if getch is used with `--separate-cache`.
|
6
|
+
* GRUB or Systemd-boot can now be installed on separate disk with `--separate-boot`.
|
7
|
+
* Adding flag for ZFS `-o autotrim=on` (used with `zpool create`).
|
8
|
+
* Encrypted swap use: `cipher=aes-xts-plain64:sha256,size=512` by default.
|
9
|
+
* In the make.conf: add `-fomit-frame-pointer`, designed to reduce generated code size.
|
10
|
+
|
11
|
+
## 0.1.1, release 2020-11-01
|
1
12
|
* Change mountpoint for the esp at /efi rather than /boot/efi
|
2
13
|
* Replace Garden by Bask https://github.com/szorfein/bask
|
3
14
|
* Correct option --username USERNAME, do not create a new partition.
|
data/README.md
CHANGED
@@ -3,7 +3,6 @@ A CLI tool to install Gentoo.
|
|
3
3
|
|
4
4
|
## Description
|
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
|
-
It also require a disk (only one for now) with a minimum of 20G.
|
7
6
|
|
8
7
|
BIOS system will use `Grub2` and `systemd-boot` for UEFI. Filesystem supported by Getch are for now:
|
9
8
|
+ Ext4
|
@@ -29,6 +28,12 @@ When you boot from an `iso`, you can install `ruby`, `getch` and correct your `P
|
|
29
28
|
# sh <(curl -L https://raw.githubusercontent.com/szorfein/getch/master/bin/setup.sh)
|
30
29
|
# source ~/.zshrc # or ~/.bashrc
|
31
30
|
|
31
|
+
If you want to try the master branch:
|
32
|
+
|
33
|
+
# git clone https://github.com/szorfein/getch
|
34
|
+
# cd getch
|
35
|
+
# ruby -I lib bin/getch -h
|
36
|
+
|
32
37
|
## Usage
|
33
38
|
Just ensure than the script is run with a root account.
|
34
39
|
|
@@ -60,19 +65,30 @@ With ZFS:
|
|
60
65
|
## Troubleshooting
|
61
66
|
|
62
67
|
#### LVM
|
63
|
-
Unless your old LVM volume group is also named `vg0`, `getch` may fail to partition your disk. You have to clean up your device before proceed with `vgremove` and `pvremove`.
|
68
|
+
Unless your old LVM volume group is also named `vg0`, `getch` may fail to partition your disk. You have to clean up your device before proceed with `vgremove` and `pvremove`. An short example how doing this with a volume group named `vg0`:
|
69
|
+
|
70
|
+
# vgdisplay | grep vg0
|
71
|
+
# vgremove -f vg0
|
72
|
+
# pvremove -f /dev/sdb
|
64
73
|
|
65
74
|
#### Encryption enable on BIOS with ext4
|
66
75
|
To decrypt your disk on BIOS system, you have to enter your password two times. One time for Grub and another time for the initramfs (Genkernel). [post](https://wiki.archlinux.org/index.php/GRUB#Encrypted_/boot).
|
67
76
|
Also with GRUB, only a `us` keymap is working.
|
68
77
|
|
69
78
|
#### With ZFS
|
70
|
-
When
|
79
|
+
When Gentoo boot, the pool may fail to start, it's happen when the pool has not been `export` to the ISO. So just reboot on your ISO:
|
80
|
+
|
81
|
+
You need the partuuid, pool are create with the first 5 characters, just replace `sdX` by your real device:
|
82
|
+
|
83
|
+
# ls -l /dev/disk/by-partuuid/ | grep sdX4
|
84
|
+
-> 150ed969...
|
85
|
+
# zpool import -N -R /mnt rpool-150ed
|
86
|
+
|
87
|
+
And export them correctly:
|
71
88
|
|
72
|
-
# zpool import -N -R /mnt zpool
|
73
89
|
# zpool export -a
|
74
90
|
|
75
|
-
|
91
|
+
It's all.
|
76
92
|
|
77
93
|
## Issues
|
78
94
|
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:
|
@@ -19,14 +19,22 @@ module Getch
|
|
19
19
|
|
20
20
|
private
|
21
21
|
def search_boot
|
22
|
-
if @
|
23
|
-
|
24
|
-
|
22
|
+
if @efi
|
23
|
+
if @boot_disk
|
24
|
+
@dev_esp = "/dev/#{@boot_disk}#{@root_part}"
|
25
|
+
else
|
26
|
+
@dev_esp = "/dev/#{@disk}#{@root_part}"
|
27
|
+
@root_part += 1
|
28
|
+
end
|
25
29
|
else
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
+
if @boot_disk
|
31
|
+
@dev_gpt = "/dev/#{@boot_disk}#{@root_part}"
|
32
|
+
@dev_grub = "/dev/#{@boot_disk}"
|
33
|
+
else
|
34
|
+
@dev_gpt = "/dev/#{@disk}#{@root_part}"
|
35
|
+
@dev_grub = "/dev/#{@disk}"
|
36
|
+
@root_part += 1
|
37
|
+
end
|
30
38
|
end
|
31
39
|
end
|
32
40
|
|
@@ -46,8 +54,6 @@ module Getch
|
|
46
54
|
def search_home
|
47
55
|
if @home_disk
|
48
56
|
@dev_home = "/dev/#{@home_disk}1"
|
49
|
-
else
|
50
|
-
@dev_home = nil
|
51
57
|
end
|
52
58
|
end
|
53
59
|
end
|
@@ -3,23 +3,14 @@ module Getch
|
|
3
3
|
module Ext4
|
4
4
|
module Encrypt
|
5
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
6
|
def make
|
7
|
+
install_bios unless Helpers::efi?
|
8
|
+
install_deps
|
16
9
|
genkernel
|
17
10
|
Getch::Make.new("genkernel --kernel-config=/usr/src/linux/.config all").run!
|
18
11
|
end
|
19
12
|
|
20
13
|
private
|
21
|
-
def install_efi
|
22
|
-
end
|
23
14
|
|
24
15
|
def genkernel
|
25
16
|
grub = Helpers::efi? ? 'BOOTLOADER="no"' : 'BOOTLOADER="grub2"'
|
@@ -16,7 +16,7 @@ module Getch
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def systemd_boot
|
19
|
-
return if
|
19
|
+
return if !@efi
|
20
20
|
esp = '/efi'
|
21
21
|
dir = "#{@root_dir}/#{esp}/loader/entries/"
|
22
22
|
datas_gentoo = [
|
@@ -29,7 +29,7 @@ module Getch
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def grub
|
32
|
-
return if
|
32
|
+
return if @efi
|
33
33
|
file = "#{@root_dir}/etc/default/grub"
|
34
34
|
cmdline = [
|
35
35
|
"GRUB_CMDLINE_LINUX=\"resume=UUID=#{@uuid_swap} root=UUID=#{@uuid_root} init=#{@init} dolvm rw\""
|
@@ -2,16 +2,9 @@ module Getch
|
|
2
2
|
module FileSystem
|
3
3
|
module Lvm
|
4
4
|
class Deps
|
5
|
-
def initialize
|
6
|
-
if Helpers::efi?
|
7
|
-
install_efi
|
8
|
-
else
|
9
|
-
install_bios
|
10
|
-
end
|
11
|
-
install_deps
|
12
|
-
end
|
13
|
-
|
14
5
|
def make
|
6
|
+
install_bios unless Helpers::efi?
|
7
|
+
install_deps
|
15
8
|
options_make
|
16
9
|
Getch::Make.new("genkernel --kernel-config=/usr/src/linux/.config all").run!
|
17
10
|
end
|
@@ -34,9 +27,6 @@ module Getch
|
|
34
27
|
File.write(file, datas.join("\n"), mode: 'a')
|
35
28
|
end
|
36
29
|
|
37
|
-
def install_efi
|
38
|
-
end
|
39
|
-
|
40
30
|
def install_bios
|
41
31
|
exec("euse -p sys-boot/grub -E device-mapper")
|
42
32
|
end
|
@@ -13,16 +13,24 @@ module Getch
|
|
13
13
|
private
|
14
14
|
|
15
15
|
def search_boot
|
16
|
-
if @
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
if @efi
|
17
|
+
if @boot_disk
|
18
|
+
@dev_esp = "/dev/#{@boot_disk}1"
|
19
|
+
else
|
20
|
+
@dev_esp = "/dev/#{@disk}1"
|
21
|
+
@root_part += 1
|
22
|
+
end
|
20
23
|
else
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
if @boot_disk
|
25
|
+
@dev_gpt = "/dev/#{@boot_disk}1"
|
26
|
+
@dev_boot = "/dev/#{@boot_disk}2"
|
27
|
+
@dev_grub = "/dev/#{@boot_disk}"
|
28
|
+
else
|
29
|
+
@dev_gpt = "/dev/#{@disk}1"
|
30
|
+
@dev_boot = "/dev/#{@disk}2"
|
31
|
+
@dev_grub = "/dev/#{@disk}"
|
32
|
+
@root_part += 2
|
33
|
+
end
|
26
34
|
end
|
27
35
|
end
|
28
36
|
|
@@ -32,7 +32,7 @@ module Getch
|
|
32
32
|
|
33
33
|
def crypttab
|
34
34
|
datas = [
|
35
|
-
"cryptswap #{@lv_swap} /dev/urandom swap,cipher=aes-xts-plain64:sha256,size=
|
35
|
+
"cryptswap #{@lv_swap} /dev/urandom swap,cipher=aes-xts-plain64:sha256,size=512"
|
36
36
|
]
|
37
37
|
File.write("#{@root_dir}/etc/crypttab", datas.join("\n"))
|
38
38
|
end
|
@@ -3,16 +3,9 @@ module Getch
|
|
3
3
|
module Lvm
|
4
4
|
module Encrypt
|
5
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
6
|
def make
|
7
|
+
install_bios unless Helpers::efi?
|
8
|
+
install_deps
|
16
9
|
options_make
|
17
10
|
Getch::Make.new("genkernel --kernel-config=/usr/src/linux/.config all").run!
|
18
11
|
end
|
@@ -37,9 +30,6 @@ module Getch
|
|
37
30
|
File.write(file, datas.join("\n"), mode: 'a')
|
38
31
|
end
|
39
32
|
|
40
|
-
def install_efi
|
41
|
-
end
|
42
|
-
|
43
33
|
def install_bios
|
44
34
|
exec("euse -p sys-boot/grub -E device-mapper")
|
45
35
|
end
|
@@ -16,16 +16,24 @@ module Getch
|
|
16
16
|
private
|
17
17
|
|
18
18
|
def search_boot
|
19
|
-
if @
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
if @efi
|
20
|
+
if @boot_disk
|
21
|
+
@dev_esp = "/dev/#{@boot_disk}1"
|
22
|
+
else
|
23
|
+
@dev_esp = "/dev/#{@disk}1"
|
24
|
+
@root_part += 1
|
25
|
+
end
|
23
26
|
else
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
if @boot_disk
|
28
|
+
@dev_gpt = "/dev/#{@boot_disk}1"
|
29
|
+
@dev_boot = "/dev/#{@boot_disk}2"
|
30
|
+
@dev_grub = "/dev/#{@boot_disk}"
|
31
|
+
else
|
32
|
+
@dev_gpt = "/dev/#{@disk}1"
|
33
|
+
@dev_boot = "/dev/#{@disk}2"
|
34
|
+
@dev_grub = "/dev/#{@disk}"
|
35
|
+
@root_part += 2
|
36
|
+
end
|
29
37
|
end
|
30
38
|
end
|
31
39
|
|
@@ -3,6 +3,7 @@ module Getch
|
|
3
3
|
module Zfs
|
4
4
|
class Deps < Getch::FileSystem::Zfs::Device
|
5
5
|
def make
|
6
|
+
unstable_zfs
|
6
7
|
install_deps
|
7
8
|
zfs_mountpoint
|
8
9
|
auto_module_rebuild
|
@@ -13,6 +14,15 @@ module Getch
|
|
13
14
|
|
14
15
|
private
|
15
16
|
|
17
|
+
def unstable_zfs
|
18
|
+
conf = "#{MOUNTPOINT}/etc/portage/package.accept_keywords/zfs"
|
19
|
+
data = [
|
20
|
+
"sys-fs/zfs-kmod",
|
21
|
+
"sys-fs/zfs"
|
22
|
+
]
|
23
|
+
File.write(conf, data.join("\n"), mode: "w")
|
24
|
+
end
|
25
|
+
|
16
26
|
def install_deps
|
17
27
|
exec("euse -E libzfs") if ! Helpers::grep?("#{MOUNTPOINT}/etc/portage/make.conf", /libzfs/)
|
18
28
|
exec("euse -E rootfs") if ! Helpers::grep?("#{MOUNTPOINT}/etc/portage/make.conf", /rootfs/)
|
@@ -13,17 +13,35 @@ module Getch
|
|
13
13
|
private
|
14
14
|
|
15
15
|
def search_boot
|
16
|
-
if @
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
if @efi
|
17
|
+
if @boot_disk
|
18
|
+
@dev_esp = "/dev/#{@boot_disk}1"
|
19
|
+
else
|
20
|
+
@dev_esp = "/dev/#{@disk}1"
|
21
|
+
@root_part += 1
|
22
|
+
end
|
20
23
|
else
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
+
if @boot_disk
|
25
|
+
@dev_gpt = "/dev/#{@boot_disk}1"
|
26
|
+
@dev_boot = "/dev/#{@boot_disk}2"
|
27
|
+
@dev_grub = "/dev/#{@boot_disk}"
|
28
|
+
else
|
29
|
+
@dev_gpt = "/dev/#{@disk}1"
|
30
|
+
@dev_boot = "/dev/#{@disk}2"
|
31
|
+
@dev_grub = "/dev/#{@disk}"
|
32
|
+
@root_part += 2
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def search_swap
|
38
|
+
if @cache_disk
|
39
|
+
@dev_swap = "/dev/#{@cache_disk}1"
|
40
|
+
@dev_log = "/dev/#{@cache_disk}2"
|
41
|
+
@dev_cache = "/dev/#{@cache_disk}3"
|
42
|
+
else
|
43
|
+
@dev_swap = "/dev/#{@disk}#{@root_part}"
|
24
44
|
@root_part += 1
|
25
|
-
@dev_boot = @efi ? nil : "/dev/#{@disk}#{@root_part}"
|
26
|
-
@root_part += 1 if ! @efi
|
27
45
|
end
|
28
46
|
end
|
29
47
|
|
@@ -32,7 +32,7 @@ module Getch
|
|
32
32
|
|
33
33
|
def crypttab
|
34
34
|
datas = [
|
35
|
-
"cryptswap PARTUUID=#{@partuuid_swap} /dev/urandom swap,cipher=aes-xts-plain64:sha256,size=
|
35
|
+
"cryptswap PARTUUID=#{@partuuid_swap} /dev/urandom swap,cipher=aes-xts-plain64:sha256,size=512"
|
36
36
|
]
|
37
37
|
File.write("#{@root_dir}/etc/crypttab", datas.join("\n"))
|
38
38
|
end
|
@@ -4,6 +4,7 @@ module Getch
|
|
4
4
|
module Encrypt
|
5
5
|
class Deps < Getch::FileSystem::Zfs::Encrypt::Device
|
6
6
|
def make
|
7
|
+
unstable_zfs
|
7
8
|
install_deps
|
8
9
|
zfs_mountpoint
|
9
10
|
auto_module_rebuild
|
@@ -13,6 +14,15 @@ module Getch
|
|
13
14
|
end
|
14
15
|
|
15
16
|
private
|
17
|
+
def unstable_zfs
|
18
|
+
conf = "#{MOUNTPOINT}/etc/portage/package.accept_keywords/zfs"
|
19
|
+
data = [
|
20
|
+
"sys-fs/zfs-kmod",
|
21
|
+
"sys-fs/zfs"
|
22
|
+
]
|
23
|
+
File.write(conf, data.join("\n"), mode: "w")
|
24
|
+
end
|
25
|
+
|
16
26
|
def install_deps
|
17
27
|
exec("euse -E libzfs") if ! Helpers::grep?("#{MOUNTPOINT}/etc/portage/make.conf", /libzfs/)
|
18
28
|
exec("euse -E rootfs") if ! Helpers::grep?("#{MOUNTPOINT}/etc/portage/make.conf", /rootfs/)
|
@@ -14,17 +14,35 @@ module Getch
|
|
14
14
|
private
|
15
15
|
|
16
16
|
def search_boot
|
17
|
-
if @
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
if @efi
|
18
|
+
if @boot_disk
|
19
|
+
@dev_esp = "/dev/#{@boot_disk}1"
|
20
|
+
else
|
21
|
+
@dev_esp = "/dev/#{@disk}1"
|
22
|
+
@root_part += 1
|
23
|
+
end
|
21
24
|
else
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
+
if @boot_disk
|
26
|
+
@dev_gpt = "/dev/#{@boot_disk}1"
|
27
|
+
@dev_boot = "/dev/#{@boot_disk}2"
|
28
|
+
@dev_grub = "/dev/#{@boot_disk}"
|
29
|
+
else
|
30
|
+
@dev_gpt = "/dev/#{@disk}1"
|
31
|
+
@dev_boot = "/dev/#{@disk}2"
|
32
|
+
@dev_grub = "/dev/#{@disk}"
|
33
|
+
@root_part += 2
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def search_swap
|
39
|
+
if @cache_disk
|
40
|
+
@dev_swap = "/dev/#{@cache_disk}1"
|
41
|
+
@dev_log = "/dev/#{@cache_disk}2"
|
42
|
+
@dev_cache = "/dev/#{@cache_disk}3"
|
43
|
+
else
|
44
|
+
@dev_swap = "/dev/#{@disk}#{@root_part}"
|
25
45
|
@root_part += 1
|
26
|
-
@dev_boot = @efi ? nil : "/dev/#{@disk}#{@root_part}"
|
27
|
-
@root_part += 1 if ! @efi
|
28
46
|
end
|
29
47
|
end
|
30
48
|
|
@@ -47,7 +47,7 @@ module Getch
|
|
47
47
|
# https://openzfs.github.io/openzfs-docs/Getting%20Started/Ubuntu/Ubuntu%2020.04%20Root%20on%20ZFS.html
|
48
48
|
@log.info("Creating boot pool on #{@pool_name}")
|
49
49
|
exec("zpool create -f \\
|
50
|
-
-o ashift=#{ashift} -d \\
|
50
|
+
-o ashift=#{ashift} -o autotrim=on -d \\
|
51
51
|
-o feature@async_destroy=enabled \\
|
52
52
|
-o feature@bookmarks=enabled \\
|
53
53
|
-o feature@embedded_data=enabled \\
|
@@ -66,7 +66,7 @@ module Getch
|
|
66
66
|
")
|
67
67
|
end
|
68
68
|
|
69
|
-
exec("zpool create -f -o ashift=#{ashift} \\
|
69
|
+
exec("zpool create -f -o ashift=#{ashift} -o autotrim=on \\
|
70
70
|
-O encryption=aes-256-gcm \\
|
71
71
|
-O keylocation=prompt -O keyformat=passphrase \\
|
72
72
|
-O acltype=posixacl -O canmount=off -O compression=lz4 \\
|
@@ -18,6 +18,7 @@ module Getch
|
|
18
18
|
@clean.struct(@disk, @cache_disk, @home_disk)
|
19
19
|
@clean.hdd(@disk, @cache_disk, @home_disk)
|
20
20
|
partition
|
21
|
+
cache
|
21
22
|
@state.partition
|
22
23
|
end
|
23
24
|
|
@@ -36,6 +37,15 @@ module Getch
|
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|
40
|
+
def cache
|
41
|
+
if @dev_log
|
42
|
+
exec("sgdisk -n2:0:+4G -t2:BF07 #{cache_disk}")
|
43
|
+
end
|
44
|
+
if @dev_cache
|
45
|
+
exec("sgdisk -n3:0:0 -t3:BF08 #{cache_disk}")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
39
49
|
# Partition_efi
|
40
50
|
# /efi - EFI system partition - 260MB
|
41
51
|
# / - Root
|
@@ -23,8 +23,8 @@ module Getch
|
|
23
23
|
raise "Error, no id found for #{@dev_root}." if ! @id
|
24
24
|
@log.info "Create #{@id} for #{@pool_name}"
|
25
25
|
system("mkfs.fat -F32 #{@dev_esp}") if @dev_esp
|
26
|
-
system("mkswap -f #{@dev_swap}")
|
27
26
|
zfs
|
27
|
+
cache
|
28
28
|
datasets
|
29
29
|
@state.format
|
30
30
|
end
|
@@ -47,7 +47,7 @@ module Getch
|
|
47
47
|
# https://openzfs.github.io/openzfs-docs/Getting%20Started/Ubuntu/Ubuntu%2020.04%20Root%20on%20ZFS.html
|
48
48
|
@log.info("Creating boot pool on #{@pool_name}")
|
49
49
|
exec("zpool create -f \\
|
50
|
-
-o ashift=#{ashift} -d \\
|
50
|
+
-o ashift=#{ashift} -o autotrim=on -d \\
|
51
51
|
-o feature@async_destroy=enabled \\
|
52
52
|
-o feature@bookmarks=enabled \\
|
53
53
|
-o feature@embedded_data=enabled \\
|
@@ -66,7 +66,7 @@ module Getch
|
|
66
66
|
")
|
67
67
|
end
|
68
68
|
|
69
|
-
exec("zpool create -f -o ashift=#{ashift} \\
|
69
|
+
exec("zpool create -f -o ashift=#{ashift} -o autotrim=on \\
|
70
70
|
-O acltype=posixacl -O canmount=off -O compression=lz4 \\
|
71
71
|
-O dnodesize=auto -O normalization=formD -O atime=off \\
|
72
72
|
-O xattr=sa -O mountpoint=/ -R #{MOUNTPOINT} \\
|
@@ -74,6 +74,16 @@ module Getch
|
|
74
74
|
")
|
75
75
|
end
|
76
76
|
|
77
|
+
def cache
|
78
|
+
system("mkswap -f #{@dev_swap}")
|
79
|
+
if @dev_log
|
80
|
+
exec("zpool add #{@pool_name} log #{@dev_log}")
|
81
|
+
end
|
82
|
+
if @dev_cache
|
83
|
+
exec("zpool add #{@pool_name} cache #{@dev_cache}")
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
77
87
|
def datasets
|
78
88
|
exec("zfs create -o canmount=off -o mountpoint=none #{@pool_name}/ROOT")
|
79
89
|
exec("zfs create -o canmount=off -o mountpoint=none #{@boot_pool_name}/BOOT") if @dev_boot
|
@@ -90,7 +100,9 @@ module Getch
|
|
90
100
|
|
91
101
|
exec("zfs create -o canmount=off -o mountpoint=/ #{@pool_name}/USERDATA")
|
92
102
|
exec("zfs create -o canmount=on -o mountpoint=/root #{@pool_name}/USERDATA/root")
|
93
|
-
|
103
|
+
if @user
|
104
|
+
exec("zfs create -o canmount=on -o mountpoint=/home/#{@user} #{@pool_name}/USERDATA/#{@user}")
|
105
|
+
end
|
94
106
|
end
|
95
107
|
|
96
108
|
def exec(cmd)
|
@@ -17,6 +17,7 @@ module Getch
|
|
17
17
|
@clean.struct(@disk, @cache_disk, @home_disk)
|
18
18
|
@clean.hdd(@disk, @cache_disk, @home_disk)
|
19
19
|
partition
|
20
|
+
cache
|
20
21
|
@state.partition
|
21
22
|
end
|
22
23
|
|
@@ -36,6 +37,15 @@ module Getch
|
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|
40
|
+
def cache
|
41
|
+
if @dev_log
|
42
|
+
exec("sgdisk -n2:0:+4G -t2:BF07 #{cache_disk}")
|
43
|
+
end
|
44
|
+
if @dev_cache
|
45
|
+
exec("sgdisk -n3:0:0 -t3:BF08 #{cache_disk}")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
39
49
|
# Partition_efi
|
40
50
|
# /efi - EFI system partition - 260MB
|
41
51
|
# / - Root
|
data/lib/getch/gentoo.rb
CHANGED
data/lib/getch/gentoo/boot.rb
CHANGED
@@ -4,7 +4,7 @@ module Getch
|
|
4
4
|
module Gentoo
|
5
5
|
class Boot
|
6
6
|
def initialize(opts)
|
7
|
-
@disk = opts.disk
|
7
|
+
@disk = opts.boot_disk ? opts.boot_disk : opts.disk
|
8
8
|
@user = opts.username
|
9
9
|
@config = Getch.class_fs::Config.new()
|
10
10
|
end
|
@@ -13,7 +13,6 @@ module Getch
|
|
13
13
|
@config.fstab
|
14
14
|
bootloader
|
15
15
|
password
|
16
|
-
cleanup
|
17
16
|
the_end
|
18
17
|
end
|
19
18
|
|
@@ -77,10 +76,6 @@ module Getch
|
|
77
76
|
|
78
77
|
private
|
79
78
|
|
80
|
-
def cleanup
|
81
|
-
Getch::Emerge.new("emerge --depclean").run!
|
82
|
-
end
|
83
|
-
|
84
79
|
def the_end
|
85
80
|
#Helpers::exec_or_die("umount -l /mnt/gentoo/dev{/shm,/pts,}")
|
86
81
|
#Helpers::exec_or_die("umount -R #{MOUNTPOINT}")
|
data/lib/getch/gentoo/chroot.rb
CHANGED
data/lib/getch/gentoo/config.rb
CHANGED
@@ -11,9 +11,8 @@ module Getch
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def portage
|
14
|
-
nproc = `nproc`.chomp()
|
15
14
|
grub_pc = Helpers::efi? ? '' : 'GRUB_PLATFORMS="pc"'
|
16
|
-
|
15
|
+
nproc = `nproc`.chomp()
|
17
16
|
|
18
17
|
# Add cpu name
|
19
18
|
cpu=`chroot #{MOUNTPOINT} /bin/bash -c \"source /etc/profile ; gcc -c -Q -march=native --help=target | grep march\" | awk '{print $2}' | head -1`.chomp
|
@@ -24,7 +23,7 @@ module Getch
|
|
24
23
|
|
25
24
|
File.open(@make).each { |l|
|
26
25
|
if l.match(/^COMMON_FLAGS/)
|
27
|
-
File.write(tmp, "COMMON_FLAGS=\"-march=#{cpu} -O2 -pipe\"\n", mode: 'a')
|
26
|
+
File.write(tmp, "COMMON_FLAGS=\"-march=#{cpu} -O2 -pipe -fomit-frame-pointer\"\n", mode: 'a')
|
28
27
|
else
|
29
28
|
File.write(tmp, l, mode: 'a')
|
30
29
|
end
|
@@ -35,9 +34,8 @@ module Getch
|
|
35
34
|
# Add the rest
|
36
35
|
data = [
|
37
36
|
'',
|
37
|
+
"MAKEOPTS=\"-j#{nproc}\"",
|
38
38
|
'ACCEPT_KEYWORDS="amd64"',
|
39
|
-
"MAKEOPTS=\"-j#{nproc} -l#{nproc}\"",
|
40
|
-
quiet,
|
41
39
|
'INPUT_DEVICES="libinput"',
|
42
40
|
grub_pc
|
43
41
|
]
|
@@ -113,7 +111,7 @@ module Getch
|
|
113
111
|
end
|
114
112
|
|
115
113
|
def search_zone(zone)
|
116
|
-
if !
|
114
|
+
if !File.exist?("#{MOUNTPOINT}/usr/share/zoneinfo/#{zone}")
|
117
115
|
raise ArgumentError, "Zoneinfo #{zone} doesn\'t exist."
|
118
116
|
end
|
119
117
|
end
|
data/lib/getch/gentoo/sources.rb
CHANGED
data/lib/getch/version.rb
CHANGED
metadata
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: getch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- szorfein
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIETTCCArWgAwIBAgIBATANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1zem9y
|
14
|
-
|
15
|
-
|
14
|
+
ZmVpbi9EQz1wcm90b25tYWlsL0RDPWNvbTAeFw0yMTA1MTEyMTAzNDZaFw0yMjA1
|
15
|
+
MTEyMTAzNDZaMCgxJjAkBgNVBAMMHXN6b3JmZWluL0RDPXByb3Rvbm1haWwvREM9
|
16
16
|
Y29tMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAxCTYZRndCTRy18rE
|
17
17
|
exr2wig/staa0G5kt99xqaBYD0dnIRBr/GO5dFntlBVwmefQlTrNbygVUIYTb8Vg
|
18
18
|
B1oX3v/LLW9SRQcWaZwou0tARqanm5WhgV1ZYQTs22endTazsDHw0uhM3V+FgDh+
|
@@ -25,19 +25,19 @@ cert_chain:
|
|
25
25
|
BgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUc8XWveAjxS5fVEOZeeZe
|
26
26
|
uUQmbhMwIgYDVR0RBBswGYEXc3pvcmZlaW5AcHJvdG9ubWFpbC5jb20wIgYDVR0S
|
27
27
|
BBswGYEXc3pvcmZlaW5AcHJvdG9ubWFpbC5jb20wDQYJKoZIhvcNAQELBQADggGB
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
28
|
+
AHuRqWvtAx1PSIEcvq1uzgBclzP+Lhp6J1f7McvbfzHAZuLo5Nv9iFHkLl2ad9gx
|
29
|
+
p/X2/p8PmgiUNFSXDdB12Pn/VbX4DdoQujwXvmZbQo2KmooklHIhM6AJMafOHW1N
|
30
|
+
qjHIwGvMY5bJfn+3qEQNV+yip6KnCUQVklw132IFvdusoBOPfEP48p41deXbIhNP
|
31
|
+
GNJQ4qkZfXWdLumikb2Y432kIIeugIIAL57VD+wwDUJ3MciiLufYT7v9WNSFRenV
|
32
|
+
JDNGIh3AYiCnNO2DWIArrW6/jaof3A0OnjRQ64vS+EKhZFp8+y6rfC3Clrfjdjse
|
33
|
+
a4zH3TI57bnzfkx5xhjhIu6LJnBpk0x8Y/N2kVmwB+GonFiRcVzZpIfOLvy03tn5
|
34
|
+
dAHfUn//hrBJAT9EXRHNUoLyEmFsCPabTCXjQH6EM2uBcsrjQN4SlgBNzsKc8bS4
|
35
|
+
F9Dl4EPzjBJOgQWf+NxzxNuNKI46Lp5Q8AI+xtDUHAPbSswHa40BA6ChFehP+j0L
|
36
|
+
fg==
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2021-05-12 00:00:00.000000000 Z
|
39
39
|
dependencies: []
|
40
|
-
description:
|
40
|
+
description:
|
41
41
|
email:
|
42
42
|
- szorfein@protonmail.com
|
43
43
|
executables:
|
@@ -119,7 +119,7 @@ metadata:
|
|
119
119
|
changelog_uri: https://github.com/szorfein/getch/blob/master/CHANGELOG.md
|
120
120
|
bug_tracker_uri: https://github.com/szorfein/getch/issues
|
121
121
|
wiki_uri: https://github.com/szorfein/getch
|
122
|
-
post_install_message:
|
122
|
+
post_install_message:
|
123
123
|
rdoc_options: []
|
124
124
|
require_paths:
|
125
125
|
- lib
|
@@ -134,8 +134,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
- !ruby/object:Gem::Version
|
135
135
|
version: '0'
|
136
136
|
requirements: []
|
137
|
-
rubygems_version: 3.0.
|
138
|
-
signing_key:
|
137
|
+
rubygems_version: 3.0.9
|
138
|
+
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: A CLI tool to install Gentoo
|
141
141
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|