mirror of
https://github.com/ragestudio/relic.git
synced 2025-06-09 10:34:18 +00:00
fix git for win
This commit is contained in:
parent
9447e182aa
commit
c3365616a5
@ -28,7 +28,8 @@
|
|||||||
"open": "8.4.2",
|
"open": "8.4.2",
|
||||||
"react-icons": "^4.11.0",
|
"react-icons": "^4.11.0",
|
||||||
"react-spinners": "^0.13.8",
|
"react-spinners": "^0.13.8",
|
||||||
"rimraf": "^5.0.5"
|
"rimraf": "^5.0.5",
|
||||||
|
"unzipper": "^0.10.14"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@electron-toolkit/eslint-config": "^1.0.1",
|
"@electron-toolkit/eslint-config": "^1.0.1",
|
||||||
|
@ -232,7 +232,7 @@ export default class PkgManager {
|
|||||||
fs.mkdirSync(_path, { recursive: true })
|
fs.mkdirSync(_path, { recursive: true })
|
||||||
|
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
const process = ChildProcess.exec(`git clone --recurse-submodules --remote-submodules ${step.url} ${_path}`, {
|
const process = ChildProcess.exec(`${global.GIT_PATH ?? "git"} clone --recurse-submodules --remote-submodules ${step.url} ${_path}`, {
|
||||||
shell: true,
|
shell: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -422,8 +422,6 @@ export default class PkgManager {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(manifest)
|
|
||||||
|
|
||||||
const packPath = manifest.install_path
|
const packPath = manifest.install_path
|
||||||
|
|
||||||
if (manifest.remote_url) {
|
if (manifest.remote_url) {
|
||||||
@ -446,8 +444,6 @@ export default class PkgManager {
|
|||||||
delete manifest.init
|
delete manifest.init
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(manifest)
|
|
||||||
|
|
||||||
if (typeof manifest.update === "function") {
|
if (typeof manifest.update === "function") {
|
||||||
sendToRenderer(`installation:status`, {
|
sendToRenderer(`installation:status`, {
|
||||||
...manifest,
|
...manifest,
|
||||||
@ -475,7 +471,7 @@ export default class PkgManager {
|
|||||||
})
|
})
|
||||||
|
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
const process = ChildProcess.exec(`git pull`, {
|
const process = ChildProcess.exec(`${global.GIT_PATH ?? "git"} pull`, {
|
||||||
cwd: _path,
|
cwd: _path,
|
||||||
shell: true,
|
shell: true,
|
||||||
})
|
})
|
||||||
|
@ -4,6 +4,8 @@ import os from "node:os"
|
|||||||
import ChildProcess from "node:child_process"
|
import ChildProcess from "node:child_process"
|
||||||
import { pipeline as streamPipeline } from "node:stream/promises"
|
import { pipeline as streamPipeline } from "node:stream/promises"
|
||||||
|
|
||||||
|
import unzipper from "unzipper"
|
||||||
|
|
||||||
import { extractFull } from "node-7z"
|
import { extractFull } from "node-7z"
|
||||||
|
|
||||||
import got from "got"
|
import got from "got"
|
||||||
@ -31,8 +33,8 @@ async function main() {
|
|||||||
fs.mkdirSync(binariesPath, { recursive: true })
|
fs.mkdirSync(binariesPath, { recursive: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
const sevenzip_exec = path.resolve(binariesPath, "7z-bin", process.platform === "win32" ? "7za.exe" : "7za")
|
let sevenzip_exec = path.resolve(binariesPath, "7z-bin", process.platform === "win32" ? "7za.exe" : "7za")
|
||||||
const git_exec = path.resolve(binariesPath, "git", process.platform === "win32" ? "git.exe" : "git")
|
let git_exec = path.resolve(binariesPath, "git-bin", "bin", process.platform === "win32" ? "git.exe" : "git")
|
||||||
|
|
||||||
if (!fs.existsSync(sevenzip_exec)) {
|
if (!fs.existsSync(sevenzip_exec)) {
|
||||||
global.win.webContents.send("initializing_text", "Downloading 7z binaries...")
|
global.win.webContents.send("initializing_text", "Downloading 7z binaries...")
|
||||||
@ -52,28 +54,32 @@ async function main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fs.existsSync(git_exec) && process.platform === "win32") {
|
if (!fs.existsSync(git_exec)) {
|
||||||
global.win.webContents.send("initializing_text", "Downloading GIT binaries...")
|
if (!process.platform === "win32") {
|
||||||
console.log(`Downloading git binaries...`)
|
git_exec = null
|
||||||
|
|
||||||
const tempPath = path.resolve(binariesPath, "git-bundle.7z")
|
|
||||||
|
|
||||||
fs.mkdirSync(path.resolve(binariesPath, "git"), { recursive: true })
|
|
||||||
|
|
||||||
let url = resolveDestBin(`https://storage.ragestudio.net/rstudio/binaries/git`, "git-bundle-2.4.0.7z")
|
|
||||||
|
|
||||||
await streamPipeline(
|
|
||||||
got.stream(url),
|
|
||||||
fs.createWriteStream(tempPath)
|
|
||||||
)
|
|
||||||
|
|
||||||
await extractFull(tempPath, path.resolve(binariesPath, "git"), {
|
|
||||||
$bin: sevenzip_exec
|
|
||||||
})
|
|
||||||
|
|
||||||
if (os.platform() !== "win32") {
|
|
||||||
ChildProcess.execSync("chmod +x " + git_exec)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const tempPath = path.resolve(binariesPath, "git-bundle.zip")
|
||||||
|
const binPath = path.resolve(binariesPath, "git-bin")
|
||||||
|
|
||||||
|
if (!fs.existsSync(tempPath)) {
|
||||||
|
global.win.webContents.send("initializing_text", "Downloading GIT binaries...")
|
||||||
|
console.log(`Downloading git binaries...`)
|
||||||
|
|
||||||
|
let url = resolveDestBin(`https://storage.ragestudio.net/rstudio/binaries/git`, "git-bundle-2.4.0.zip")
|
||||||
|
|
||||||
|
await streamPipeline(
|
||||||
|
got.stream(url),
|
||||||
|
fs.createWriteStream(tempPath)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
global.win.webContents.send("initializing_text", "Extracting GIT binaries...")
|
||||||
|
console.log(`Extracting GIT...`)
|
||||||
|
|
||||||
|
await new Promise((resolve, reject) => {
|
||||||
|
fs.createReadStream(tempPath).pipe(unzipper.Extract({ path: binPath })).on("close", resolve).on("error", reject)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
global.SEVENZIP_PATH = sevenzip_exec
|
global.SEVENZIP_PATH = sevenzip_exec
|
||||||
|
Loading…
x
Reference in New Issue
Block a user