GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — vm2api/scripts/seed-crag.mjs at dev · dofastted/vm2api

Expand file tree

/

seed-crag.mjs

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
29 lines (27 loc) · 1.43 KB
/

seed-crag.mjs

Copy path

File metadata and controls

29 lines (27 loc) · 1.43 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env node
import fs from 'node:fs'
import path from 'node:path'
import { pathToFileURL } from 'node:url'
import { cragV2Arch, stageCragV2Tree } from '../src/lib/vm/wrap-cli-runtime.mjs'
export function seedCragFactory(root, imageRoot, { arch = cragV2Arch() } = {}) {
if (arch !== 'amd64') return { ok: true, seeded: false, reason: 'unsupported_arch' }
if (String(process.env.KIN_CRAG_V2_ROOT || '').trim()) return { ok: true, seeded: false, reason: 'custom_package' }
const destination = path.join(root, 'share/crag/kernels/v2', arch)
// An existing issuer and any downloaded selection belong to the installation.
if (fs.existsSync(destination)) return { ok: true, seeded: false, reason: 'factory_exists' }
fs.mkdirSync(path.dirname(destination), { recursive: true })
const staged = stageCragV2Tree(path.join(imageRoot, 'kernels/v2', arch), destination, { arch })
if (!staged.ok) throw new Error(staged.code)
staged.commit()
return { ok: true, seeded: true }
}
if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) {
const root = path.resolve(process.argv[2] || process.env.KIN_PROJECT_ROOT || '/opt/vm2api')
const imageRoot = path.resolve(process.argv[3] || '/opt/vm2api/image-crag')
try {
console.log(JSON.stringify(seedCragFactory(root, imageRoot)))
} catch (error) {
console.error(`CRAG factory initialization failed: ${error.message}`)
process.exitCode = 1
}
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.