getch 0.3.6 → 0.5.0
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/CHANGELOG.md +9 -2
- data/README.md +2 -2
- data/lib/cryptsetup.rb +9 -7
- data/lib/getch/config/iwd.rb +10 -7
- data/lib/getch/config/portage.rb +2 -14
- data/lib/getch/gentoo/post_config.rb +2 -35
- data/lib/getch/gentoo/sources.rb +27 -17
- data/lib/getch/gentoo/tarball.rb +5 -1
- data/lib/getch/gentoo/use_flag.rb +7 -2
- data/lib/getch/helpers.rb +23 -17
- data/lib/getch/version.rb +3 -1
- data/lib/getch/void/tarball.rb +8 -5
- data.tar.gz.sig +0 -0
- metadata +24 -24
- 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: 505fe1616a7fbe15dbb126b4a058abebf52f59ca1c047e698e85dc07dc99fd0d
|
4
|
+
data.tar.gz: 2cd67e6ba44be6558f732aaee0ee4324c76f571c3c53cee6cbaf3648bffef99b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fa666326ce8182467755bf8cb6806c03f5fa8a0e99d666d652a5a22d4d0628456364b0fd72382546ecc575e6f3c5d561b9b19d903b00be502b1af561e57f7a8
|
7
|
+
data.tar.gz: ddf580e37958246f12e00b3331084bdc6f07a3d5dc251ec1051442b632fdf6487d982e82d8bca88180776b280d67c1f22da85093b2b46f8b1f93366c19bc9f37
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,14 +1,21 @@
|
|
1
|
+
## 0.5.0, release 2023-12
|
2
|
+
* Update Voidlinux url https://repo-default.voidlinux.org.
|
3
|
+
* Add global use="modules-sign" for Gentoo.
|
4
|
+
* makeopts on Gentoo use the value of `nproc`.
|
5
|
+
* Correct the install on Gentoo with systemd (kernel name and more).
|
6
|
+
* More rubocop style.
|
7
|
+
|
1
8
|
## 0.3.5, release 2022-11-21
|
2
9
|
* Tested on a live Ubuntu 22.10.
|
3
10
|
* Ensure `dracut.conf.d` exist before writing to it.
|
4
11
|
* Display the version with `-v`, `--version`.
|
5
12
|
|
6
13
|
## 0.3.4, release 2022-10-10
|
7
|
-
* Can work on a Live image of Voidlinux
|
14
|
+
* Can work on a Live image of Voidlinux.
|
8
15
|
|
9
16
|
## 0.3.3, release 2022-10-01
|
10
17
|
* Support disk with a sector size of 512.
|
11
|
-
* Support vdx disk.
|
18
|
+
* Support vdx disk (disk on virtualization).
|
12
19
|
|
13
20
|
## 0.3.0, release 2022-02-17
|
14
21
|
* Gentoo with musl use an additional repo https://github.com/gentoo/musl.git.
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<br/>
|
5
5
|
|
6
6
|
[![Gem Version](https://badge.fury.io/rb/getch.svg)](https://badge.fury.io/rb/getch)
|
7
|
-
![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/szorfein/getch/
|
7
|
+
![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/szorfein/getch/rubocop-analysis.yml?branch=main)
|
8
8
|
[![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
|
9
9
|
![GitHub](https://img.shields.io/github/license/szorfein/getch)
|
10
10
|
|
@@ -35,7 +35,7 @@ Filesystem supported (with or without encryption)
|
|
35
35
|
+ ZFS
|
36
36
|
|
37
37
|
Boot Manager:
|
38
|
-
+ **Gentoo**: `BIOS` and `musl` will use `Grub2` and `systemd-boot` for `UEFI`.
|
38
|
+
+ **Gentoo**: `BIOS`, `crypted disk` and `musl` will use `Grub2` and `systemd-boot` for `UEFI`.
|
39
39
|
+ **Void**: use only Grub2.
|
40
40
|
|
41
41
|
The ISO images i was able to test and that works:
|
data/lib/cryptsetup.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'luks'
|
2
2
|
|
3
|
+
# Used to interact with dmcrypt
|
3
4
|
class CryptSetup
|
4
5
|
def initialize(devs, options)
|
5
6
|
@boot = devs[:boot]
|
@@ -82,7 +83,7 @@ class CryptSetup
|
|
82
83
|
end
|
83
84
|
|
84
85
|
def config_boot
|
85
|
-
return if
|
86
|
+
return if !@boot || @options[:fs] == 'zfs'
|
86
87
|
|
87
88
|
Luks::Boot.new(@boot, @options).write_config
|
88
89
|
end
|
@@ -100,13 +101,14 @@ class CryptSetup
|
|
100
101
|
end
|
101
102
|
|
102
103
|
def config_swap
|
103
|
-
|
104
|
+
id = @options[:lvm] ? '' : Getch::Helpers.id(@swap)
|
104
105
|
line = "swap-#{@luks}"
|
105
|
-
@options[:lvm]
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
106
|
+
line << if @options[:lvm]
|
107
|
+
" /dev/#{@vg}/swap"
|
108
|
+
else
|
109
|
+
" /dev/disk/by-id/#{id}"
|
110
|
+
end
|
111
|
+
line << ' /dev/urandom swap,discard,cipher=aes-xts-plain64:sha256,size=512'
|
110
112
|
NiTo.echo_a "#{@mountpoint}/etc/crypttab", line
|
111
113
|
end
|
112
114
|
|
data/lib/getch/config/iwd.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Getch
|
2
4
|
module Config
|
5
|
+
# Configure iwd if wifi is detected
|
3
6
|
class Iwd
|
4
7
|
include NiTo
|
5
8
|
|
6
9
|
def initialize
|
10
|
+
@options = "[General]\nUseDefaultInterface=true\n"
|
7
11
|
x
|
8
12
|
end
|
9
13
|
|
@@ -44,14 +48,13 @@ module Getch
|
|
44
48
|
# https://docs.voidlinux.org/config/network/iwd.html#troubleshooting
|
45
49
|
def iwd_conf
|
46
50
|
conf = "#{OPTIONS[:mountpoint]}/etc/iwd/main.conf"
|
47
|
-
content =
|
48
|
-
content << "UseDefaultInterface=true\n"
|
51
|
+
content = @options.dup
|
49
52
|
content << "[Network]\n"
|
50
|
-
Helpers.systemd?
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
53
|
+
content << if Helpers.systemd?
|
54
|
+
"NameResolvingService=systemd\n"
|
55
|
+
else
|
56
|
+
"NameResolvingService=resolvconf\n"
|
57
|
+
end
|
55
58
|
mkdir "#{OPTIONS[:mountpoint]}/etc/iwd"
|
56
59
|
echo conf, "#{content}\n"
|
57
60
|
end
|
data/lib/getch/config/portage.rb
CHANGED
@@ -52,12 +52,11 @@ module Getch
|
|
52
52
|
|
53
53
|
# https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Stage#MAKEOPTS
|
54
54
|
def make_conf
|
55
|
-
|
56
|
-
makeopts = mem[0].to_i / 2
|
55
|
+
nproc = `nproc`.chomp
|
57
56
|
|
58
57
|
echo_a "#{@dest}/make.conf", 'ACCEPT_KEYWORDS="amd64"'
|
59
58
|
echo_a "#{@dest}/make.conf", 'INPUT_DEVICES="libinput"'
|
60
|
-
echo_a "#{@dest}/make.conf", "MAKEOPTS=\"-j#{
|
59
|
+
echo_a "#{@dest}/make.conf", "MAKEOPTS=\"-j#{nproc} -l#{nproc}\""
|
61
60
|
end
|
62
61
|
|
63
62
|
# https://www.gentoo.org/downloads/mirrors/
|
@@ -74,17 +73,6 @@ module Getch
|
|
74
73
|
echo conf, 'sys-kernel/linux-firmware @BINARY-REDISTRIBUTABLE'
|
75
74
|
echo_a conf, 'sys-firmware/intel-microcode intel-ucode'
|
76
75
|
end
|
77
|
-
|
78
|
-
private
|
79
|
-
|
80
|
-
def get_memory
|
81
|
-
mem = '2048'
|
82
|
-
File.open('/proc/meminfo').each do |l|
|
83
|
-
t = l.split(' ') if l =~ /memtotal/i
|
84
|
-
t && mem = t[1]
|
85
|
-
end
|
86
|
-
mem
|
87
|
-
end
|
88
76
|
end
|
89
77
|
end
|
90
78
|
end
|
@@ -4,6 +4,7 @@ require 'nito'
|
|
4
4
|
|
5
5
|
module Getch
|
6
6
|
module Gentoo
|
7
|
+
# Configure system after install the base system (when chroot is available)
|
7
8
|
class PostConfig
|
8
9
|
include NiTo
|
9
10
|
|
@@ -23,7 +24,7 @@ module Getch
|
|
23
24
|
grub
|
24
25
|
end
|
25
26
|
|
26
|
-
|
27
|
+
private
|
27
28
|
|
28
29
|
def cpuflags
|
29
30
|
conf = "#{OPTIONS[:mountpoint]}/etc/portage/package.use/00cpuflags"
|
@@ -36,40 +37,6 @@ module Getch
|
|
36
37
|
grub_pc = Helpers.efi? ? 'GRUB_PLATFORMS="efi-64"' : 'GRUB_PLATFORMS="pc"'
|
37
38
|
echo_a "#{OPTIONS[:mountpoint]}/etc/portage/make.conf", grub_pc
|
38
39
|
end
|
39
|
-
|
40
|
-
# https://wiki.gentoo.org/wiki/Signed_kernel_module_support
|
41
|
-
def portage_bashrc
|
42
|
-
conf = "#{MOUNTPOINT}/etc/portage/bashrc"
|
43
|
-
content = %q{
|
44
|
-
function pre_pkg_preinst() {
|
45
|
-
# This hook signs any out-of-tree kernel modules.
|
46
|
-
if [[ "$(type -t linux-mod_pkg_preinst)" != "function" ]]; then
|
47
|
-
# The package does not seem to install any kernel modules.
|
48
|
-
return
|
49
|
-
fi
|
50
|
-
# Get the signature algorithm used by the kernel.
|
51
|
-
local module_sig_hash="$(grep -Po '(?<=CONFIG_MODULE_SIG_HASH=").*(?=")' "${KERNEL_DIR}/.config")"
|
52
|
-
# Get the key file used by the kernel.
|
53
|
-
local module_sig_key="$(grep -Po '(?<=CONFIG_MODULE_SIG_KEY=").*(?=")' "${KERNEL_DIR}/.config")"
|
54
|
-
module_sig_key="${module_sig_key:-certs/signing_key.pem}"
|
55
|
-
# Path to the key file or PKCS11 URI
|
56
|
-
if [[ "${module_sig_key#pkcs11:}" == "${module_sig_key}" && "${module_sig_key#/}" == "${module_sig_key}" ]]; then
|
57
|
-
local key_path="${KERNEL_DIR}/${module_sig_key}"
|
58
|
-
else
|
59
|
-
local key_path="${module_sig_key}"
|
60
|
-
fi
|
61
|
-
# Certificate path
|
62
|
-
local cert_path="${KERNEL_DIR}/certs/signing_key.x509"
|
63
|
-
# Sign all installed modules before merging.
|
64
|
-
find "${D%/}/${INSDESTTREE#/}/" -name "*.ko" -exec "${KERNEL_DIR}/scripts/sign-file" "${module_sig_hash}" "${key_path}" "${cert_path}" '{}' \;
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
68
|
-
f = File.new(conf, 'w')
|
69
|
-
f.write("#{content}\n")
|
70
|
-
f.chmod(0700)
|
71
|
-
f.close
|
72
|
-
end
|
73
40
|
end
|
74
41
|
end
|
75
42
|
end
|
data/lib/getch/gentoo/sources.rb
CHANGED
@@ -5,6 +5,8 @@ require 'nito'
|
|
5
5
|
|
6
6
|
module Getch
|
7
7
|
module Gentoo
|
8
|
+
# Here we install the kernel linux.
|
9
|
+
# We compile source, enable and disable few modules for the new system.
|
8
10
|
class Sources
|
9
11
|
include NiTo
|
10
12
|
|
@@ -26,12 +28,12 @@ module Getch
|
|
26
28
|
|
27
29
|
def bask
|
28
30
|
@log.info "Kernel hardening...\n"
|
29
|
-
#Getch::Bask.new('10_kspp.config').cp
|
31
|
+
# Getch::Bask.new('10_kspp.config').cp
|
30
32
|
Getch::Bask.new('11-kspp-gcc.config').cp
|
31
33
|
Getch::Bask.new('12-kspp-x86_64.config').cp
|
32
|
-
#Getch::Bask.new('20-clipos.config').cp
|
34
|
+
# Getch::Bask.new('20-clipos.config').cp
|
33
35
|
Getch::Bask.new('30-grsecurity.config').cp
|
34
|
-
#Getch::Bask.new('40-kconfig-hardened.config').cp
|
36
|
+
# Getch::Bask.new('40-kconfig-hardened.config').cp
|
35
37
|
Getch::Bask.new('50-blacklist.config').cp
|
36
38
|
Getch::Bask.new('51-blacklist-madaidans.config').cp
|
37
39
|
end
|
@@ -42,21 +44,13 @@ module Getch
|
|
42
44
|
end
|
43
45
|
|
44
46
|
def grub_mkconfig
|
45
|
-
return if Helpers.systemd?
|
47
|
+
return if Helpers.systemd? && Helpers.efi?
|
46
48
|
|
47
49
|
file = "#{OPTIONS[:mountpoint]}/etc/kernel/postinst.d/90-mkconfig.install"
|
48
|
-
content =
|
49
|
-
#!/usr/bin/env sh
|
50
|
-
set -o errexit
|
51
|
-
|
52
|
-
if ! hash grub-mkconfig ; then
|
53
|
-
exit 0
|
54
|
-
fi
|
55
|
-
grub-mkconfig -o /boot/grub/grub.cfg
|
56
|
-
SHELL
|
50
|
+
content = grub_script
|
57
51
|
mkdir "#{OPTIONS[:mountpoint]}/etc/kernel/postinst.d"
|
58
52
|
File.write file, content
|
59
|
-
File.chmod
|
53
|
+
File.chmod('0755', file)
|
60
54
|
end
|
61
55
|
|
62
56
|
def use_flags
|
@@ -66,11 +60,13 @@ SHELL
|
|
66
60
|
|
67
61
|
# https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Kernel#Alternative:_Using_distribution_kernels
|
68
62
|
def make
|
69
|
-
Helpers.systemd?
|
70
|
-
Install.new('sys-kernel/installkernel-systemd
|
63
|
+
if Helpers.systemd?
|
64
|
+
Install.new('sys-kernel/installkernel-systemd')
|
65
|
+
else
|
71
66
|
Install.new('sys-kernel/installkernel-gentoo')
|
67
|
+
end
|
72
68
|
|
73
|
-
#Install.new 'sys-kernel/gentoo-kernel'
|
69
|
+
# Install.new 'sys-kernel/gentoo-kernel'
|
74
70
|
Install.new 'sys-kernel/gentoo-kernel-bin'
|
75
71
|
end
|
76
72
|
|
@@ -93,6 +89,7 @@ SHELL
|
|
93
89
|
|
94
90
|
module_load('iwlmvm', conf)
|
95
91
|
module_load('ath9k', conf)
|
92
|
+
module_load('rt73usb', conf)
|
96
93
|
end
|
97
94
|
|
98
95
|
def flash_mod
|
@@ -112,6 +109,19 @@ SHELL
|
|
112
109
|
|
113
110
|
File.write(file, "#{name}\n", mode: 'a')
|
114
111
|
end
|
112
|
+
|
113
|
+
def grub_script
|
114
|
+
<<~SHELL
|
115
|
+
#!/usr/bin/env sh
|
116
|
+
set -o errexit
|
117
|
+
|
118
|
+
if ! hash grub-mkconfig ; then
|
119
|
+
exit 0
|
120
|
+
fi
|
121
|
+
|
122
|
+
grub-mkconfig -o /boot/grub/grub.cfg
|
123
|
+
SHELL
|
124
|
+
end
|
115
125
|
end
|
116
126
|
end
|
117
127
|
end
|
data/lib/getch/gentoo/tarball.rb
CHANGED
@@ -30,9 +30,13 @@ module Getch
|
|
30
30
|
@mirror + '/releases/amd64/autobuilds/latest-stage3-amd64-systemd.txt'
|
31
31
|
end
|
32
32
|
|
33
|
+
# release check line like bellow and return 20231126T163200Z:
|
34
|
+
# 20231126T163200Z/stage3-amd64-systemd-20231126T163200Z.tar.xz 276223256
|
33
35
|
def release
|
34
36
|
URI.open(stage3) do |file|
|
35
|
-
file.
|
37
|
+
file.each do |line|
|
38
|
+
return line.split('/')[0] if line.match(%r{^[\w]+[/](.*)tar.xz})
|
39
|
+
end
|
36
40
|
end
|
37
41
|
rescue Net::OpenTimeout => e
|
38
42
|
@log.fatal "Problem with DNS? #{e}"
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
module Getch
|
4
4
|
module Gentoo
|
5
|
+
# Configure use flag before compiling all the packages
|
5
6
|
class UseFlag
|
6
7
|
def initialize
|
7
8
|
x
|
@@ -23,9 +24,11 @@ module Getch
|
|
23
24
|
private
|
24
25
|
|
25
26
|
# https://wiki.gentoo.org/wiki/Project:Distribution_Kernel#Trying_it_out
|
27
|
+
# https://wiki.gentoo.org/wiki/Signed_kernel_module_support
|
26
28
|
def dist_kernel
|
27
29
|
use = Getch::Gentoo::Use.new
|
28
30
|
use.add_global('dist-kernel')
|
31
|
+
use.add_global('modules-sign')
|
29
32
|
end
|
30
33
|
|
31
34
|
def systemd
|
@@ -33,8 +36,10 @@ module Getch
|
|
33
36
|
|
34
37
|
flags = []
|
35
38
|
use = Getch::Gentoo::Use.new('sys-apps/systemd')
|
36
|
-
flags << '
|
39
|
+
flags << 'boot'
|
37
40
|
flags << 'gnuefi' if Helpers.efi?
|
41
|
+
flags << 'kernel-install'
|
42
|
+
flags << 'dns-over-tls'
|
38
43
|
use.add(flags)
|
39
44
|
end
|
40
45
|
|
@@ -55,7 +60,7 @@ module Getch
|
|
55
60
|
use = Getch::Gentoo::Use.new('sys-boot/grub')
|
56
61
|
flags << '-grub_platforms_efi-64' unless Helpers.efi?
|
57
62
|
flags << 'libzfs' if OPTIONS[:fs] == 'zfs'
|
58
|
-
flags << 'device-mapper' if OPTIONS[:fs] == 'lvm'
|
63
|
+
flags << 'device-mapper' if OPTIONS[:fs] == 'lvm' || OPTIONS[:encrypt]
|
59
64
|
use.add(flags)
|
60
65
|
end
|
61
66
|
|
data/lib/getch/helpers.rb
CHANGED
@@ -6,6 +6,7 @@ require 'fileutils'
|
|
6
6
|
require 'nito'
|
7
7
|
|
8
8
|
module Getch
|
9
|
+
# Various helpers function defined here
|
9
10
|
module Helpers
|
10
11
|
def self.efi?
|
11
12
|
Dir.exist? '/sys/firmware/efi/efivars'
|
@@ -37,9 +38,9 @@ module Getch
|
|
37
38
|
|
38
39
|
def self.exec_or_die(cmd)
|
39
40
|
_, stderr, status = Open3.capture3(cmd)
|
40
|
-
|
41
|
-
|
42
|
-
|
41
|
+
return if status.success?
|
42
|
+
|
43
|
+
abort "Problem running #{cmd}, stderr was:\n#{stderr}"
|
43
44
|
end
|
44
45
|
|
45
46
|
def self.sys(cmd)
|
@@ -53,13 +54,20 @@ module Getch
|
|
53
54
|
|
54
55
|
def self.uuid(dev)
|
55
56
|
Dir.glob('/dev/disk/by-uuid/*').each do |f|
|
56
|
-
|
57
|
-
|
58
|
-
end
|
57
|
+
p = File.readlink(f)
|
58
|
+
return f.delete_prefix('/dev/disk/by-uuid/') if p.match?(/#{dev}/)
|
59
59
|
end
|
60
60
|
Log.new.fatal("UUID on #{dev} is no found")
|
61
61
|
end
|
62
62
|
|
63
|
+
def self.id(dev)
|
64
|
+
Dir.glob('/dev/disk/by-id/*').each do |f|
|
65
|
+
p = File.readlink(f)
|
66
|
+
return f.delete_prefix('/dev/disk/by-id/') if p.match?(/#{dev}/)
|
67
|
+
end
|
68
|
+
Log.new.fatal("ID on #{dev} is no found")
|
69
|
+
end
|
70
|
+
|
63
71
|
def self.get_dm(name)
|
64
72
|
Dir.glob('/dev/mapper/*').each do |f|
|
65
73
|
if f =~ /#{name}/ && f != '/dev/mapper/control'
|
@@ -74,9 +82,8 @@ module Getch
|
|
74
82
|
def self.get_id(dev)
|
75
83
|
sleep 3
|
76
84
|
Dir.glob('/dev/disk/by-id/*').each do |f|
|
77
|
-
|
78
|
-
|
79
|
-
end
|
85
|
+
p = File.readlink(f)
|
86
|
+
return f.delete_prefix('/dev/disk/by-id/') if p.match?(/#{dev}/)
|
80
87
|
end
|
81
88
|
Log.new.fatal("ID on #{dev} is no found")
|
82
89
|
end
|
@@ -85,7 +92,7 @@ module Getch
|
|
85
92
|
def self.mount_all
|
86
93
|
dest = OPTIONS[:mountpoint]
|
87
94
|
NiTo.mount '--types proc /proc', "#{dest}/proc"
|
88
|
-
[
|
95
|
+
%w[dev sys run].each do |d|
|
89
96
|
NiTo.mount '--rbind', "/#{d}", "#{dest}/#{d}"
|
90
97
|
NiTo.mount '--make-rslave', "#{dest}/#{d}"
|
91
98
|
end
|
@@ -108,6 +115,7 @@ module Getch
|
|
108
115
|
cmd.res
|
109
116
|
end
|
110
117
|
|
118
|
+
# Helpers specific to void
|
111
119
|
module Void
|
112
120
|
def command_output(args)
|
113
121
|
print " => Exec: #{args}..."
|
@@ -117,17 +125,15 @@ module Getch
|
|
117
125
|
stdout_err.each { |l| puts l }
|
118
126
|
|
119
127
|
exit_status = wait_thr.value
|
120
|
-
unless exit_status.success?
|
121
|
-
raise "\n[-] Fail cmd #{args} - #{stdout_err}."
|
122
|
-
end
|
128
|
+
raise("\n[-] Fail cmd #{args} - #{stdout_err}.") unless exit_status.success?
|
123
129
|
end
|
124
130
|
end
|
125
131
|
|
126
132
|
# Used only when need password
|
127
133
|
def chroot(cmd)
|
128
|
-
|
129
|
-
|
130
|
-
|
134
|
+
return if system('chroot', Getch::MOUNTPOINT, '/bin/bash', '-c', cmd)
|
135
|
+
|
136
|
+
raise "[-] Error with: #{cmd}"
|
131
137
|
end
|
132
138
|
|
133
139
|
def s_uuid(dev)
|
@@ -142,7 +148,7 @@ module Getch
|
|
142
148
|
conf = "#{Getch::MOUNTPOINT}/etc/fstab"
|
143
149
|
device = s_uuid(dev)
|
144
150
|
raise "No partuuid for #{dev} #{device}" unless device
|
145
|
-
raise "Bad partuuid for #{dev} #{device}" if device.
|
151
|
+
raise "Bad partuuid for #{dev} #{device}" if device.is_a?(Array)
|
146
152
|
|
147
153
|
add_line(conf, "PARTUUID=#{device} #{rest}")
|
148
154
|
end
|
data/lib/getch/version.rb
CHANGED
data/lib/getch/void/tarball.rb
CHANGED
@@ -4,10 +4,11 @@ require 'open3'
|
|
4
4
|
|
5
5
|
module Getch
|
6
6
|
module Void
|
7
|
+
# Download the last tarball of void
|
7
8
|
class Tarball
|
8
9
|
def initialize
|
9
10
|
@log = Log.new
|
10
|
-
@url = 'https://
|
11
|
+
@url = 'https://repo-default.voidlinux.org/live/current'
|
11
12
|
@file = 'sha256sum.txt'
|
12
13
|
@xbps = false
|
13
14
|
Dir.chdir OPTIONS[:mountpoint]
|
@@ -23,9 +24,11 @@ module Getch
|
|
23
24
|
protected
|
24
25
|
|
25
26
|
def tarball
|
26
|
-
OPTIONS[:musl]
|
27
|
-
/void-x86_64-musl-ROOTFS-[\d._]+.tar.xz/
|
27
|
+
if OPTIONS[:musl]
|
28
|
+
/void-x86_64-musl-ROOTFS-[\d._]+.tar.xz/
|
29
|
+
else
|
28
30
|
/void-x86_64-ROOTFS-[\d._]+.tar.xz/
|
31
|
+
end
|
29
32
|
end
|
30
33
|
|
31
34
|
# Search the name of the last release in @file 'sha256sum.txt'
|
@@ -57,7 +60,7 @@ module Getch
|
|
57
60
|
# Should contain 2 spaces...
|
58
61
|
command = "echo #{@xbps[3]} #{@xbps[1]} | sha256sum --check"
|
59
62
|
_, stderr, status = Open3.capture3(command)
|
60
|
-
if status.success?
|
63
|
+
if status.success?
|
61
64
|
@log.result_ok
|
62
65
|
else
|
63
66
|
cleaning
|
@@ -76,7 +79,7 @@ module Getch
|
|
76
79
|
@log.info "Decompressing #{@xbps[1]}..."
|
77
80
|
cmd = "tar xpf #{@xbps[1]} --xattrs-include=\'*.*\' --numeric-owner"
|
78
81
|
_, stderr, status = Open3.capture3(cmd)
|
79
|
-
if status.success?
|
82
|
+
if status.success?
|
80
83
|
@log.result_ok
|
81
84
|
else
|
82
85
|
@log.fatal "Fail to decompressing #{@xbps[1]} - #{stderr}."
|
data.tar.gz.sig
CHANGED
Binary file
|
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.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- szorfein
|
@@ -12,31 +12,31 @@ cert_chain:
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIEhTCCAu2gAwIBAgIBATANBgkqhkiG9w0BAQsFADBEMREwDwYDVQQDDAhzem9y
|
14
14
|
ZmVpbjEaMBgGCgmSJomT8ixkARkWCnByb3Rvbm1haWwxEzARBgoJkiaJk/IsZAEZ
|
15
|
-
|
15
|
+
FgNjb20wHhcNMjMxMDIzMTcyMTA4WhcNMjQxMDIyMTcyMTA4WjBEMREwDwYDVQQD
|
16
16
|
DAhzem9yZmVpbjEaMBgGCgmSJomT8ixkARkWCnByb3Rvbm1haWwxEzARBgoJkiaJ
|
17
|
-
k/
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
AaOBgTB/
|
27
|
-
|
17
|
+
k/IsZAEZFgNjb20wggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCqe1yx
|
18
|
+
EG2oM25jeHp08A8zkaDNmbI3MujjrRM/WPEYZX2dVwOxkIS20hQVuxcAsBBA4W/W
|
19
|
+
kuPbqRkvLboaGaxLrllkSEJw9HA/GesTdXLyCFYmNzSFqGh5BafNSkxoiDhTavxp
|
20
|
+
xvYzAkYR/3CzSOWSxJk73wIg+F7w/nWJPTt2tgJE9hgR8uuFY+EzPOlFZhkFTdCV
|
21
|
+
88sBGuZPMjq7ASQVBE3UA+Y1xJeXE3/FhIhYvLnjevkkDLSLFmox0ZQf6nx6abuL
|
22
|
+
KTOGRA1bfLfkW5HMh5X5JwViliwG3RWhqAukJUgHTUk+oKtejlzSDqupwOenKZf0
|
23
|
+
xI2/BnS8zOsS6Te08iLxqZfI/lsG8wcPduekSetRI4VIOZ5QoRK54PiQjrOBhbnD
|
24
|
+
OQBB/XF1C80imZtRtdUqh6bK9WeWI4RYZ2/KwXL1AScEbXkBkkOECWoVrD18WgRm
|
25
|
+
siuX6RkNIelhtb0En7f3bizgPqlO0qPQV+wPi9TSBxdVG12C0OmjCQYMQD0CAwEA
|
26
|
+
AaOBgTB/MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBTlKnQ3qMUF
|
27
|
+
zydvZaKwdP+dnj2uajAiBgNVHREEGzAZgRdzem9yZmVpbkBwcm90b25tYWlsLmNv
|
28
28
|
bTAiBgNVHRIEGzAZgRdzem9yZmVpbkBwcm90b25tYWlsLmNvbTANBgkqhkiG9w0B
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
29
|
+
AQsFAAOCAYEAFjnBWWfaMeA8hP0Q76WmBCFckGN5I42X5RQkVYRRXIaeXIS1td/t
|
30
|
+
O1v1iQLo6ABfASMi6We7T16+ita68xwNOmSkMNHHXBr/fdGbHExxFSX7BXNRbwla
|
31
|
+
SS6Vy0bXKMDJbXcvkrmIolpYhEFm1218FCRCT6ogM1oWAJAfhfF9pMeRxrxjQYFn
|
32
|
+
ko8XgjIHxb83miOILgdq/lgJ4gfD7PsGfJtLCLiCKCcxIb4TtmKAzRwCDVpb6wqM
|
33
|
+
5xJZffAmHI7v8lVer53sPzm3INPu5xFZyfZ/SXYXPKKwln0efH63K5vuXYwEN7NI
|
34
|
+
SBSRTN03Hb65t86m6/r084SrNnLntQjCSqApzFBt1QwJ5cmiVilODN4V7y2hZpyK
|
35
|
+
hSk3b2VOotDPiWIm1p/IPXQDfm5x67Z5fJQPAlBTsse4jKyVyW1lZLmERSBuRZ2O
|
36
|
+
urXgRIzALxd/xazPCnoLSXPzfJSI6Y77S1EBvhPd9RaSO8IyH9RhPDP9mnTvW2Kl
|
37
|
+
NAUnoL+txK5a
|
38
38
|
-----END CERTIFICATE-----
|
39
|
-
date:
|
39
|
+
date: 2023-12-07 00:00:00.000000000 Z
|
40
40
|
dependencies: []
|
41
41
|
description:
|
42
42
|
email:
|
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
191
|
- !ruby/object:Gem::Version
|
192
192
|
version: '0'
|
193
193
|
requirements: []
|
194
|
-
rubygems_version: 3.3.
|
194
|
+
rubygems_version: 3.3.25
|
195
195
|
signing_key:
|
196
196
|
specification_version: 4
|
197
197
|
summary: A CLI tool to install Gentoo or VoidLinux.
|
metadata.gz.sig
CHANGED
Binary file
|