diff --git a/src/blobs/props.ts b/src/blobs/props.ts index 9a4420f..718092b 100644 --- a/src/blobs/props.ts +++ b/src/blobs/props.ts @@ -2,7 +2,7 @@ import { promises as fs } from 'fs' import { exists } from '../util/fs' import { parseLines } from '../util/parse' -import { ALL_PARTITIONS } from '../util/partitions' +import { ALL_SYS_PARTITIONS } from '../util/partitions' export type PartitionProps = Map> @@ -30,7 +30,7 @@ export function parseProps(file: string) { export async function loadPartitionProps(sourceRoot: string) { let partProps = new Map>() as PartitionProps - for (let partition of ALL_PARTITIONS) { + for (let partition of ALL_SYS_PARTITIONS) { let propPath = `${sourceRoot}/${partition}/build.prop` if (partition == 'system' && !(await exists(propPath))) { // System-as-root diff --git a/src/commands/collect-state.ts b/src/commands/collect-state.ts index 613dba8..1e18c3a 100644 --- a/src/commands/collect-state.ts +++ b/src/commands/collect-state.ts @@ -8,7 +8,7 @@ import { loadPartVintfInfo } from '../blobs/vintf' import { serializeSystemState, SystemState } from '../config/system-state' import { parsePartContexts } from '../selinux/contexts' import { startActionSpinner, stopActionSpinner } from '../util/cli' -import { ALL_PARTITIONS } from '../util/partitions' +import { ALL_SYS_PARTITIONS } from '../util/partitions' export default class CollectState extends Command { static description = 'collect built system state for use with other commands' @@ -32,7 +32,7 @@ export default class CollectState extends Command { // Files let spinner = startActionSpinner('Enumerating files') - for (let partition of ALL_PARTITIONS) { + for (let partition of ALL_SYS_PARTITIONS) { spinner.text = partition let files = await listPart(partition, customRoot) diff --git a/src/commands/diff-files.ts b/src/commands/diff-files.ts index b4a6cea..76e0fd8 100644 --- a/src/commands/diff-files.ts +++ b/src/commands/diff-files.ts @@ -2,7 +2,7 @@ import { Command, flags } from '@oclif/command' import chalk from 'chalk' import { diffLists, listPart } from '../blobs/file_list' -import { ALL_PARTITIONS } from '../util/partitions' +import { ALL_SYS_PARTITIONS } from '../util/partitions' export default class DiffFiles extends Command { static description = 'find missing system files compared to a reference system' @@ -20,7 +20,7 @@ export default class DiffFiles extends Command { async run() { let {flags: {all}, args: {sourceRef, sourceNew}} = this.parse(DiffFiles) - for (let partition of ALL_PARTITIONS) { + for (let partition of ALL_SYS_PARTITIONS) { let filesRef = await listPart(partition, sourceRef) if (filesRef == null) { continue diff --git a/src/commands/generate-all.ts b/src/commands/generate-all.ts index 9c79504..ba7fb7b 100644 --- a/src/commands/generate-all.ts +++ b/src/commands/generate-all.ts @@ -20,7 +20,7 @@ import { diffPartContexts, parseContextsRecursive, parsePartContexts, resolvePar import { generateFileContexts } from '../selinux/labels' import { startActionSpinner, stopActionSpinner } from '../util/cli' import { withTempDir } from '../util/fs' -import { ALL_PARTITIONS } from '../util/partitions' +import { ALL_SYS_PARTITIONS } from '../util/partitions' export default class GenerateFull extends Command { static description = 'generate all vendor parts automatically' @@ -57,7 +57,7 @@ export default class GenerateFull extends Command { // 1. Diff files let spinner = startActionSpinner('Enumerating files') - for (let partition of ALL_PARTITIONS) { + for (let partition of ALL_SYS_PARTITIONS) { let filesRef = await listPart(partition, stockRoot) if (filesRef == null) continue let filesNew = customState != null ? customState.partitionFiles[partition] : diff --git a/src/commands/list-files.ts b/src/commands/list-files.ts index 625d4fa..48a630c 100644 --- a/src/commands/list-files.ts +++ b/src/commands/list-files.ts @@ -2,7 +2,7 @@ import { Command, flags } from '@oclif/command' import { promises as fs } from 'fs' import { listPart } from '../blobs/file_list' -import { ALL_PARTITIONS } from '../util/partitions' +import { ALL_SYS_PARTITIONS } from '../util/partitions' export default class ListFiles extends Command { static description = 'list system files and symlinks important for blobs' @@ -21,7 +21,7 @@ export default class ListFiles extends Command { await fs.mkdir(out, { recursive: true }) - for (let partition of ALL_PARTITIONS) { + for (let partition of ALL_SYS_PARTITIONS) { let files = await listPart(partition, systemRoot, true) if (files == null) { continue diff --git a/src/util/partitions.ts b/src/util/partitions.ts index bf5b236..f432f9f 100644 --- a/src/util/partitions.ts +++ b/src/util/partitions.ts @@ -1,4 +1,30 @@ +export enum Partition { + // System + System = 'system', + SystemExt = 'system_ext', + Product = 'product', + Vendor = 'vendor', + VendorDlkm = 'vendor_dlkm', + Odm = 'odm', + OdmDlkm = 'odm_dlkm', + + // Boot + Boot = 'boot', + Dt = 'dt', + Dtbo = 'dtbo', + PvmFw = 'pvmfw', + Recovery = 'recovery', + Vbmeta = 'vbmeta', + VbmetaSystem = 'vbmeta_system', + VbmetaVendor = 'vbmeta_vendor', + VendorBoot = 'vendor_boot', +} + // Android system partitions, excluding "system" +export type ExtSysPartition = Partition.SystemExt | + Partition.Product | + Partition.Vendor | + Partition.Odm export const EXT_SYS_PARTITIONS = new Set([ 'system_ext', 'product', @@ -7,15 +33,19 @@ export const EXT_SYS_PARTITIONS = new Set([ ]) // GKI DLKM partitions +export type DlkmPartition = Partition.VendorDlkm | + Partition.OdmDlkm export const DLKM_PARTITIONS = new Set([ 'vendor_dlkm', 'odm_dlkm', ]) +export type ExtPartition = ExtSysPartition | DlkmPartition export const EXT_PARTITIONS = new Set([ ...EXT_SYS_PARTITIONS, ...DLKM_PARTITIONS, ]) -// All partitions -export const ALL_PARTITIONS = new Set(['system', ...EXT_PARTITIONS]) +// All system partitions +export type SysPartition = Partition.System | ExtPartition +export const ALL_SYS_PARTITIONS = new Set(['system', ...EXT_PARTITIONS])