patches and low-level development discussion
 help / color / mirror / code / Atom feed
blob e13c86d2fb11a066eebd043808e659b08dbd269c 923 bytes (raw)
name: scripts/sfdisk-field.awk 	 # note: path name is non-authoritative(*)

 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
30
31
32
33
34
35
36
37
38
 
#!/usr/bin/awk -f
#
# SPDX-License-Identifier: EUPL-1.2+
# SPDX-FileCopyrightText: 2022, 2024 Alyssa Ross <hi@alyssa.is>

BEGIN {
	types["root.aarch64"] = "b921b045-1df0-41c3-af44-4c6f280d3fae"
	types["root.x86_64"] = "4f68bce3-e8cd-4db1-96e7-fbcaf984b709"
	types["verity.aarch64"] = "df3300ce-d69f-4c92-978c-9bfb0f38d820"
	types["verity.x86_64"] = "2c7357ed-ebd2-46d9-aec1-23d437ec2bf5"

	# Field #1 is the partition path, which make-gpt.sh will turn into
	# the size field.  Since it's handled elsewhere, we skip that
	# first field.
	skip=1

	split("type uuid name", keys)
	split(partition, fields, ":")

	arch = ENVIRON["ARCH"]
	if (!arch) {
		"uname -m" | getline _arch
		if (!close("uname -m"))
			arch = _arch
	}

	for (n in fields) {
		if (n <= skip)
			continue

		if (keys[n - skip] == "type") {
			if (uuid = types[fields[n] "." arch])
				fields[n] = uuid
		}

		printf "%s=%s,", keys[n - skip], fields[n]
	}
}

debug log:

solving e13c86d ...
found e13c86d in https://spectrum-os.org/git/spectrum

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).