generate-full: Extract and re-label flattened APEXs
This commit is contained in:
parent
6a5a9a5388
commit
0f88711fcd
1 changed files with 13 additions and 1 deletions
|
@ -17,6 +17,7 @@ import { parseDeviceConfig } from '../config/device'
|
||||||
import { parseSystemState, SystemState } from '../config/system-state'
|
import { parseSystemState, SystemState } from '../config/system-state'
|
||||||
import { ANDROID_INFO, extractFactoryFirmware, generateAndroidInfo, writeFirmwareImages } from '../images/firmware'
|
import { ANDROID_INFO, extractFactoryFirmware, generateAndroidInfo, writeFirmwareImages } from '../images/firmware'
|
||||||
import { diffPartContexts, parseContextsRecursive, parsePartContexts, resolvePartContextDiffs, SelinuxContexts } from '../selinux/contexts'
|
import { diffPartContexts, parseContextsRecursive, parsePartContexts, resolvePartContextDiffs, SelinuxContexts } from '../selinux/contexts'
|
||||||
|
import { generateFileContexts } from '../selinux/labels'
|
||||||
import { startActionSpinner, stopActionSpinner } from '../util/cli'
|
import { startActionSpinner, stopActionSpinner } from '../util/cli'
|
||||||
import { withTempDir } from '../util/fs'
|
import { withTempDir } from '../util/fs'
|
||||||
import { ALL_PARTITIONS } from '../util/partitions'
|
import { ALL_PARTITIONS } from '../util/partitions'
|
||||||
|
@ -107,7 +108,14 @@ export default class GenerateFull extends Command {
|
||||||
// 4. Flatten APEX modules
|
// 4. Flatten APEX modules
|
||||||
if (config.flatten_apex) {
|
if (config.flatten_apex) {
|
||||||
spinner = startActionSpinner('Flattening APEX modules')
|
spinner = startActionSpinner('Flattening APEX modules')
|
||||||
entries = await flattenAllApexs(entries, stockRoot, tmp)
|
let apex = await flattenAllApexs(entries, stockRoot, tmp, (progress) => {
|
||||||
|
spinner.text = progress
|
||||||
|
})
|
||||||
|
entries = apex.entries
|
||||||
|
|
||||||
|
// Write context labels
|
||||||
|
let fileContexts = `${dirs.sepolicy}/file_contexts`
|
||||||
|
await fs.writeFile(fileContexts, generateFileContexts(apex.labels))
|
||||||
stopActionSpinner(spinner)
|
stopActionSpinner(spinner)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,6 +164,10 @@ export default class GenerateFull extends Command {
|
||||||
// Diff; reversed custom->stock order to get *missing* contexts
|
// Diff; reversed custom->stock order to get *missing* contexts
|
||||||
let ctxDiffs = diffPartContexts(customContexts, stockContexts)
|
let ctxDiffs = diffPartContexts(customContexts, stockContexts)
|
||||||
let ctxResolutions = resolvePartContextDiffs(ctxDiffs, sourceContexts)
|
let ctxResolutions = resolvePartContextDiffs(ctxDiffs, sourceContexts)
|
||||||
|
// Add APEX labels
|
||||||
|
if (ctxResolutions.has('vendor')) {
|
||||||
|
ctxResolutions.get('vendor')!.sepolicyDirs.push(dirs.sepolicy)
|
||||||
|
}
|
||||||
stopActionSpinner(spinner)
|
stopActionSpinner(spinner)
|
||||||
|
|
||||||
// 8. Overlays
|
// 8. Overlays
|
||||||
|
|
Loading…
Reference in a new issue