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