From a9be25fc4a22cef204a780cfd30910664d1bcda4 Mon Sep 17 00:00:00 2001 From: Miccal Matthews Date: Tue, 24 Jan 2017 13:44:48 +0800 Subject: [PATCH] Update java9-beta.rb (#3178) Update java9-beta to use `system_command`. --- Casks/java9-beta.rb | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/Casks/java9-beta.rb b/Casks/java9-beta.rb index f51f7a17e..0a8baef60 100644 --- a/Casks/java9-beta.rb +++ b/Casks/java9-beta.rb @@ -10,23 +10,32 @@ cask 'java9-beta' do pkg 'JDK 9.pkg' postflight do - system '/usr/bin/sudo', '-E', '--', - '/usr/libexec/PlistBuddy', '-c', 'Add :JavaVM:JVMCapabilities: string BundledApp', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Info.plist" - system '/usr/bin/sudo', '-E', '--', - '/usr/libexec/PlistBuddy', '-c', 'Add :JavaVM:JVMCapabilities: string JNI', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Info.plist" - system '/usr/bin/sudo', '-E', '--', - '/usr/libexec/PlistBuddy', '-c', 'Add :JavaVM:JVMCapabilities: string WebStart', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Info.plist" - system '/usr/bin/sudo', '-E', '--', - '/usr/libexec/PlistBuddy', '-c', 'Add :JavaVM:JVMCapabilities: string Applets', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Info.plist" - system '/usr/bin/sudo', '-E', '--', - '/bin/mkdir', '-p', '--', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Home/bundle/Libraries" - system '/usr/bin/sudo', '-E', '--', - '/bin/ln', '-nsf', '--', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Home/jre/lib/server/libjvm.dylib", "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Home/bundle/Libraries/libserver.dylib" + system_command '/usr/libexec/PlistBuddy', + args: ['-c', 'Add :JavaVM:JVMCapabilities: string BundledApp', "/Library/Java/JavaVirtualMachines/jdk#{version.minor}.jdk/Contents/Info.plist"], + sudo: true + system_command '/usr/libexec/PlistBuddy', + args: ['-c', 'Add :JavaVM:JVMCapabilities: string JNI', "/Library/Java/JavaVirtualMachines/jdk#{version.minor}.jdk/Contents/Info.plist"], + sudo: true + system_command '/usr/libexec/PlistBuddy', + args: ['-c', 'Add :JavaVM:JVMCapabilities: string WebStart', "/Library/Java/JavaVirtualMachines/jdk#{version.minor}.jdk/Contents/Info.plist"], + sudo: true + system_command '/usr/libexec/PlistBuddy', + args: ['-c', 'Add :JavaVM:JVMCapabilities: string Applets', "/Library/Java/JavaVirtualMachines/jdk#{version.minor}.jdk/Contents/Info.plist"], + sudo: true + system_command '/bin/mkdir', + args: ['-p', '--', "/Library/Java/JavaVirtualMachines/jdk#{version.minor}.jdk/Contents/Home/bundle/Libraries"], + sudo: true + system_command '/bin/ln', + args: ['-nsf', '--', "/Library/Java/JavaVirtualMachines/jdk#{version.minor}.jdk/Contents/Home/jre/lib/server/libjvm.dylib", "/Library/Java/JavaVirtualMachines/jdk#{version.minor}.jdk/Contents/Home/bundle/Libraries/libserver.dylib"], + sudo: true + if MacOS.version <= :mavericks - system '/usr/bin/sudo', '-E', '--', - '/bin/rm', '-rf', '--', '/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK' - system '/usr/bin/sudo', '-E', '--', - '/bin/ln', '-nsf', '--', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents", '/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK' + system_command '/bin/rm', + args: ['-rf', '--', '/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK'], + sudo: true + system_command '/bin/ln', + args: ['-nsf', '--', "/Library/Java/JavaVirtualMachines/jdk#{version.minor}.jdk/Contents", '/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK'], + sudo: true end end