apex: Migrate to new sub-temp and mount APIs
This commit is contained in:
parent
3eb96aebec
commit
941d892c6e
1 changed files with 6 additions and 5 deletions
|
@ -4,8 +4,7 @@ import * as unzipit from 'unzipit'
|
||||||
|
|
||||||
import { enumerateSelinuxLabels, SelinuxFileLabels } from '../selinux/labels'
|
import { enumerateSelinuxLabels, SelinuxFileLabels } from '../selinux/labels'
|
||||||
import { ProgressCallback } from '../util/cli'
|
import { ProgressCallback } from '../util/cli'
|
||||||
import { listFilesRecursive, TempState } from '../util/fs'
|
import { createSubTmp, listFilesRecursive, mount, TempState } from '../util/fs'
|
||||||
import { run } from '../util/process'
|
|
||||||
import { NodeFileReader } from '../util/zip'
|
import { NodeFileReader } from '../util/zip'
|
||||||
import { BlobEntry } from './entry'
|
import { BlobEntry } from './entry'
|
||||||
import { combinedPartPathToEntry } from './file-list'
|
import { combinedPartPathToEntry } from './file-list'
|
||||||
|
@ -33,7 +32,7 @@ async function listPayload(
|
||||||
// Mount
|
// Mount
|
||||||
let mountpoint = `${tmp.dir}/payload`
|
let mountpoint = `${tmp.dir}/payload`
|
||||||
await fs.mkdir(mountpoint)
|
await fs.mkdir(mountpoint)
|
||||||
await run(`mount -t ext4 -o ro ${imgPath} ${mountpoint}`)
|
await mount(imgPath, mountpoint)
|
||||||
tmp.mounts.push(mountpoint)
|
tmp.mounts.push(mountpoint)
|
||||||
|
|
||||||
// Extract files, including apex_metadata.pb
|
// Extract files, including apex_metadata.pb
|
||||||
|
@ -121,9 +120,11 @@ export async function flattenAllApexs(
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flatten and add new entries
|
|
||||||
let apexPath = `${srcDir}/${entry.srcPath}`
|
let apexPath = `${srcDir}/${entry.srcPath}`
|
||||||
let apex = await flattenApex(entry.partition, apexPath, tmp, progressCallback)
|
let subTmp = await createSubTmp(tmp, `flat_apex/${entry.srcPath}`)
|
||||||
|
|
||||||
|
// Flatten and add new entries
|
||||||
|
let apex = await flattenApex(entry.partition, apexPath, subTmp, progressCallback)
|
||||||
apex.entries.forEach(e => entries.add(e))
|
apex.entries.forEach(e => entries.add(e))
|
||||||
Array.from(apex.labels.entries())
|
Array.from(apex.labels.entries())
|
||||||
.forEach(([path, context]) => labels.set(path, context))
|
.forEach(([path, context]) => labels.set(path, context))
|
||||||
|
|
Loading…
Reference in a new issue