getch 0.1.0 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/README.md +95 -22
  5. data/assets/network-stack.conf +63 -0
  6. data/bin/getch +12 -4
  7. data/lib/getch.rb +116 -66
  8. data/lib/getch/command.rb +19 -5
  9. data/lib/getch/config.rb +42 -0
  10. data/lib/getch/config/gentoo.rb +59 -0
  11. data/lib/getch/config/void.rb +49 -0
  12. data/lib/getch/filesystem.rb +5 -0
  13. data/lib/getch/filesystem/.mount.rb.swp +0 -0
  14. data/lib/getch/filesystem/clean.rb +58 -0
  15. data/lib/getch/filesystem/device.rb +61 -0
  16. data/lib/getch/filesystem/ext4.rb +1 -0
  17. data/lib/getch/filesystem/ext4/config.rb +8 -9
  18. data/lib/getch/filesystem/ext4/device.rb +2 -7
  19. data/lib/getch/filesystem/ext4/encrypt.rb +1 -0
  20. data/lib/getch/filesystem/ext4/encrypt/config.rb +8 -9
  21. data/lib/getch/filesystem/ext4/encrypt/deps.rb +3 -19
  22. data/lib/getch/filesystem/ext4/encrypt/device.rb +3 -8
  23. data/lib/getch/filesystem/ext4/encrypt/format.rb +3 -6
  24. data/lib/getch/filesystem/ext4/encrypt/mount.rb +5 -43
  25. data/lib/getch/filesystem/ext4/encrypt/partition.rb +29 -54
  26. data/lib/getch/filesystem/ext4/encrypt/void.rb +100 -0
  27. data/lib/getch/filesystem/ext4/format.rb +4 -6
  28. data/lib/getch/filesystem/ext4/mount.rb +7 -46
  29. data/lib/getch/filesystem/ext4/partition.rb +16 -39
  30. data/lib/getch/filesystem/ext4/void.rb +43 -0
  31. data/lib/getch/filesystem/lvm.rb +1 -0
  32. data/lib/getch/filesystem/lvm/config.rb +11 -15
  33. data/lib/getch/filesystem/lvm/deps.rb +4 -19
  34. data/lib/getch/filesystem/lvm/device.rb +33 -9
  35. data/lib/getch/filesystem/lvm/encrypt.rb +1 -0
  36. data/lib/getch/filesystem/lvm/encrypt/config.rb +9 -12
  37. data/lib/getch/filesystem/lvm/encrypt/deps.rb +4 -21
  38. data/lib/getch/filesystem/lvm/encrypt/device.rb +33 -9
  39. data/lib/getch/filesystem/lvm/encrypt/format.rb +3 -4
  40. data/lib/getch/filesystem/lvm/encrypt/mount.rb +7 -47
  41. data/lib/getch/filesystem/lvm/encrypt/partition.rb +30 -38
  42. data/lib/getch/filesystem/lvm/encrypt/void.rb +100 -0
  43. data/lib/getch/filesystem/lvm/format.rb +12 -8
  44. data/lib/getch/filesystem/lvm/mount.rb +7 -46
  45. data/lib/getch/filesystem/lvm/partition.rb +19 -31
  46. data/lib/getch/filesystem/lvm/void.rb +45 -0
  47. data/lib/getch/filesystem/mount.rb +56 -0
  48. data/lib/getch/filesystem/partition.rb +77 -0
  49. data/lib/getch/filesystem/zfs.rb +1 -0
  50. data/lib/getch/filesystem/zfs/config.rb +7 -8
  51. data/lib/getch/filesystem/zfs/deps.rb +24 -12
  52. data/lib/getch/filesystem/zfs/device.rb +54 -9
  53. data/lib/getch/filesystem/zfs/encrypt.rb +1 -0
  54. data/lib/getch/filesystem/zfs/encrypt/.mount.rb.swp +0 -0
  55. data/lib/getch/filesystem/zfs/encrypt/config.rb +11 -11
  56. data/lib/getch/filesystem/zfs/encrypt/deps.rb +24 -14
  57. data/lib/getch/filesystem/zfs/encrypt/device.rb +54 -9
  58. data/lib/getch/filesystem/zfs/encrypt/format.rb +84 -3
  59. data/lib/getch/filesystem/zfs/encrypt/mount.rb +8 -28
  60. data/lib/getch/filesystem/zfs/encrypt/partition.rb +26 -109
  61. data/lib/getch/filesystem/zfs/encrypt/void.rb +96 -0
  62. data/lib/getch/filesystem/zfs/format.rb +97 -4
  63. data/lib/getch/filesystem/zfs/mount.rb +10 -32
  64. data/lib/getch/filesystem/zfs/partition.rb +25 -106
  65. data/lib/getch/filesystem/zfs/void.rb +81 -0
  66. data/lib/getch/gentoo.rb +20 -16
  67. data/lib/getch/gentoo/boot.rb +24 -16
  68. data/lib/getch/gentoo/chroot.rb +16 -25
  69. data/lib/getch/gentoo/config.rb +67 -15
  70. data/lib/getch/gentoo/sources.rb +55 -13
  71. data/lib/getch/gentoo/stage.rb +0 -1
  72. data/lib/getch/gentoo/use.rb +43 -0
  73. data/lib/getch/gentoo/use_flag.rb +63 -0
  74. data/lib/getch/guard.rb +64 -0
  75. data/lib/getch/helpers.rb +133 -0
  76. data/lib/getch/log.rb +3 -2
  77. data/lib/getch/options.rb +46 -24
  78. data/lib/getch/version.rb +1 -1
  79. data/lib/getch/void.rb +59 -0
  80. data/lib/getch/void/boot.rb +80 -0
  81. data/lib/getch/void/chroot.rb +55 -0
  82. data/lib/getch/void/config.rb +87 -0
  83. data/lib/getch/void/stage.rb +70 -0
  84. metadata +46 -25
  85. metadata.gz.sig +0 -0
  86. data/.gitignore +0 -2
  87. data/CHANGELOG.md +0 -60
  88. data/Rakefile +0 -21
  89. data/bin/setup.sh +0 -90
  90. data/getch.gemspec +0 -25
