Module: Getch
- Defined in:
- lib/getch.rb,
lib/getch/disk.rb,
lib/getch/mount.rb,
lib/getch/gentoo.rb,
lib/getch/states.rb,
lib/getch/options.rb,
lib/getch/version.rb,
lib/getch/gentoo/stage.rb,
lib/getch/gentoo/chroot.rb,
lib/getch/gentoo/config.rb
Defined Under Namespace
Modules: Gentoo
Classes: Disk, Mount, Options, States
Constant Summary
collapse
- DEFAULT_OPTIONS =
{
language: 'en_US',
location: 'US/Eastern',
keyboard: 'us',
disk: 'sda',
fs: 'ext4',
username: nil
}.freeze
- STATES =
{
:partition => false,
:format => false,
:mount => false,
:gentoo_base => false,
:gentoo_config => false,
:gentoo_update => false
}
- MOUNTPOINT =
"/mnt/gentoo".freeze
- VERSION =
'0.0.3'.freeze
Class Method Summary
collapse
Class Method Details
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/getch.rb', line 49
def self.format(disk, fs)
return if STATES[:format] and STATES[:partition]
puts
print "Partition and format disk #{disk}, this will erase all data, continue? (n,y) "
case gets.chomp
when /^y|^Y/
disk = Getch::Disk.new(disk, fs)
disk.cleaning
disk.partition
disk.format
else
exit 1
end
end
|
.init_gentoo(options) ⇒ Object
73
74
75
76
77
78
|
# File 'lib/getch.rb', line 73
def self.init_gentoo(options)
gentoo = Getch::Gentoo
gentoo.stage3
gentoo.config(options)
gentoo.chroot
end
|
.main(argv) ⇒ Object
80
81
82
83
84
85
86
87
|
# File 'lib/getch.rb', line 80
def self.main(argv)
options = Options.new(argv)
resume_options(options)
Getch::States.new() format(options.disk, options.fs)
mount(options.disk, options.username)
init_gentoo(options)
end
|
.mount(disk, user) ⇒ Object
64
65
66
67
68
69
70
71
|
# File 'lib/getch.rb', line 64
def self.mount(disk, user)
return if STATES[:mount]
mount = Getch::Mount.new(disk, user)
mount.swap
mount.root
mount.boot
mount.home
end
|
.resume_options(opts) ⇒ Object
MOUNTPOINT = “/home/daggoth/lol”.freeze
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/getch.rb', line 31
def self.resume_options(opts)
puts "\nBuild Gentoo with the following args:\n"
puts "lang: #{opts.language}"
puts "zoneinfo: #{opts.zoneinfo}"
puts "keyboard: #{opts.keyboard}"
puts "disk: #{opts.disk}"
puts "fs: #{opts.fs}"
puts "username: #{opts.username}"
puts
print "Continue? (n,y) "
case gets.chomp
when /^y|^Y/
return
else
exit 1
end
end
|