Class: Getch::Assembly

Inherits:
Object
  • Object
show all
Includes:
NiTo
Defined in:
lib/getch/assembly.rb

Overview

define steps/order for getch

Instance Method Summary collapse

Methods included from NiTo

cp, echo, echo_a, grep?, mkdir, mount, mount?, mv, rm, search_proc_swaps, sed, sh, swapoff, swapoff_dm, touch, umount

Constructor Details

#initializeAssembly

Returns a new instance of Assembly.



12
13
14
15
16
17
18
# File 'lib/getch/assembly.rb', line 12

def initialize
  @os = Tree::Os.new.select
  @fs = Tree::FS.new.select
  @state = Getch::States.new
  Getch::Device.new
  init_devs
end

Instance Method Details

#bootloaderObject

bootloader Install and configure Grub2 or Systemd-boot with Dracut Adding keys for Luks



128
129
130
131
132
133
134
135
136
# File 'lib/getch/assembly.rb', line 128

def bootloader
  return if STATES[:bootloader]

  bootloader = @os::Bootloader.new
  bootloader.dependencies
  @fs::Config.new
  bootloader.install
  @state.bootloader
end

#cleanObject



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/getch/assembly.rb', line 27

def clean
  return if STATES[:partition]

  print "\nPartition and format disk #{OPTIONS[:disk]}, this will erase all data, continue? (y,N) "
  case gets.chomp
  when /^y|^Y/
  else
    exit
  end

  Clean.new(OPTIONS).x
end

#finalizeObject

finalize Password for root, etc



140
141
142
143
144
145
146
147
148
149
# File 'lib/getch/assembly.rb', line 140

def finalize
  return if STATES[:finalize]

  @os::Finalize.new
  puts
  puts '[*!*] Installation finished [*!*]'
  puts
  @fs.end
  @state.finalize
end

#formatObject



47
48
49
50
51
52
# File 'lib/getch/assembly.rb', line 47

def format
  return if STATES[:format]

  @fs::Format.new
  @state.format
end

#init_devsObject



20
21
22
23
24
25
# File 'lib/getch/assembly.rb', line 20

def init_devs
  DEVS[:root] && return

  @fs::Device.new
  DEVS[:root] || Log.new.fatal('No root, device prob !')
end

#luks_keysObject

Luks_keys Install external keys to avoid enter password multiple times



97
98
99
100
101
102
103
104
# File 'lib/getch/assembly.rb', line 97

def luks_keys
  return unless OPTIONS[:encrypt] && OPTIONS[:fs] != 'zfs'

  return if STATES[:luks_keys]

  CryptSetup.new(DEVS, OPTIONS).keys
  @state.luks_keys
end

#mountObject



54
55
56
57
58
59
# File 'lib/getch/assembly.rb', line 54

def mount
  return if STATES[:mount]

  @fs::Mount.new
  @state.mount
end

#partitionObject



40
41
42
43
44
45
# File 'lib/getch/assembly.rb', line 40

def partition
  return if STATES[:partition]

  @fs::Partition.new
  @state.partition
end

#post_configObject



88
89
90
91
92
93
# File 'lib/getch/assembly.rb', line 88

def post_config
  return if STATES[:post_config]

  @os::PostConfig.new
  @state.post_config
end

#pre_configObject

pre_config Pre configuration before updates and install packages Can contain config for a repository, CPU compilation flags, etc…



71
72
73
74
75
76
# File 'lib/getch/assembly.rb', line 71

def pre_config
  return if STATES[:pre_config]

  @os::PreConfig.new
  @state.pre_config
end

#servicesObject



118
119
120
121
122
123
# File 'lib/getch/assembly.rb', line 118

def services
  return if STATES[:services]

  @os::Services.new
  @state.services
end

#tarballObject



61
62
63
64
65
66
# File 'lib/getch/assembly.rb', line 61

def tarball
  return if STATES[:tarball]

  @os::Tarball.new.x
  @state.tarball
end

#terraformObject

terraform Install all the required packages Also add services



109
110
111
112
113
114
115
116
# File 'lib/getch/assembly.rb', line 109

def terraform
  return if STATES[:terraform]

  # @fs::PreDeps.new
  @os::Terraform.new
  @fs::Deps.new
  @state.terraform
end

#updateObject

update Synchronise and Update the new system



80
81
82
83
84
85
86
# File 'lib/getch/assembly.rb', line 80

def update
  return if STATES[:update]

  Helpers.mount_all
  @os::Update.new
  @state.update
end