@@ -0,0 +1,81 @@
1
+ require_relative '../../helpers'
2
+
3
+ module Getch
4
+ module FileSystem
5
+ module Zfs
6
+ class Void < Device
7
+ include Helpers::Void
8
+ attr_reader :boot_disk
9
+
10
+ def initialize
11
+ super
12
+ hostid
13
+ zfs_zed # mountpoint for zfs
14
+ end
15
+
16
+ # Fstab contain:
17
+ # > /efi noauto
18
+ # > swap
19
+ # > /boot zfs-legacy
20
+ # > /tmp
21
+ def fstab
22
+ conf = "#{MOUNTPOINT}/etc/fstab"
23
+ File.write(conf, "\n", mode: 'w', chmod: 0644)
24
+ line_fstab(@dev_esp, "/efi vfat noauto,rw,relatime 0 0") if @dev_esp
25
+ line_fstab(@dev_swap, "swap swap rw,noatime,discard 0 0") if @dev_swap
26
+ #add_line(conf, "#{@boot_pool_name}/BOOT/#{@n} /boot zfs defaults 0 0") if @dev_boot
27
+ add_line(conf, "tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0")
28
+ end
29
+
30
+ def config_dracut
31
+ conf = "#{MOUNTPOINT}/etc/dracut.conf.d/zfs.conf"
32
+ # dracut: value+= should be surrounding by white space
33
+ content = [
34
+ "hostonly=\"yes\"",
35
+ "omit_dracutmodules+=\" btrfs lvm \"",
36
+ ""
37
+ ]
38
+ File.write(conf, content.join("\n"), mode: 'w', chmod: 0644)
39
+ end
40
+
41
+ def kernel_cmdline_dracut
42
+ #command "zfs set mountpoint=legacy #{@boot_pool_name}/BOOT/#{@n}"
43
+ end
44
+
45
+ def config_grub
46
+ grub_cmdline("root=zfs:#{@pool_name}/ROOT/#{@n}", "zfs_force=1")
47
+ end
48
+
49
+ def finish
50
+ zed_update_path
51
+ puts "+ Enter in your system: chroot /mnt /bin/bash"
52
+ puts "+ Reboot with: shutdown -r now"
53
+ end
54
+
55
+ private
56
+
57
+ def zfs_zed
58
+ service_dir = "/etc/runit/runsvdir/default/"
59
+
60
+ Helpers::mkdir("#{MOUNTPOINT}/etc/zfs/zfs-list.cache")
61
+ Helpers::touch("#{MOUNTPOINT}/etc/zfs/zfs-list.cache/#{@boot_pool_name}") if @dev_boot
62
+ Helpers::touch("#{MOUNTPOINT}/etc/zfs/zfs-list.cache/#{@pool_name}")
63
+ fork { command "/etc/sv/zed/run" }
64
+ command "ln -fs /etc/sv/zed #{service_dir}"
65
+ end
66
+
67
+ def zed_update_path
68
+ Dir.glob("#{MOUNTPOINT}/etc/zfs/zfs-list.cache/*").each { |f|
69
+ if !system("sed", "-Ei", "s|#{MOUNTPOINT}/?|/|", f)
70
+ raise "System exec sed"
71
+ end
72
+ }
73
+ end
74
+
75
+ def hostid
76
+ command "zgenhostid $(hostid)"
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
data/lib/getch/gentoo.rb CHANGED
@@ -1,65 +1,69 @@
1
- require 'open-uri'
2
- require 'open3'
3
1
  require_relative 'gentoo/stage'
