Module: KextCache

Defined in:
lib/iesd/utility/kextcache.rb

Constant Summary collapse

KEXTCACHE_DEFAULT_OPTIONS =
%w{ -v 0 -no-authentication }
EXTENSIONS =
%w{ System Library Extensions }
KERNELCACHE =
%w{ System Library Caches com.apple.kext.caches Startup kernelcache }
MKEXT =
%w{ System Library Caches com.apple.kext.caches Startup Extensions.mkext }
MKEXT_PPC =
%w{ System Library Extensions.mkext }

Class Method Summary collapse

Class Method Details

.update_volume(volume_root) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/iesd/utility/kextcache.rb', line 9

def self.update_volume volume_root
  oh1 "Updating Kextcache"
  if File.exist? (mach_kernel = File.join(volume_root, "mach_kernel"))
    case
    when (File.exist? (url = File.join(volume_root, *KERNELCACHE)))
      system(Utility::KEXTCACHE, *KEXTCACHE_DEFAULT_OPTIONS, "-prelinked-kernel", url, "-kernel", mach_kernel, "-volume-root", volume_root, "--", File.join(volume_root, *EXTENSIONS))
    when (File.exist? (url = File.join(volume_root, *MKEXT)))
      system(Utility::KEXTCACHE, *KEXTCACHE_DEFAULT_OPTIONS, *%w{ -a i386 -a x86_64 }, "-mkext", url, "-kernel", mach_kernel, "-volume-root", volume_root, "--", File.join(volume_root, *EXTENSIONS))
      if File.exist? (mkext_ppc = File.join(volume_root, *MKEXT_PPC))
        system(Utility::DITTO, url, mkext_ppc)
      end
    when (File.exist? (url = File.join(volume_root, *MKEXT_PPC)))
      system(Utility::DITTO, *KEXTCACHE_DEFAULT_OPTIONS, *%w{ -a ppc -a i386 }, "-mkext", url, "-kernel", mach_kernel, "-volume-root", volume_root, "--", File.join(volume_root, *EXTENSIONS))
    else
      puts "kextcache aborted: unknown kernel cache type"
      return
    end
    puts "Updated: #{url}"
  else
    opoo "kextcache aborted: mach_kernel not found"
  end
end