Skip to content

Commit

Permalink
upd readme, code linting
Browse files Browse the repository at this point in the history
  • Loading branch information
szorfein committed Oct 15, 2024
1 parent c57d7c5 commit 7171749
Show file tree
Hide file tree
Showing 18 changed files with 49 additions and 31 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
## 0.11.0, release 2024-10
* Add a new option `--boot-size SIZE`, like requested in
[#6](https://github.com/szorfein/getch/issues/6), actually, it's only used on a
/boot partition, not /efi.
Expand Down
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Filesystem supported (with or without encryption)
+ ZFS

Boot Manager:
+ **Gentoo**: `BIOS`, `crypted disk` and `musl` will use `Grub2` and `systemd-boot` for `UEFI`.
+ **Gentoo**: Grub2 except on systemd without encryption.
+ **Void**: use only Grub2.

The ISO images i was able to test and that works:
Expand All @@ -47,7 +47,7 @@ The ISO images i was able to test and that works:
You can also use your current `linux` host, just pay attention to the disk that will be used.

## Dependencies
Getch is build without external libs, so it only require `ruby >= 2.5`.
Getch is build without external libs, so it only require `ruby >= 2.6`.

On a live image of Void, you need to install `xbps-install -S ruby xz gptfdisk
openssl`.
Expand All @@ -73,40 +73,41 @@ Just ensure than the script is run with a root account.
After an install by Getch, take a look on the [wiki](https://github.com/szorfein/getch/wiki).

## Examples
For a french user:
For a french user on Gentoo:

# getch --zoneinfo "Europe/Paris" --language fr_FR --keymap fr
# getch --disk sda --zoneinfo "Europe/Paris" --language fr_FR --keymap fr

Install Gentoo on LVM and use a different root disk `/dev/sdc`
Install Gentoo on LVM and use a different root disk `/dev/vdc`

# getch --format ext4 --lvm --disk sdc
# getch --disk vdc --format ext4 --lvm

Encrypt your disk with LVM with a french keymap
Encrypt your disk with LVM with a french keymap and in binary mode:

# getch --format ext4 --lvm --encrypt --keymap fr
# getch --disk sda --format ext4 --lvm --encrypt --keymap fr --binary

Encrypt with ext4 and create a new user `ninja`:

# getch --format ext4 --encrypt --username ninja
# getch --disk vda --format ext4 --encrypt --username ninja

Change size of root in Gb, swap in Mb with lvm.
Change size of root in Gb (default 16 on lvm), swap in Mb (default use your
current total ram) with lvm.

# getch --disk vda -o void --lvm --root-size 10 --swap-size 4096
# getch --disk sda -o void --lvm --root-size 10 --swap-size 4096

With ZFS, if used with `--encrypt`, it use the native ZFS encryption:

# getch --format zfs
# getch --disk vda --format zfs

With `Void Linux` and `Musl` enable:

# getch --os void --encrypt -k fr --musl
# getch --disk sda --os void --encrypt -k fr --musl

## Troubleshooting

#### Old VG for LVM
If a old volume group exist, `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`:

# vgdisplay | grep vg0
# vgdisplay | grep vg
# vgremove -f vg0
# pvremove -f /dev/sdb

Expand Down
4 changes: 3 additions & 1 deletion lib/getch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ def resume
STATES[:partition] && return

@log.fatal 'No disk, use at least getch with -d DISK' unless OPTIONS[:disk]
os_cap = OPTIONS[:os].capitalize

puts "\nBuild " + OPTIONS[:os].capitalize + " Linux with the following args:\n"
puts "\nBuild #{os_cap} Linux with the following args:\n"
puts
puts "\tLang: #{OPTIONS[:language]}"
puts "\tTimezone: #{OPTIONS[:timezone]}"
Expand All @@ -80,6 +81,7 @@ def resume
puts "\tUsername: #{OPTIONS[:username]}"
puts "\tEncrypt: #{OPTIONS[:encrypt]}"
puts "\tMusl: #{OPTIONS[:musl]}"
puts "\tBinary mode: #{OPTIONS[:binary]}"
puts
puts "\tseparate-boot disk: #{OPTIONS[:boot_disk]}"
puts "\tseparate-cache disk: #{OPTIONS[:cache_disk]}"
Expand Down
2 changes: 1 addition & 1 deletion lib/getch/config/keymap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def search_dir
@log.fatal('OPTIONS[:os] not supported yet.')
end

File.exist? "#{OPTIONS[:mountpoint]}#{@keymaps_dir}" ||
File.exist?("#{OPTIONS[:mountpoint]}#{@keymaps_dir}") ||
@log.fatal("No dir keymaps #{@keymaps_dir} found.")
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/getch/config/timezone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def for_systemd
return unless Helpers.systemd?

src = "/usr/share/zoneinfo/#{OPTIONS[:timezone]}"
dest = "/etc/localtime"
dest = '/etc/localtime'
Getch::Chroot.new('ln', '-sf', src, dest)
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/getch/gentoo/finalize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module Getch
module Gentoo
# last steps
class Finalize
def initialize
x
Expand Down
3 changes: 2 additions & 1 deletion lib/getch/gentoo/pre_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

module Getch
module Gentoo
# configure before installting the system
class PreConfig
include NiTo

Expand All @@ -30,7 +31,7 @@ def github

def check_ip(host)
ip = `ping -c1 #{host}`.match(/\([0-9]*.[0-9]*.[0-9]*.[0-9]*\)/)
ip[0].tr('()','')
ip[0].tr('()', '')
end
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/getch/gentoo/services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module Getch
module Gentoo
# install|enable services for the next boot
class Services
def initialize
x
Expand Down
23 changes: 14 additions & 9 deletions lib/getch/gentoo/tarball.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@

module Getch
module Gentoo
# Download the last archive rootfs
class Tarball
def initialize
@log = Log.new
@mirror = 'https://mirror.rackspace.com/gentoo'
@release = release
@stage_file = OPTIONS[:musl] ?
"stage3-amd64-musl-#{@release}.tar.xz" :
"stage3-amd64-systemd-#{@release}.tar.xz"
@stage_file = if OPTIONS[:musl]
"stage3-amd64-musl-#{@release}.tar.xz"
else
"stage3-amd64-systemd-#{@release}.tar.xz"
end
end

def x
Expand All @@ -25,9 +28,11 @@ def x
protected

def stage3
OPTIONS[:musl] ?
@mirror + '/releases/amd64/autobuilds/latest-stage3-amd64-musl.txt' :
@mirror + '/releases/amd64/autobuilds/latest-stage3-amd64-systemd.txt'
if OPTIONS[:musl]
"#{@mirror}/releases/amd64/autobuilds/latest-stage3-amd64-musl.txt"
else
"#{@mirror}/releases/amd64/autobuilds/latest-stage3-amd64-systemd.txt"
end
end

# release check line like bellow and return 20231126T163200Z:
Expand All @@ -51,11 +56,11 @@ def get_stage3
return if File.exist? @stage_file

@log.info "wget #{@stage_file}, please wait...\n"
Helpers.get_file_online(@mirror + '/releases/amd64/autobuilds/' + file, @stage_file)
Helpers.get_file_online("#{@mirror}/releases/amd64/autobuilds/#{file}", @stage_file)
end

def control_files
@log.info "Download other files..."
@log.info 'Download other files...'
['DIGESTS', 'asc', 'CONTENTS.gz'].each do |f|
Helpers.get_file_online("#{@mirror}/releases/amd64/autobuilds/#{file}.#{f}", "#{@stage_file}.#{f}")
end
Expand All @@ -66,7 +71,7 @@ def checksum
@log.info 'Checking SHA512 checksum...'
command = "awk '/SHA512 HASH/{getline;print}' #{@stage_file}.DIGESTS | sha512sum --check"
_, stderr, status = Open3.capture3(command)
if status.success? then
if status.success?
@log.result_ok
else
cleaning
Expand Down
1 change: 1 addition & 0 deletions lib/getch/gentoo/terraform.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Getch
module Gentoo
# install required/usefull packages
class Terraform
def initialize
x
Expand Down
1 change: 1 addition & 0 deletions lib/getch/gentoo/use.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

module Getch
module Gentoo
# Utility to configure use flag on Gentoo
class Use
include NiTo

Expand Down
2 changes: 1 addition & 1 deletion lib/getch/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Getch
VERSION = '0.7.3'
VERSION = '0.11.0'
end
5 changes: 2 additions & 3 deletions lib/getch/void/bootloader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

module Getch
module Void
# install grub
class Bootloader
def dependencies
Helpers.efi? ?
Install.new('grub-x86_64-efi') :
Install.new('grub')
Helpers.efi? ? Install.new('grub-x86_64-efi') : Install.new('grub')
end

def install
Expand Down
1 change: 1 addition & 0 deletions lib/getch/void/finalize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module Getch
module Void
# last steps
class Finalize
def initialize
x
Expand Down
1 change: 1 addition & 0 deletions lib/getch/void/post_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module Getch
module Void
# config after installing the rootfs
class PostConfig
def initialize
x
Expand Down
1 change: 1 addition & 0 deletions lib/getch/void/pre_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module Getch
module Void
# config before installing the system
class PreConfig
def initialize
x
Expand Down
1 change: 1 addition & 0 deletions lib/getch/void/services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module Getch
module Void
# install/enable services
class Services
def initialize
x
Expand Down
1 change: 1 addition & 0 deletions lib/getch/void/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module Getch
module Void
# system update
class Update
def initialize
@log = Log.new
Expand Down

0 comments on commit 7171749

Please sign in to comment.