4
2
  require_relative 'gentoo/config'
5
3
  require_relative 'gentoo/chroot'
6
4
  require_relative 'gentoo/sources'
7
5
  require_relative 'gentoo/boot'
6
+ require_relative 'gentoo/use'
7
+ require_relative 'gentoo/use_flag'
8
8
 
9
9
  module Getch
10
10
  module Gentoo
11
- class << self
12
- def new
11
+ class Main
12
+ def initialize
13
13
  @state = Getch::States.new()
14
14
  end
15
15
 
16
16
  def stage3
17
17
  return if STATES[:gentoo_base]
18
- new
19
- stage = Getch::Gentoo::Stage.new()
18
+ stage = Getch::Gentoo::Stage.new
20
19
  stage.get_stage3
21
20
  stage.control_files
22
21
  stage.checksum
23
22
  @state.stage3
24
23
  end
25
24
 
26
- def config(options)
25
+ def config
27
26
  return if STATES[:gentoo_config]
28
- new
29
- config = Getch::Gentoo::Config.new()
27
+ config = Getch::Gentoo::Config.new
30
28
  config.portage
31
29
  config.portage_fs
30
+ config.portage_bashrc
32
31
  config.repo
33
32
  config.network
34
- config.systemd(options)
33
+ config.systemd
35
34
  config.hostname
36
35
  @state.config
37
36
  end
38
37
 
39
38
  def chroot
40
- chroot = Getch::Gentoo::Chroot.new()
39
+ chroot = Getch::Gentoo::Chroot.new
41
40
  chroot.update
41
+ chroot.cpuflags
42
42
  chroot.systemd
43
+
44
+ flags = Getch::Gentoo::UseFlag.new
45
+ flags.apply
46
+
43
47
  chroot.world
44
48
  return if STATES[:gentoo_kernel]
45
49
  chroot.kernel
46
50
  chroot.kernel_deps
