Class: Getch::Gentoo::Config
- Inherits:
-
Object
- Object
- Getch::Gentoo::Config
- Defined in:
- lib/getch/gentoo/config.rb
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #network ⇒ Object
- #portage ⇒ Object
- #portage_fs ⇒ Object
- #repo ⇒ Object
- #systemd(options) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
7 8 9 |
# File 'lib/getch/gentoo/config.rb', line 7 def initialize @make = "#{MOUNTPOINT}/etc/portage/make.conf" end |
Instance Method Details
#network ⇒ Object
36 37 38 39 40 |
# File 'lib/getch/gentoo/config.rb', line 36 def network src = '/etc/resolv.conf' dest = "#{MOUNTPOINT}/etc/resolv.conf" FileUtils.copy_file(src, dest, preserve = false) end |
#portage ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/getch/gentoo/config.rb', line 11 def portage nproc = `nproc`.chomp() data = [ '', 'ACCEPT_KEYWORD="amd64 ~amd64"', "MAKEOPTS=\"-j#{nproc} -l#{nproc}\"", 'INPUT_DEVICES="libinput"' ] File.write(@make, data.join("\n"), mode: "a") end |
#portage_fs ⇒ Object
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/getch/gentoo/config.rb', line 51 def portage_fs portage = "#{MOUNTPOINT}/etc/portage" Helpers::create_dir("#{portage}/package.use") Helpers::create_dir("#{portage}/package.accept_keywords") Helpers::create_dir("#{portage}/package.unmask") Helpers::add_file("#{portage}/package.use/zzz_via_autounmask") Helpers::add_file("#{portage}/package.accept_keywords/zzz_via_autounmask") Helpers::add_file("#{portage}/package.unmask/zzz_via_autounmask") end |
#repo ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/getch/gentoo/config.rb', line 22 def repo src = "#{MOUNTPOINT}/usr/share/portage/config/repos.conf" dest = "#{MOUNTPOINT}/etc/portage/repos.conf" FileUtils.mkdir dest, mode: 0644 if ! Dir.exist?(dest) line_count = 0 tmp_file = Tempfile.new('gentoo.conf') File.open(src).each { |l| File.write(tmp_file, "sync-allow-hardlinks = yes\n", mode: 'a') if line_count == 2 File.write(tmp_file, l, mode: 'a') line_count += 1 } FileUtils.copy_file(tmp_file, "#{dest}/gentoo.conf", preserve = false) end |
#systemd(options) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/getch/gentoo/config.rb', line 42 def systemd() () File.write("#{MOUNTPOINT}/etc/locale.gen", @utf8) File.write("#{MOUNTPOINT}/etc/locale.conf", "LANG=#{@lang}") File.write("#{MOUNTPOINT}/etc/locale.conf", 'LC_COLLATE=C', mode: 'a') File.write("#{MOUNTPOINT}/etc/timezone", "#{.zoneinfo}") File.write("#{MOUNTPOINT}/etc/vconsole.conf", "KEYMAP=#{@keymap}") end |