32 lines
966 B
Bash
Executable File
32 lines
966 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
node --input-type=module <<'NODE'
|
|
import fs from 'node:fs';
|
|
import { execFileSync } from 'node:child_process';
|
|
|
|
const readJson = (path) => JSON.parse(fs.readFileSync(path, 'utf8'));
|
|
const arch = process.arch === 'x64' ? 'amd64' : process.arch;
|
|
|
|
const checks = {
|
|
packageVersion: readJson('/app/package.json').version,
|
|
hasCli: fs.existsSync('/app/cli.js'),
|
|
hasRustBinary: fs.existsSync(`/app/dist_rust/remoteingress-bin_linux_${arch}`) || fs.existsSync('/app/dist_rust/remoteingress-bin'),
|
|
};
|
|
|
|
await import('/app/dist_ts/index.js');
|
|
execFileSync('node', ['/app/cli.js', '--help'], { stdio: 'pipe' });
|
|
|
|
if (checks.packageVersion !== '4.17.1') {
|
|
throw new Error(`Unexpected remoteingress package version ${checks.packageVersion}`);
|
|
}
|
|
if (!checks.hasCli) {
|
|
throw new Error('Missing cli.js');
|
|
}
|
|
if (!checks.hasRustBinary) {
|
|
throw new Error(`Missing Rust binary for ${arch}`);
|
|
}
|
|
|
|
console.log(JSON.stringify(checks));
|
|
NODE
|