Skip to content

Commit

Permalink
improve performance, support OC 0.9.8
Browse files Browse the repository at this point in the history
  • Loading branch information
dropdb220 committed Feb 6, 2024
1 parent 69eb333 commit 323fd46
Show file tree
Hide file tree
Showing 44 changed files with 255 additions and 162 deletions.
Binary file not shown.
5 changes: 3 additions & 2 deletions README-ko.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ OpenCore Updater는 모든 kext를 업데이트하지 않고, 앱 내부 리스
* RestrictEvents
* CpuTopologyRebuild
* AirportBrcmFixup
* BrcmPatchRAM kexts
* BrcmPatchRAM 관련 kext
* BlueToolFixup
* BrcmBluetoothInjector
* BrcmBluetoothInjectorLegacy
Expand All @@ -108,6 +108,7 @@ OpenCore Updater는 모든 kext를 업데이트하지 않고, 앱 내부 리스
### 앱 자동 업데이트

이 앱은 자동 업데이트를 지원합니다. 업데이트가 있을 경우 백그라운드에서 다운로드 후 알림이 뜨며, 앱을 닫으면 업데이트가 설치됩니다.
앱을 닫고 업데이트가 설치되기까지 시간이 오래 걸릴 수 있습니다. 앱을 다시 열었는데 업데이트되지 않았다면 알림이 뜰 때 앱을 닫고 1분 정도 기다렸다가 다시 열어주세요.

### 0.6.5에서 0.6.6으로 업데이트할 때 경고가 뜰 경우

Expand Down Expand Up @@ -137,7 +138,7 @@ Bootstrap을 사용하지 않았다면 이 메세지는 뜨지 않습니다. 하
1. `yarn`을 실행해서 의존성 패키지를 설치하세요.
1. 개발용으로 앱을 열려면 `yarn start`를 실행하세요.
1. `yarn build` 를 실행해서 앱을 빌드하세요. Mac이나 해킨토시가 필요합니다.
1. `out` 디렉토리에 DMG가 있어요. 이 앱은 Intel Mac(해킨토시 포함)과 Apple Sillicon Mac에서 실행할 수 있어요.
1. `out` 디렉토리에 DMG가 있습니다. 이 앱은 Intel Mac(해킨토시 포함)과 Apple Sillicon Mac에서 실행할 수 있습니다.

## 크레딧

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ If you are not using the latest version of OpenCore, the app will ask you to upd

The app will start to download OpenCore, kexts, and Binary Data. this might take some time and you might see the spinning beach ball. DO NOT CLOSE THE APP.

When the app finishes downloading, it will create a backup of your old EFI and will swap files with the new ones.
When the app finishes downloading, it will create a backup of your old EFI and will replace files with the new ones.

Then, it will update config.plist. When it's done, it will display that it's done. It will also display the list of not updated kexts, the backup directory, and that OpenCore Vault is disabled(if it was enabled). You need to reboot your computer to see the changes.

Expand Down Expand Up @@ -109,6 +109,8 @@ all other kexts will not be updated. However, there might be a newer version of

Auto update is supported. When there's a new version of the app, the app will automatically download it in the background. Then, it will notify you about that. Update will be automatically applied when you close the app.

It may take some time to install the update. If you open the app and the update is not applied, wait for the notification, close the app, wait about 1 minute, and open the app again.

### When updating from 0.6.5 to 0.6.6, I get a warning

