mirror of
https://git.tuxpa.in/a/code-server.git
synced 2024-12-27 04:35:25 +00:00
Detect target automatically
This removes the potential for a bad build because the native Node modules currently can only be built on the target system, so specifying a target for something other than the system your are building on will not work.
This commit is contained in:
parent
c2be0ec71b
commit
80050d0d9d
@ -26,7 +26,7 @@ function docker-build() {
|
||||
|
||||
function docker-exec() {
|
||||
local command="${1}" ; shift
|
||||
local args="'${vscodeVersion}' '${codeServerVersion}' '${target}'"
|
||||
local args="'${vscodeVersion}' '${codeServerVersion}'"
|
||||
docker exec "${containerId}" \
|
||||
bash -c "cd /src && CI=true GITHUB_TOKEN=${token} MINIFY=${minify} yarn ${command} ${args}"
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ function in-vscode () {
|
||||
if [[ ! -f "${maybeVsCode}/package.json" ]] ; then
|
||||
return 1
|
||||
fi
|
||||
if ! grep '"name": "code-oss-dev"' "${maybeVsCode}/package.json" --quiet ; then
|
||||
if ! grep '"name": "code-oss-dev"' "${maybeVsCode}/package.json" -q ; then
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
@ -264,17 +264,24 @@ function main() {
|
||||
local codeServerVersion="${1}" ; shift
|
||||
local ci="${CI:-}"
|
||||
local minify="${MINIFY:-}"
|
||||
|
||||
local arch
|
||||
arch=$(uname -m)
|
||||
local target="${1:-}"
|
||||
if [[ -z "${target}" ]] ; then
|
||||
local ostype="${OSTYPE:-}"
|
||||
if [[ "${ostype}" == "darwin"* ]] ; then
|
||||
target="darwin"
|
||||
else
|
||||
target="linux"
|
||||
|
||||
local target="linux"
|
||||
local ostype="${OSTYPE:-}"
|
||||
if [[ "${ostype}" == "darwin"* ]] ; then
|
||||
target="darwin"
|
||||
else
|
||||
# On Alpine there seems no way to get the version except to use an invalid
|
||||
# command which will output the version to stderr and exit with 1.
|
||||
local output
|
||||
output=$(ldd --version 2>&1 || :)
|
||||
if [[ "${output}" == "musl"* ]] ; then
|
||||
target="alpine"
|
||||
fi
|
||||
fi
|
||||
|
||||
local binaryName="code-server${codeServerVersion}-vsc${vscodeVersion}-${target}-${arch}"
|
||||
local buildPath="${stagingPath}/${binaryName}-built"
|
||||
|
||||
|
@ -124,11 +124,11 @@ export class UpdateService extends AbstractUpdateService {
|
||||
private async buildReleaseName(release: string): Promise<string> {
|
||||
let target: string = os.platform();
|
||||
if (target === "linux") {
|
||||
const result = await util.promisify(cp.exec)("ldd --version");
|
||||
if (result.stderr) {
|
||||
throw new Error(result.stderr);
|
||||
}
|
||||
if (result.stdout.indexOf("musl") !== -1) {
|
||||
const result = await util.promisify(cp.exec)("ldd --version").catch((error) => ({
|
||||
stderr: error.message,
|
||||
stdout: "",
|
||||
}));
|
||||
if (result.stderr.indexOf("musl") !== -1 || result.stdout.indexOf("musl") !== -1) {
|
||||
target = "alpine";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user