47
51
  chroot.install_pkgs
52
+ chroot.kernel_link
48
53
  end
49
54
 
50
55
  def kernel
51
56
  return if STATES[:gentoo_kernel]
52
- source = Getch::Gentoo::Sources.new()
53
- new
57
+ source = Getch::Gentoo::Sources.new
54
58
  source.build_kspp
55
- source.init_config
56
59
  source.build_others
60
+ source.firewall
57
61
  source.make
58
62
  @state.kernel
59
63
  end
60
64
 
61
- def boot(options)
62
- boot = Getch::Gentoo::Boot.new(options)
65
+ def boot
66
+ boot = Getch::Gentoo::Boot.new
63
67
  boot.start
64
68
  end
65
69
  end
@@ -3,21 +3,27 @@ require 'fileutils'
3
3
  module Getch
4
4
  module Gentoo
5
5
  class Boot
6
- def initialize(opts)
7
- @disk = opts.disk
8
- @user = opts.username
9
- @config = Getch.class_fs::Config.new()
6
+ def initialize
7
+ @disk = Getch::OPTIONS[:boot_disk] ?
8
+ Getch::OPTIONS[:boot_disk] :
9
+ Getch::OPTIONS[:disk]
10
+ @user = Getch::OPTIONS[:username]
11
+ @class_fs = Getch::select_fs
12
+ @config = @class_fs::Config.new
10
13
  end
11
14
 
12
15
  def start
13
16
  @config.fstab
14
17
  bootloader
15
18
  password
16
- cleanup
19
+ permission
17
20
  the_end
18
21
  end
19
22
 
20
23
  def bootloader
24
+ # Ensure than systemd is build with all our flags
25
+ Getch::Emerge.new("@world").pkg!
26
+
21
27
  if Helpers::efi?
22
28
  bootctl
23
29
  else
@@ -30,8 +36,8 @@ module Getch
30
36
  bootctl_dep
31
37
  puts "Configuring systemd-boot."
32
38
  # ref: https://forums.gentoo.org/viewtopic-p-8118822.html
