Skip to content

Commit

Permalink
Switch to GPT partitioning
Browse files Browse the repository at this point in the history
With a `/boot` partition.  But today Anaconda doesn't expose an
API to explicitly label it `/boot` (or even change the filesystem
type).  We'll live with that for now.

Prep for UEFI.
  • Loading branch information
cgwalters committed Feb 6, 2019
1 parent 2c7e065 commit 196088e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
12 changes: 12 additions & 0 deletions src/gf-anaconda-cleanup
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,20 @@ dn=$(dirname "$0")
. "${dn}"/libguestfish.sh

src="$1"
shift
skip_partition_fixups=
if [ "${1:-}" = "--skip-partition-fixups" ]; then
skip_partition_fixups=1
shift
fi

set -x
if [ "${skip_partition_fixups}" != 1 ]; then
coreos_gf_run "${src}"
# We don't have a way to do this with Anaconda/kickstart right now.
# This bootstraps us to be able to do all of the mounts.
coreos_gf set-label /dev/sda2 boot
fi
coreos_gf_run_mount "${src}"

# Both of these are written by Anaconda
Expand Down
4 changes: 2 additions & 2 deletions src/image-base.ks
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ firewall --disabled
network --bootproto=dhcp --onboot=on

zerombr
clearpart --initlabel --all
clearpart --initlabel --all --disklabel=gpt

# https://github.com/coreos/fedora-coreos-tracker/issues/18
# See also coreos-growpart.service defined in fedora-coreos-base.yaml
# You can change this partition layout, but note that the `boot` and `root`
# filesystem labels are currently mandatory (they're interpreted by coreos-assembler).
part /boot --size=300 --fstype="xfs" --label=boot
reqpart --add-boot
# Note no reflinks for /boot since the bootloader may not understand them
part / --size=3000 --fstype="xfs" --label=root --grow --mkfsoptions="-m reflink=1"

Expand Down
16 changes: 14 additions & 2 deletions src/libguestfish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export LIBGUESTFS_BACKEND=direct
# http://libguestfs.org/guestfish.1.html#using-remote-control-robustly-from-shell-scripts
GUESTFISH_PID=
coreos_gf_launch() {
if [ -n "$GUESTFISH_PID" ]; then
return
fi
local src=$1
shift
local guestfish
Expand All @@ -32,11 +35,20 @@ coreos_gf() {
guestfish --remote -- "$@"
}

GUESTFISH_RUNNING=
coreos_gf_run() {
if [ -n "$GUESTFISH_RUNNING" ]; then
return
fi
coreos_gf_launch "$@"
coreos_gf run
GUESTFISH_RUNNING=1
}

# Run libguestfs and mount the root and boot partitions.
# Export `stateroot` and `deploydir` variables.
coreos_gf_run_mount() {
coreos_gf_launch "$@"
coreos_gf run
coreos_gf_run "$@"
local root
root=$(coreos_gf findfs-label root)
coreos_gf mount "${root}" /
Expand Down
5 changes: 4 additions & 1 deletion src/virt-install
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,10 @@ try:
run_sync_verbose(vinstall_args)
# And strip out all of the Anaconda stuff in /var; this uses libguestfs
# to ensure we fully control the code.
run_sync_verbose(['/usr/lib/coreos-assembler/gf-anaconda-cleanup', args.dest])
cleanup_argv = ['/usr/lib/coreos-assembler/gf-anaconda-cleanup', args.dest]
if args.image_config is None:
cleanup_argv.append('--skip-partition-fixups')
run_sync_verbose(cleanup_argv)
finally:
subprocess.call(['virsh', '--connect=qemu:///session', 'undefine', domain])
if tail_proc is not None:
Expand Down

0 comments on commit 196088e

Please sign in to comment.