From 10a79884daf1fee6cab349b54292b79401b7154c Mon Sep 17 00:00:00 2001
From: mswgen <54498184+mswgen@users.noreply.github.com>
Date: Tue, 9 Nov 2021 16:22:25 +0900
Subject: [PATCH] release 1.0.8
---
README.md | 15 ++++--------
package.json | 2 +-
src/index.ts | 65 ++++++++++++++++++++++++++++++++++++++++++++++---
src/renderer.ts | 7 ++++--
yarn.lock | 36 +++++++++++++--------------
5 files changed, 90 insertions(+), 35 deletions(-)
diff --git a/README.md b/README.md
index 6b2a375..fb409bf 100644
--- a/README.md
+++ b/README.md
@@ -80,6 +80,9 @@ OpenCore Updater doesn't update all kexts, but it will update the ones that are
* BrcmPatchRAM
* BrcmPatchRAM2
* BrcmPatchRAM3
+* AtherosE2200Ethernet
+* USBInjectAll
+* XHCI-unsupported
all other kexts (including USBInjectAll, XHCI-Unsupported, VoodooRMI, etc.) will not be updated. However, there might be a newer version of those kexts. If this is the case, you should update them manually.
@@ -112,17 +115,9 @@ If you want to update to 0.6.6, you need to manually remove the boot entry. You
1. Run OpenCore Updater again.
1. Now, the warning will not appear.
-### After updating, OpenCore Configurator cannot read config.plist
+### After updating, OpenCore Configurator, Xcode, and PlistEdit Pro cannot read config.plist
-This is not a bug of OpenCore Updater. It's a bug of OpenCore Configurator. It occurs because:
-
-1. When updating, OpenCore Updater reads config.plist, parse it as JavaScript object, make necessary changes, build it as plist again, and write it back to config.plist.
-1. OpenCore Updater uses [plist](https://npmjs.com/package/plist) NPM module to read and write config.plist.
-1. The plist module writes empty data as `` and empty string as ``.
-1. However, due to a bug in OpenCore Configurator, it thinks that `` and `` are different. They are actually the same.
-1. Therefore, OpenCore Configurator cannot read config.plist.
-
-However, since many people are using OpenCore Configurator, I will fix this bug soon.
+Fixed in 1.0.8. If you are using older versions of OpenCore Updater, update it to 1.0.8.
## How to build
diff --git a/package.json b/package.json
index a1c90b1..6f4d896 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "oc-updater",
"productName": "OpenCore Updater",
- "version": "1.0.7",
+ "version": "1.0.8",
"description": "OpenCore Updater",
"main": "dist/index.js",
"scripts": {
diff --git a/src/index.ts b/src/index.ts
index 298beb8..9e4e5e9 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -129,6 +129,15 @@ electron.ipcMain.on('download-kexts', (evt, kexts) => {
if (kexts.includes('RealtekRTL8111.kext')) {
cp.execSync(`cd ~; mkdir -p .oc-update/${PID}; cd .oc-update/${PID}; curl -L -s -o RealtekRTL8111-V2.4.2.zip https://github.com/Mieze/RTL8111_driver_for_OS_X/releases/download/2.4.2/RealtekRTL8111-V2.4.2.zip; mkdir RealtekRTL8111-V2.4.2; cd RealtekRTL8111-V2.4.2; unzip ../RealtekRTL8111-V2.4.2.zip`);
}
+ if (kexts.includes('AtherosE2200Ethernet.kext')) {
+ cp.execSync(`cd ~; mkdir -p .oc-update/${PID}; cd .oc-update/${PID}; curl -L -s -o AtherosE2200Ethernet-V2.2.2.zip https://github.com/Mieze/AtherosE2200Ethernet/releases/download/2.2.2/AtherosE2200Ethernet-V2.2.2.zip; mkdir AtherosE2200Ethernet-V2.2.2; cd AtherosE2200Ethernet-V2.2.2; unzip ../AtherosE2200Ethernet-V2.2.2.zip`);
+ }
+ if (kexts.includes('USBInjectAll.kext')) {
+ cp.execSync(`cd ~; mkdir -p .oc-update/${PID}; cd .oc-update/${PID}; curl -L -s -o RehabMan-USBInjectAll-2018-1108.zip https://bitbucket.org/RehabMan/os-x-usb-inject-all/downloads/RehabMan-USBInjectAll-2018-1108.zip; mkdir RehabMan-USBInjectAll-2018-1108; cd RehabMan-USBInjectAll-2018-1108; unzip ..RehabMan-USBInjectAll-2018-1108.zip`);
+ }
+ if (kexts.includes('XHCI-unsupported.kext')) {
+ cp.execSync(`cd ~; mkdir -p .oc-update/${PID}; cd .oc-update/${PID}; curl -L -s -o OS-X-USB-Inject-All-master.zip https://github.com/RehabMan/OS-X-USB-Inject-All/archive/refs/heads/master.zip; mkdir OS-X-USB-Inject-All-master; cd OS-X-USB-Inject-All-master; unzip ../OS-X-USB-Inject-All-master.zip`);
+ }
if (kexts.includes('IntelMausi.kext')) {
cp.execSync(`cd ~; mkdir -p .oc-update/${PID}; cd .oc-update/${PID}; curl -L -s -o IntelMausi-1.0.7-RELEASE.zip https://github.com/acidanthera/IntelMausi/releases/download/1.0.7/IntelMausi-1.0.7-RELEASE.zip; mkdir IntelMausi-1.0.7-RELEASE; cd IntelMausi-1.0.7-RELEASE; unzip ../IntelMausi-1.0.7-RELEASE.zip`);
}
@@ -259,6 +268,15 @@ electron.ipcMain.on('swap-files', (evt, dir, kexts) => {
if (kexts.includes('RealtekRTL8111.kext')) {
cp.execSync(`cp -r "${os.homedir()}/.oc-update/${PID}/RealtekRTL8111-V2.4.2/RealtekRTL8111-V2.4.2/Release/RealtekRTL8111.kext" "${dir}/OC/Kexts"`);
}
+ if (kexts.includes('AtherosE2200Ethernet.kext')) {
+ cp.execSync(`cp -r "${os.homedir()}/.oc-update/${PID}/AtherosE2200Ethernet-V2.2.2/AtherosE2200Ethernet-V2.2.2/Release/AtherosE2200Ethernet.kext" "${dir}/OC/Kexts"`);
+ }
+ if (kexts.includes('USBInjectAll.kext')) {
+ cp.execSync(`cp -r "${os.homedir()}/.oc-update/${PID}/RehabMan-USBInjectAll-2018-1108/Release/USBInjectAll.kext" "${dir}/OC/Kexts"`);
+ }
+ if (kexts.includes('XHCI-unsupported.kext')) {
+ cp.execSync(`cp -r "${os.homedir()}/.oc-update/${PID}/OS-X-USB-Inject-All-master/OS-X-USB-Inject-All-master/XHCI-unsupported.kext" "${dir}/OC/Kexts"`);
+ }
if (kexts.includes('IntelMausi.kext')) {
cp.execSync(`cp -r "${os.homedir()}/.oc-update/${PID}/IntelMausi-1.0.7-RELEASE/IntelMausi.kext" "${dir}/OC/Kexts"`);
}
@@ -345,17 +363,56 @@ electron.ipcMain.on('update-config-plist', (evt, efidir, ocver) => {
}
ocver++;
}
- const plistParsed: any = plist.parse(fs.readFileSync(`${efidir}/OC/config.plist`, 'utf8'));
+ const plistParsed: any = plist.parse(fs.readFileSync(`${efidir}/OC/${fs.existsSync(`${efidir}/OC/config.plist`) ? 'c' : 'C'}onfig.plist`, 'utf8'));
if (plistParsed.Misc.Security.Vault != 'Optional') {
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';
return;
}
evt.returnValue = 'success'
});
-electron.ipcMain.on('finish', evt => {
+electron.ipcMain.on('finish', (evt, efidir) => {
cp.execSync(`rm -rf ${os.homedir()}/.oc-update/${PID}`);
- evt.returnValue = `${os.homedir()}/EFI-${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');
+ // don't parse plistRaw
+ // in plistRaw, replace all to
+ // replace all to
+ // do the same for all and
+ // don't use regex, instead use while true and break
+ while (true) {
+ if (plistRaw.includes('')) {
+ plistRaw = plistRaw.replace('', '');
+ } else {
+ break;
+ }
+ }
+ while (true) {
+ if (plistRaw.includes('')) {
+ plistRaw = plistRaw.replace('', '');
+ } else {
+ break;
+ }
+ }
+ while (true) {
+ if (plistRaw.includes('')) {
+ plistRaw = plistRaw.replace('', '');
+ } else {
+ break;
+ }
+ }
+ while (true) {
+ if (plistRaw.includes('')) {
+ plistRaw = plistRaw.replace('', '');
+ } else {
+ break;
+ }
+ }
+ // write plistRaw back
+ fs.writeFileSync(`${efidir}/OC/${fs.existsSync(`${efidir}/OC/config.plist`) ? 'c' : 'C'}onfig.plist`, plistRaw);
+ evt.returnValue = `${os.homedir()}/EFI-${PID}`;
});
electron.ipcMain.on('check-bootstrap', (evt, efidir) => {
// read ${efidir}/OC directory, if Bootstrap directory doesn't exist, return false
@@ -366,7 +423,7 @@ electron.ipcMain.on('check-bootstrap', (evt, efidir) => {
evt.returnValue = false;
return;
}
- const plistParsed: any = plist.parse(fs.readFileSync(`${efidir}/OC/config.plist`, 'utf8'));
+ const plistParsed: any = plist.parse(fs.readFileSync(`${efidir}/OC/${fs.existsSync(`${efidir}/OC/config.plist`) ? 'c' : 'C'}onfig.plist`, 'utf8'));
if (plistParsed.Misc.Security.BootProtect == 'Bootstrap' || plistParsed.Misc.Security.BootProtect == 'BootstrapShort') {
evt.returnValue = true;
return;
diff --git a/src/renderer.ts b/src/renderer.ts
index ab2c5f8..55e9256 100644
--- a/src/renderer.ts
+++ b/src/renderer.ts
@@ -49,7 +49,7 @@ Do you want to contnue?`)) ipc.send('quit');
const vaultResult = ipc.sendSync('update-config-plist', efidir, ocverNum);
document.querySelector('#progress')!.innerHTML = '7/7. Cleaning up...'
await sleep(1000);
- const backupLoc = ipc.sendSync('finish', efidir, ocverNum);
+ const backupLoc = ipc.sendSync('finish', efidir);
const kextsNotUpdated = kexts.filter((x: string) => !([
'VirtualSMC.kext',
'SMCProcessor.kext',
@@ -88,7 +88,10 @@ Do you want to contnue?`)) ipc.send('quit');
'BrcmNonPatchRAM2.kext',
'BrcmPatchRAM.kext',
'BrcmPatchRAM2.kext',
- 'BrcmPatchRAM3.kext'
+ 'BrcmPatchRAM3.kext',
+ 'AtherosE2200Ethernet.kext',
+ 'USBInjectAll.kext',
+ 'XHCI-unsupported.kext'
].includes(x)))
if (kextsNotUpdated.length > 0) {
document.querySelector('#kexts-not-updated')!.innerHTML = kextsNotUpdated.join('
');
diff --git a/yarn.lock b/yarn.lock
index 235264c..735adaf 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -104,14 +104,14 @@
integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==
"@types/node@*", "@types/node@^16.11.6":
- version "16.11.6"
- resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.6.tgz#6bef7a2a0ad684cf6e90fcfe31cecabd9ce0a3ae"
- integrity sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==
+ version "16.11.7"
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.7.tgz#36820945061326978c42a01e56b61cd223dfdc42"
+ integrity sha512-QB5D2sqfSjCmTuWcBWyJ+/44bcjO7VbjSbOE0ucoVbAsSNQc4Lt6QkgkVXkTDwkL4z/beecZNDvVX15D4P8Jbw==
"@types/node@^14.6.2":
- version "14.17.32"
- resolved "https://registry.yarnpkg.com/@types/node/-/node-14.17.32.tgz#2ca61c9ef8c77f6fa1733be9e623ceb0d372ad96"
- integrity sha512-JcII3D5/OapPGx+eJ+Ik1SQGyt6WvuqdRfh9jUwL6/iHGjmyOriBDciBUu7lEIBTL2ijxwrR70WUnw5AEDmFvQ==
+ version "14.17.33"
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-14.17.33.tgz#011ee28e38dc7aee1be032ceadf6332a0ab15b12"
+ integrity sha512-noEeJ06zbn3lOh4gqe2v7NMGS33jrulfNqYFDjjEbhpDEHR5VTxgYNQSBqBlJIsBJW3uEYDgD6kvMnrrhGzq8g==
"@types/plist@^3.0.1":
version "3.0.2"
@@ -721,9 +721,9 @@ electron-publish@22.13.1:
mime "^2.5.2"
electron@^15.3.0:
- version "15.3.0"
- resolved "https://registry.yarnpkg.com/electron/-/electron-15.3.0.tgz#f9803c5a05b2dac12efc6d4203492c7e204b4819"
- integrity sha512-YLzaKCFmSniNlz9+NUTNs7ssPyDc+bYOCYZ0b/D6DjVkOeIFz4SR8EYKqlOc8TcqlDNu18BbWqz6zbJPyAAURg==
+ version "15.3.1"
+ resolved "https://registry.yarnpkg.com/electron/-/electron-15.3.1.tgz#38ce9dfcd4ec51a33d62de23de15fb5ceeaea25d"
+ integrity sha512-6/qp3Dor7HSGq28qhJEVD1zBFZoWicmo3/ZLvo7rhXPPZFwEMSJGPMEZM9WYSfWW4t/OozpWNuuDe970cF7g2Q==
dependencies:
"@electron/get" "^1.13.0"
"@types/node" "^14.6.2"
@@ -787,9 +787,9 @@ extract-zip@^1.0.3:
yauzl "^2.10.0"
extsprintf@^1.2.0:
- version "1.4.0"
- resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f"
- integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8=
+ version "1.4.1"
+ resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.1.tgz#8d172c064867f235c0c84a596806d279bf4bcc07"
+ integrity sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA==
fast-deep-equal@^3.1.1:
version "3.1.3"
@@ -1212,9 +1212,9 @@ matcher@^3.0.0:
escape-string-regexp "^4.0.0"
mime@^2.5.2:
- version "2.5.2"
- resolved "https://registry.yarnpkg.com/mime/-/mime-2.5.2.tgz#6e3dc6cc2b9510643830e5f19d5cb753da5eeabe"
- integrity sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==
+ version "2.6.0"
+ resolved "https://registry.yarnpkg.com/mime/-/mime-2.6.0.tgz#a2a682a95cd4d0cb1d6257e28f83da7e35800367"
+ integrity sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==
mimic-response@^1.0.0, mimic-response@^1.0.1:
version "1.0.1"
@@ -1739,9 +1739,9 @@ util-deprecate@~1.0.1:
integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=
verror@^1.10.0:
- version "1.10.0"
- resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400"
- integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=
+ version "1.10.1"
+ resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.1.tgz#4bf09eeccf4563b109ed4b3d458380c972b0cdeb"
+ integrity sha512-veufcmxri4e3XSrT0xwfUR7kguIkaxBeosDg00yDWhk49wdwkSUrvvsm7nc75e1PUyvIeZj6nS8VQRYz2/S4Xg==
dependencies:
assert-plus "^1.0.0"
core-util-is "1.0.2"