In 0.6.6, config.plist - Misc - Security - BootProtect and /EFI/OC/Bootstrap/Bootstrap.efi are changed to config.plist - Misc - Boot - LauncherOption.
Expand Down
Binary file modified build/icon.icns
Binary file not shown.
13 changes: 11 additions & 2 deletions electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,25 @@
"!out",
"!etc"
],
"buildNumber": "2",
"mac": {
"category": "public.app-category-utilities",
"electronLanguages": [
"en_US",
"ko"
],
"target": [
{
"target": "dmg",
"arch": ["universal"]
"arch": [
"universal"
]
},
{
"target": "zip",
"arch": ["universal"]
"arch": [
"universal"
]
}
],
"icon": "build/icon.icns"
Expand Down
4 changes: 4 additions & 0 deletions increase_build_num.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const fs = require('fs');
let file = JSON.parse(fs.readFileSync('electron-builder.json', 'utf8'));
file.buildNumber = (parseInt(file.buildNumber) + 1).toString();
fs.writeFileSync('electron-builder.json', JSON.stringify(file, null, 4));
21 changes: 11 additions & 10 deletions index-korean.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,22 @@
<div id="get-started">
<img src="./Logo.png" alt="OpenCore Logo" height="30%" width="30%">
<h1>OpenCore Updater</h1>
<h2>지원되는 최신 버전: 0.9.7</h2>
<h2>지원되는 최신 버전: 0.9.8</h2>
<button id="start">시작하기</button>
</div>
<div id="select-opencore-version">
<h1>OpenCore 버전 선택</h1>
<p>OpenCore 버전을 없어요. 아래에서 버전을 선택해주세요.</p>
<p>하지만 몇 가지 제한 사항이 있어요:</p>
<p>OpenCore 버전을 확인할없습니다. 아래에서 버전을 선택해주세요.</p>
<p>제한 사항:</p>
<ul>
<li>DEBUG 빌드는 RELEASE 빌드로 변경됩니다.</li>
<li>32비트 버전은 64비트 버전으로 변경됩니다.</li>
<li>OpenCore vault가 비활성화됩니다. 이 경우 config.plist-Misc-Security-Vault가 Optional로 바뀝니다.</li>
<li>0.6.3 미만의 버전은 지원되지 않습니다.</li>
</ul>
<select id="oc-version-selection">
<option value="0.9.7" selected>0.9.7</option>
<option value="0.9.8" selected>0.9.8</option>
<option value="0.9.7">0.9.7</option>
<option value="0.9.6">0.9.6</option>
<option value="0.9.5">0.9.5</option>
<option value="0.9.4">0.9.4</option>
Expand Down Expand Up @@ -66,16 +67,16 @@ <h1>OpenCore 버전 선택</h1>
</div>
<div id="efiinfo">
<h1>EFI 정보</h1>
<p>최신 버전: 0.9.7</p>
<p>최신 버전: 0.9.8</p>
<p>현재 버전: <span id="oc-version"></span></p>
<p>사용 중인 kext:</p>
<div id="using-kexts"></div>
<p id="is-outdated">최신 버전의 OpenCore를 사용하고 있어요.</p>
<p id="is-outdated">최신 버전의 OpenCore를 사용하고 있습니다.</p>
<button id="update">업데이트</button>
</div>
<div id="update-in-progress">
<h1>업데이트 중...</h1>
<p>EFI를 업데이트하고 있어요.</p>
<p>EFI를 업데이트하고 있습니다.</p>
<br><br>
<p id="progress">1/7. OpenCore 다운로드 중...</p>
<!--
Expand All @@ -91,10 +92,10 @@ <h1>업데이트 중...</h1>
<div id="success">
<img src="checkmark-flat.png" alt="checkmark" height="30%" width="30%">
<h1>업데이트 완료</h1>
<p>OpenCore가 업데이트되었어요. <span id="kexts-not-updated-exists">하지만 다음 kext는 업데이트되지 않았지만, 최신 버전이 있을 수 있어요:</span></p>
<p>OpenCore가 업데이트되었습니다. <span id="kexts-not-updated-exists">하지만 다음 kext는 업데이트되지 않았지만, 최신 버전이 있을 수 있습니다:</span></p>
<p id="kexts-not-updated"></p>
<p id="vault-removed">OpenCore vault가 감지되어 config.plist-Misc-Security-Vault가 Optional로 변경되었어요. OpenCore vault를 사용하려면 vault를 다시 만들어주세요.</p>
<p>기존 EFI의 백업은 <span id="backup-location"></span>있어요.</p>
<p id="vault-removed">OpenCore vault가 감지되어 config.plist-Misc-Security-Vault가 Optional로 변경되었습니다. OpenCore vault를 사용하려면 vault를 다시 만들어주세요.</p>
<p>기존 EFI의 백업이 <span id="backup-location"></span>생성되었습니다.</p>
</div>
</body>

Expand Down
2 changes: 1 addition & 1 deletion index.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
}
body {
text-align: center;
font-family: -apple-system, 'Apple SD Gothic Neo', 'Helvetica Neue', sans-serif;
font-family: -apple-system, 'SF Pro', 'Apple SD Gothic Neo', 'Helvetica Neue', sans-serif;
}