33
- esp = '/boot/efi'
34
- exec_chroot("bootctl --path #{esp} install")
39
+ esp = '/efi'
40
+ Getch::Chroot.new("bootctl --path #{esp} install").run!
35
41
  datas_loader = [
36
42
  'default gentoo',
37
43
  'timeout 3',
@@ -45,30 +51,29 @@ module Getch
45
51
  initramfs = Dir.glob("#{MOUNTPOINT}/boot/initramfs-*.img")
46
52
  FileUtils.cp("#{initramfs[0]}", "#{MOUNTPOINT}/#{esp}/initramfs", preserve: true) if initramfs != []
47
53
 
48
- exec_chroot("bootctl --path #{esp} update")
54
+ Getch::Chroot.new("bootctl --path #{esp} update").run!
49
55
  end
50
56
 
51
57
  def bootctl_dep
52
58
  puts 'Installing systemd-boot...'
53
- exec_chroot("euse -p sys-apps/systemd -E gnuefi")
54
- Getch::Emerge.new("sys-apps/systemd efivar").pkg!
59
+ Getch::Emerge.new("efivar").pkg!
55
60
  end
56
61
 
57
62
  def grub
58
63
  puts 'Installing GRUB...'
59
64
  Getch::Emerge.new("sys-boot/grub:2").pkg!
60
65
  @config.grub
61
- exec_chroot("grub-install /dev/#{@disk}")
62
- exec_chroot('grub-mkconfig -o /boot/grub/grub.cfg')
66
+ Getch::Chroot.new("grub-install /dev/#{@disk}").run!
67
+ Getch::Chroot.new("grub-mkconfig -o /boot/grub/grub.cfg").run!
63
68
  end
64
69
 
65
70
  def password
66
71
  puts 'Password for root'
67
72
  cmd = "chroot #{MOUNTPOINT} /bin/bash -c \"source /etc/profile && passwd\""
68
73
  system(cmd)
69
- if @user != nil
74
+ if @user
70
75
  puts "Creating user #{@user}"
71
- exec_chroot("useradd -m -G users,wheel,audio,video #{@user}")
76
+ Getch::Chroot.new("useradd -m -G users,wheel,audio,video #{@user}").run!
72
77
  puts "Password for your user #{@user}"
73
78
  cmd = "chroot #{MOUNTPOINT} /bin/bash -c \"source /etc/profile && passwd #{@user}\""
74
79
  system(cmd)
@@ -77,8 +82,11 @@ module Getch
77
82
 
78
83
  private
79
84
 
80
- def cleanup
81
- Getch::Emerge.new("emerge --depclean").run!
85
+ def permission
86
+ FileUtils.chmod_R 0755, "#{MOUNTPOINT}/etc/portage"
87
+ if @user
88
+ Getch::Chroot.new("chown -R #{@user}:#{@user} /home/#{@user}").run!
89
+ end
82
90
  end
83
91
 
84
92
  def the_end
@@ -7,6 +7,12 @@ module Getch
7
7
  mount
8
8
  end
9
9
 
10
+ def cpuflags
11
+ Getch::Emerge.new("app-portage/cpuid2cpuflags").pkg!
12
+ cpuflags = `chroot #{MOUNTPOINT} /bin/bash -c "source /etc/profile; cpuid2cpuflags"`.chomp
13
+ File.write("#{MOUNTPOINT}/etc/portage/package.use/00cpuflags", "*/* #{cpuflags}")
14
+ end
15
+
10
16
  def update
11
17
  return if STATES[:gentoo_update]
12
18
  puts "Downloading the last ebuilds for Gentoo..."
@@ -18,7 +24,7 @@ module Getch
18
24
  def world
19
25
  return if STATES[:gentoo_update]
20
26
  puts "Update Gentoo world"
21
- Getch::Emerge.new("emerge --update --deep --newuse @world").run!
27
+ Getch::Emerge.new("emerge --update --deep --changed-use --newuse @world").run!
22
28
  @state.update
23
29
  end
24
30
 
@@ -33,40 +39,29 @@ module Getch
33
39
  license = "#{MOUNTPOINT}/etc/portage/package.license"
34
40
  File.write(license, "sys-kernel/linux-firmware linux-fw-redistributable no-source-code\n")
35
41
  @pkgs << "sys-kernel/gentoo-sources"
36
- @pkgs << "dev-util/dwarves"
37
42
  end
38
43
 
39
44
  def kernel_deps
40
- puts "Installing Garden..."
41
- get_garden
42
- garden_dep
45
+ @pkgs << "sys-apps/kmod"
43
46
  end
44
47
 
45
48
  def install_pkgs
49
+ @pkgs << "app-portage/gentoolkit"
46
50
  @pkgs << "app-admin/sudo"
47
51
  @pkgs << "app-editors/vim"
52
+ @pkgs << "sys-kernel/linux-firmware"
48
53
  all_pkgs = @pkgs.join(" ")
49
54
  puts "Installing #{all_pkgs}..."
50
55
  Getch::Emerge.new(all_pkgs).pkg!
51
56
  end
52
57
 
53
- private
54
-
55
- def get_garden
56
- return if Dir.exist? "#{MOUNTPOINT}/root/garden-master"
57
- url = 'https://github.com/szorfein/garden/archive/master.tar.gz'
58
- file = 'garden-master.tar.gz'
59
-
60
- Dir.chdir("#{MOUNTPOINT}/root")
61
- Helpers::get_file_online(url, file)
62
- Getch::Command.new("tar xzf #{file}").run! if ! Dir.exist? 'garden-master'
58
+ # create a symbolic link for /usr/src/linux
59
+ def kernel_link
60
+ cmd = "eselect kernel set 1"
61
+ exec_chroot(cmd)
63
62
  end
64
63
 
65
- def garden_dep
66
- Getch::Emerge.new("gentoolkit").pkg!
67
- exec_chroot("euse -p sys-apps/kmod -E lzma")
68
- @pkgs << "sys-apps/kmod"
69
- end
64
+ private
70
65
 
71
66
  def mount
72
67
  puts "Populate /proc, /sys and /dev."
@@ -80,11 +75,7 @@ module Getch
80
75
  end
81
76
 
82
77
  def exec_chroot(cmd)
83
- script = "chroot #{MOUNTPOINT} /bin/bash -c \"
84
- source /etc/profile
85
- #{cmd}
86
- \""
87
- Getch::Command.new(script).run!
78
+ Getch::Chroot.new(cmd).run!
88
79
  end
89
80
  end
90
81
  end
@@ -7,17 +7,35 @@ module Getch
7
7
  class Config
8
8
  def initialize
9
9
  @make = "#{MOUNTPOINT}/etc/portage/make.conf"
10
+ @log = Getch::Log.new
10
11
  end
11
12
 
12
13
  def portage
13
- nproc = `nproc`.chomp()
14
14
  grub_pc = Helpers::efi? ? '' : 'GRUB_PLATFORMS="pc"'
15
- quiet = DEFAULT_OPTIONS[:verbose] ? '' : "EMERGE_DEFAULT_OPTS=\"--jobs=#{nproc} --load-average=#{nproc}\""
15
+ nproc = `nproc`.chomp()
16
+
17
+ # Add cpu name
18
+ cpu=`chroot #{MOUNTPOINT} /bin/bash -c \"source /etc/profile ; gcc -c -Q -march=native --help=target | grep march\" | awk '{print $2}' | head -1`.chomp
19
+ raise "Error, no cpu found" if ! cpu or cpu == ""
20
+ @log.debug "CPU found ==> #{cpu}"
21
+
22
+ tmp = Tempfile.new('make.conf')
23
+
24
+ File.open(@make).each { |l|
25
+ if l.match(/^COMMON_FLAGS/)
26
+ File.write(tmp, "COMMON_FLAGS=\"-march=#{cpu} -O2 -pipe -fomit-frame-pointer\"\n", mode: 'a')
27
+ else
28
+ File.write(tmp, l, mode: 'a')
29
+ end
30
+ }
31
+
32
+ FileUtils.copy_file(tmp, @make, preserve = true)
33
+
34
+ # Add the rest
16
35
  data = [
17
36
  '',
37
+ "MAKEOPTS=\"-j#{nproc}\"",
18
38
  'ACCEPT_KEYWORDS="amd64"',
19
- "MAKEOPTS=\"-j#{nproc} -l#{nproc}\"",
20
- quiet,
21
39
  'INPUT_DEVICES="libinput"',
22
40
  grub_pc
23
41
  ]
@@ -42,22 +60,22 @@ module Getch
42
60
  line_count += 1
43
61
  }
