Skip to content

Commit 23fffbb

Browse files
committed
make-physical-machine.sh: Use fedora-41 and reformat comments
Move the baseline for the physical machine to fedora-41, and reflow all the comments.
1 parent 8750aa6 commit 23fffbb

File tree

1 file changed

+38
-30
lines changed

1 file changed

+38
-30
lines changed

make-physical-machine.sh

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,27 @@
1616

1717
set -e -u -C
1818

19+
base_image=fedora-41
20+
21+
# The array below open-codes the partition:filesystem layout of the
22+
# virt-builder disk template used above. Whenever you bump the Fedora
23+
# version, update the array below as needed.
24+
#
25+
# We cannot use inspection either before or after the filesystem UUID
26+
# changes:
27+
#
28+
# - the UUID of a mounted filesystem cannot be changed (at least with
29+
# - XFS);
30+
#
31+
# - right after the UUID changes, inspection does not work correctly,
32+
# as the new fs UUIDs are out of sync with the UUID references in
33+
# those config files that inspection relies upon.
34+
#
35+
# Note that the order of entries is important too: the mount points
36+
# must be listed in dependency order (put the dependees first, the
37+
# dependants last).
38+
fsdevs=(/dev/sda3:/ /dev/sda2:/boot)
39+
1940
GUESTFISH_PID=
2041
disk=
2142

@@ -39,41 +60,26 @@ outdir=$(dirname -- "$output")
3960
disk=$(mktemp -p "$outdir" physical-machine.tmp.XXXXXXXXXX)
4061
# Delay the SELinux relabeling.
4162
virt-builder --format raw -o "$disk" --root-password password:p2v-phys \
42-
--no-selinux-relabel fedora-39
63+
--no-selinux-relabel $base_image
4364

44-
# Start a guestfish server on the disk image, so that each of the several
45-
# UUID-manipulation commands below not need a separate guestfish launch.
65+
# Start a guestfish server on the disk image, so that each of the
66+
# several UUID-manipulation commands below not need a separate
67+
# guestfish launch.
4668
guestfish_set_pid=$(guestfish --listen --format=raw --add "$disk")
4769
eval "$guestfish_set_pid"
4870
guestfish --remote -- run
4971

50-
# The array below open-codes the partition:filesystem layout of the virt-builder
51-
# disk template used above. Whenever you bump the Fedora version, update the
52-
# array below as needed.
53-
#
54-
# We cannot use inspection either before or after the filesystem UUID changes:
55-
#
56-
# - the UUID of a mounted filesystem cannot be changed (at least with XFS);
57-
#
58-
# - right after the UUID changes, inspection does not work correctly, as the new
59-
# fs UUIDs are out of sync with the UUID references in those config files that
60-
# inspection relies upon.
61-
#
62-
# Note that the order of entries is important too: the mount points must be
63-
# listed in dependency order (put the dependees first, the dependants last).
64-
fsdevs=(/dev/sda3:/ /dev/sda2:/boot)
65-
6672
# For each filesystem:
6773
#
6874
# - regenerate the UUID,
6975
#
70-
# - produce a sed command (scriptlet) that performs the same UUID replacement in
71-
# a text file,
76+
# - produce a sed command (scriptlet) that performs the same UUID
77+
# replacement in a text file,
7278
#
7379
# - mount the filesystem.
7480
#
75-
# Note that later we're going to rely on the fact that the generated sed
76-
# commands *require no quoting* on the shell command line.
81+
# Note that later we're going to rely on the fact that the generated
82+
# sed commands *require no quoting* on the shell command line.
7783
declare -a sed_script
7884
sed_idx=0
7985
for fsdev in "${fsdevs[@]}"; do
@@ -94,8 +100,8 @@ done
94100
refresh_uuid_refs=(find /boot /etc -type f -print0 '|'
95101
xargs -0 -r -- sed -i "${sed_script[@]}" --)
96102

97-
# Passing the shell command to the appliance is where we rely on the fact that
98-
# the sed commands for replacing UUIDs require no quoting.
103+
# Passing the shell command to the appliance is where we rely on the
104+
# fact that the sed commands for replacing UUIDs require no quoting.
99105
guestfish --remote -- sh "${refresh_uuid_refs[*]}"
100106

101107
# Tear down the guestfish server before we use virt-customize.
@@ -106,12 +112,14 @@ while kill -s 0 -- "$waitpid" 2>/dev/null; do
106112
sleep 1
107113
done
108114

109-
# Reapply the SELinux labels now. Use virt-customize for this, rather than
110-
# guestfish's "selinux-relabel", as virt-customize contains some heavy logic
111-
# related to "specfile". Inspection does work here, because the config files are
112-
# in sync again with the filesystem UUIDs.
115+
# Reapply the SELinux labels now. Use virt-customize for this, rather
116+
# than guestfish's "selinux-relabel", as virt-customize contains some
117+
# heavy logic related to "specfile". Inspection does work here,
118+
# because the config files are in sync again with the filesystem
119+
# UUIDs.
113120
virt-customize --format raw --add "$disk" --selinux-relabel
114121

115-
# We're done; rename the temporary disk image to the expected output file.
122+
# We're done; rename the temporary disk image to the expected output
123+
# file.
116124
mv -- "$disk" "$output"
117125
disk=

0 commit comments

Comments
 (0)