li {
Expand Down
7 changes: 4 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div id="get-started">
<img src="./Logo.png" alt="OpenCore Logo" height="30%" width="30%">
<h1>OpenCore Updater</h1>
<h2>Current supported version: 0.9.7</h2>
<h2>Current supported version: 0.9.8</h2>
<button id="start">Get started</button>
</div>
<div id="select-opencore-version">
Expand All @@ -26,7 +26,8 @@ <h1>Select OpenCore version</h1>
<li>Versions older than 0.6.3 are not supported.</li>
</ul>
<select id="oc-version-selection">
<option value="0.9.7" selected>0.9.7</option>
<option value="0.9.8" selected>0.9.8</option>
<option value="0.9.7">0.9.7</option>
<option value="0.9.6">0.9.6</option>
<option value="0.9.5">0.9.5</option>
<option value="0.9.4">0.9.4</option>
Expand Down Expand Up @@ -66,7 +67,7 @@ <h1>Select OpenCore version</h1>
</div>
<div id="efiinfo">
<h1>Your EFI info</h1>
<p>Latest version is 0.9.7.</p>
<p>Latest version is 0.9.8.</p>
<p>Your OpenCore version is <span id="oc-version"></span>.</p>
<p>You're using the following kexts:</p>
<div id="using-kexts"></div>
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "oc-updater",
"productName": "OpenCore Updater",
"version": "1.2.23",
"version": "1.3.0",
"description": "OpenCore Updater",
"main": "dist/index.js",
"scripts": {
"start": "tsc && electron .",
"build": "tsc && electron-builder -c -m"
"build": "tsc && node increase_build_num.js && electron-builder -c -m"
},
"repository": {
"type": "git",
Expand Down
48 changes: 25 additions & 23 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import electron, { app } from 'electron';
import electron, { BrowserWindow, app } from 'electron';
import path from 'path';
import fs from 'fs';
import crypto from 'crypto';
Expand All @@ -9,6 +9,8 @@ import util from 'util';
import { autoUpdater } from 'electron-updater';
const PID = Math.floor(Math.random() * 1000000);
const checksums = {
'2b522620488affbc71bab1057e020309f5af4335138e730770f3a8f9f32a7d1c': '0.9.8',
'3c4fe37014381aa7f4e4e88b2110280982c5f6fb7ae96ec9dab7b7c8d8f3097e': '0.9.8',
'd5c1a8ab4f8c29a2967dc363ddbe671cbb711546e7edde015a37dd50171f8109': '0.9.7',
'17cb2c28ee3d32566a9c31c4238ff6ad4d4d1f5d83d5c799cd12265f5c626772': '0.9.7',
'bc5a6c8fbd2cbfc7f41fc256bc4eb7c9fc16d30fa5d250d06e6dd6f21902ddc3': '0.9.6',
Expand Down Expand Up @@ -69,11 +71,11 @@ const checksums = {
'dc2381c5ab49ac79ed6be75f9867c5933e6f1e88cb4e860359967fc5ee4916e3': '0.6.3'
}
const versions = {
OpenCore: ['0.9.7', 97],
OpenCore: ['0.9.8', 98],
VirtualSMC: '1.3.2',
Lilu: '1.6.7',
WhateverGreen: '1.6.6',
AppleALC: '1.8.8',
AppleALC: '1.8.9',
VoodooPS2Controller: '2.3.5',
VoodooI2C: '2.8',
ECEnabler: '1.0.4',
Expand Down Expand Up @@ -120,8 +122,8 @@ autoUpdater.requestHeaders = { 'Cache-Control' : 'no-store, no-cache, must-reval
electron.app.whenReady().then(() => {
createWindow();
autoUpdater.checkForUpdatesAndNotify({
title: app.getLocale() == 'ko' ? '업데이트를 설치할 준비가 완료되었어요.' : 'An update is ready to install.',
body: app.getLocale() == 'ko' ? '{appName} 버전 {version}이 다운로드되었으며, 앱 종료 시 자동으로 설치돼요.' : '{appName} version {version} has been downloaded and will be automatically installed on exit'
title: app.getLocale() == 'ko' ? '업데이트를 설치할 준비가 완료되었습니다.' : 'An update is ready to install.',
body: app.getLocale() == 'ko' ? '{appName} 버전 {version}이 다운로드되었으며, 앱 종료 시 자동으로 설치됩니다.' : '{appName} version {version} has been downloaded and will be automatically installed on exit'
});
electron.app.on('activate', (_, hasVisibleWindows) => {
if (!hasVisibleWindows) createWindow();
Expand All @@ -133,7 +135,7 @@ electron.ipcMain.on('select-efi-directory', evt => {
title: 'Select EFI directory',
buttonLabel: app.getLocale() == 'ko' ? '선택하기' : 'Select',
properties: ['openDirectory', 'showHiddenFiles'],
message: app.getLocale() == 'ko' ? '업데이트할 EFI 디렉토리를 선택해주세요. 디렉토리 바로 아래에 BOOT와 OC 디렉토리가 있어야 해요.' : 'Select EFI directory to update. Directory should contain BOOT and OC directories.'
message: app.getLocale() == 'ko' ? '업데이트할 EFI 디렉토리를 선택해주세요. 디렉토리 바로 아래에 BOOT와 OC 디렉토리가 있어야 합니다.' : 'Select EFI directory to update. Directory should contain BOOT and OC directories.'
});
if (!dir) {
evt.returnValue = 'cancel button pressed';
Expand Down Expand Up @@ -173,9 +175,9 @@ electron.ipcMain.on('check-opencore-version', (evt, ocfile) => {
electron.ipcMain.on('kextinfo', (evt, kextdir) => {
evt.returnValue = fs.readdirSync(kextdir).filter(x => x.endsWith('.kext')).filter(x => !x.startsWith('._'));
});
electron.ipcMain.on('download-oc', evt => {
cp.execSync(`cd ~; mkdir -p .oc-update/${PID}; cd .oc-update/${PID}; curl -L -s -o OpenCore.zip https://github.com/acidanthera/OpenCorePkg/releases/download/${versions.OpenCore[0]}/OpenCore-${versions.OpenCore[0]}-RELEASE.zip; mkdir OpenCore; cd OpenCore; unzip ../OpenCore.zip`);
evt.returnValue = 'success';
electron.ipcMain.on('download-oc', async evt => {
await cpexec(`cd ~; mkdir -p .oc-update/${PID}; cd .oc-update/${PID}; curl -L -s -o OpenCore.zip https://github.com/acidanthera/OpenCorePkg/releases/download/${versions.OpenCore[0]}/OpenCore-${versions.OpenCore[0]}-RELEASE.zip; mkdir OpenCore; cd OpenCore; unzip ../OpenCore.zip`);
evt.reply('downloaded-oc');
});
electron.ipcMain.on('download-kexts', async (evt, kexts) => {
let kextsToDownload: Array<{
Expand Down Expand Up @@ -380,19 +382,19 @@ electron.ipcMain.on('download-kexts', async (evt, kexts) => {
await Promise.all(kextsToDownload.map(async (kext) => {
await cpexec(`cd ~; mkdir -p .oc-update/${PID}; cd .oc-update/${PID}; curl -L -s -o ${kext.name}.zip ${kext.url}; mkdir ${kext.name}; cd ${kext.name}; unzip ../${kext.name}.zip`);
}));
evt.returnValue = 'success';
evt.reply('downloaded-kexts');
});
electron.ipcMain.on('download-bindata', evt => {
cp.execSync(`cd ~; mkdir -p .oc-update/${PID}; cd .oc-update/${PID}; curl -L -s -o OcBinaryData-master.zip https://github.com/acidanthera/OcBinaryData/archive/refs/heads/master.zip; mkdir OcBinaryData-master; cd OcBinaryData-master; unzip ../OcBinaryData-master.zip`);
evt.returnValue = 'success';
electron.ipcMain.on('download-bindata', async evt => {
await cpexec(`cd ~; mkdir -p .oc-update/${PID}; cd .oc-update/${PID}; curl -L -s -o OcBinaryData-master.zip https://github.com/acidanthera/OcBinaryData/archive/refs/heads/master.zip; mkdir OcBinaryData-master; cd OcBinaryData-master; unzip ../OcBinaryData-master.zip`);
evt.reply('downloaded-bindata');
});
electron.ipcMain.on('create-backup', (evt, dir, oldver) => {
if (!fs.existsSync(`${os.homedir()}/EFI Backup`) || !fs.lstatSync(`${os.homedir()}/EFI Backup`).isDirectory()) fs.mkdirSync(`${os.homedir()}/EFI Backup`);
backupDir = `${os.homedir()}/EFI Backup/OC ${oldver}`;
cp.execSync(`mkdir -p "${backupDir}"; cp -r "${dir}" "${backupDir}"`);
evt.returnValue = 'success';
evt.reply('created-backup');
});
electron.ipcMain.on('swap-files', (evt, dir, kexts) => {
electron.ipcMain.on('update-files', (evt, dir, kexts) => {
fs.copyFileSync(`${os.homedir()}/.oc-update/${PID}/OpenCore/X64/EFI/BOOT/BOOTx64.efi`, `${dir}/BOOT/BOOTx64.efi`);
fs.copyFileSync(`${os.homedir()}/.oc-update/${PID}/OpenCore/X64/EFI/OC/OpenCore.efi`, `${dir}/OC/OpenCore.efi`);
if (fs.existsSync(`${dir}/OC/Tools/VerifyMsrE2.efi`)) fs.renameSync(`${dir}/OC/Tools/VerifyMsrE2.efi`, `${dir}/OC/Tools/ControlMsrE2.efi`);
Expand Down Expand Up @@ -594,17 +596,17 @@ electron.ipcMain.on('swap-files', (evt, dir, kexts) => {
if (kexts.includes("RealtekCardReaderFriend.kext")) {
cp.execSync(`cp -r "${os.homedir()}/.oc-update/${PID}/RealtekCardReaderFriend/RealtekCardReaderFriend.kext" "${dir}/OC/Kexts"`);
}
evt.returnValue = 'success'
evt.reply('updated-files');
});
electron.ipcMain.on('update-config-plist', (evt, efidir, ocver) => {
electron.ipcMain.on('update-config-plist', async (evt, efidir, ocver) => {
while (true) {
if (ocver == versions.OpenCore[1]) break;
console.log(updates[ocver.toString()]);
if (updates[ocver.toString()].configPlistChange) {
if (fs.readdirSync(`${efidir}/OC`).includes('config.plist')) {
updates[ocver.toString()].exec(`${efidir}/OC/config.plist`, PID);
await updates[ocver.toString()].exec(`${efidir}/OC/config.plist`, app, electron.ipcMain, window.webContents, PID);
} else if (fs.readdirSync(`${efidir}/OC`).includes('Config.plist')) {
updates[ocver.toString()].exec(`${efidir}/OC/Config.plist`, PID);
await updates[ocver.toString()].exec(`${efidir}/OC/Config.plist`, app, electron.ipcMain, window.webContents, PID);
}
}
ocver++;
Expand All @@ -614,12 +616,12 @@ electron.ipcMain.on('update-config-plist', (evt, efidir, ocver) => {
plistParsed.Misc.Security.Vault = 'Optional';
// build plistParsed, and write it back to file
fs.writeFileSync(`${efidir}/OC/${fs.existsSync(`${efidir}/OC/config.plist`) ? 'c' : 'C'}onfig.plist`, plist.build(plistParsed));
evt.returnValue = 'vault-disabled';
evt.reply('updated-config-plist', true);
return;
}
evt.returnValue = 'success'
evt.reply('updated-config-plist', false);
});
electron.ipcMain.on('finish', (evt, efidir) => {
electron.ipcMain.on('finish', (evt, vaultResult, efidir) => {
cp.execSync(`rm -rf ${os.homedir()}/.oc-update/${PID}`);
// read config.plist or Config.plist and assign to plistRaw (type string)
let plistRaw: string = fs.readFileSync(`${efidir}/OC/${fs.existsSync(`${efidir}/OC/config.plist`) ? 'c' : 'C'}onfig.plist`, 'utf8');
Expand Down Expand Up @@ -658,7 +660,7 @@ electron.ipcMain.on('finish', (evt, efidir) => {
}
// write plistRaw back
fs.writeFileSync(`${efidir}/OC/${fs.existsSync(`${efidir}/OC/config.plist`) ? 'c' : 'C'}onfig.plist`, plistRaw);
evt.returnValue = backupDir;
evt.reply('finished', vaultResult, backupDir);
});
electron.ipcMain.on('check-bootstrap', (evt, efidir) => {
// read ${efidir}/OC directory, if Bootstrap directory doesn't exist, return false
Expand Down
2 changes: 1 addition & 1 deletion src/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ electron.contextBridge.exposeInMainWorld('electron', {
ipcRenderer: {
send: electron.ipcRenderer.send,
sendSync: electron.ipcRenderer.sendSync,
on: electron.ipcRenderer.on,
on: (channel, func) => electron.ipcRenderer.on(channel, func),
once: electron.ipcRenderer.once
}
});
Loading

0 comments on commit 323fd46

Please sign in to comment.