44
62
 
45
- FileUtils.copy_file(tmp, "#{dest}/gentoo.conf", preserve = false)
63
+ FileUtils.copy_file(tmp, "#{dest}/gentoo.conf", preserve = true)
46
64
  end
47
65
 
48
66
  def network
49
67
  src = '/etc/resolv.conf'
50
68
  dest = "#{MOUNTPOINT}/etc/resolv.conf"
51
- FileUtils.copy_file(src, dest, preserve = false)
69
+ FileUtils.copy_file(src, dest, preserve = true)
52
70
  end
53
71
 
54
- def systemd(options)
55
- control_options(options)
72
+ def systemd
73
+ control_options
56
74
  File.write("#{MOUNTPOINT}/etc/locale.gen", @utf8)
57
75
  File.write("#{MOUNTPOINT}/etc/locale.conf", "LANG=#{@lang}\n")
58
76
  File.write("#{MOUNTPOINT}/etc/locale.conf", 'LC_COLLATE=C', mode: 'a')
59
- File.write("#{MOUNTPOINT}/etc/timezone", "#{options.zoneinfo}")
60
- File.write("#{MOUNTPOINT}/etc/vconsole.conf", "KEYMAP=#{options.keymap}")
77
+ File.write("#{MOUNTPOINT}/etc/timezone", "#{Getch::OPTIONS[:zoneinfo]}\n")
78
+ File.write("#{MOUNTPOINT}/etc/vconsole.conf", "KEYMAP=#{Getch::OPTIONS[:keymap]}\n")
61
79
  end
62
80
 
63
81
  def hostname
@@ -76,12 +94,46 @@ module Getch
76
94
  Helpers::add_file("#{portage}/package.unmask/zzz_via_autounmask")
77
95
  end
78
96
 
97
+ def portage_bashrc
98
+ conf = "#{MOUNTPOINT}/etc/portage/bashrc"
99
+ content = %q{
100
+ # https://wiki.gentoo.org/wiki/Signed_kernel_module_support
101
+ function pre_pkg_preinst() {
102
+ # This hook signs any out-of-tree kernel modules.
103
+ if [[ "$(type -t linux-mod_pkg_preinst)" != "function" ]]; then
104
+ # The package does not seem to install any kernel modules.
105
+ return
106
+ fi
107
+ # Get the signature algorithm used by the kernel.
108
+ local module_sig_hash="$(grep -Po '(?<=CONFIG_MODULE_SIG_HASH=").*(?=")' "${KERNEL_DIR}/.config")"
109
+ # Get the key file used by the kernel.
110
+ local module_sig_key="$(grep -Po '(?<=CONFIG_MODULE_SIG_KEY=").*(?=")' "${KERNEL_DIR}/.config")"
111
+ module_sig_key="${module_sig_key:-certs/signing_key.pem}"
112
+ # Path to the key file or PKCS11 URI
113
+ if [[ "${module_sig_key#pkcs11:}" == "${module_sig_key}" && "${module_sig_key#/}" == "${module_sig_key}" ]]; then
114
+ local key_path="${KERNEL_DIR}/${module_sig_key}"
115
+ else
116
+ local key_path="${module_sig_key}"
117
+ fi
118
+ # Certificate path
119
+ local cert_path="${KERNEL_DIR}/certs/signing_key.x509"
120
+ # Sign all installed modules before merging.
121
+ find "${D%/}/${INSDESTTREE#/}/" -name "*.ko" -exec "${KERNEL_DIR}/scripts/sign-file" "${module_sig_hash}" "${key_path}" "${cert_path}" '{}' \;
122
+ }
123
+ }
124
+
125
+ f = File.new(conf, "w")
126
+ f.write("#{content}\n")
127
+ f.chmod(0644)
128
+ f.close
129
+ end
130
+
79
131
  private
80
132
 
81
- def control_options(options)
82
- search_zone(options.zoneinfo)
83
- search_utf8(options.language)
84
- search_key(options.keymap)
133
+ def control_options
134
+ search_zone(Getch::OPTIONS[:zoneinfo])
135
+ search_utf8(Getch::OPTIONS[:language])
136
+ search_key(Getch::OPTIONS[:keymap])
85
137
  end
86
138
 
87
139
  def search_key(keys)
@@ -93,7 +145,7 @@ module Getch
93
145
  end
94
146
 
95
147
  def search_zone(zone)
96
- if ! File.exist?("#{MOUNTPOINT}/usr/share/zoneinfo/#{zone}")
148
+ if !File.exist?("#{MOUNTPOINT}/usr/share/zoneinfo/#{zone}")
97
149
  raise ArgumentError, "Zoneinfo #{zone} doesn\'t exist."
98
150
  end
99
151
  end