Skip to content

Commit

Permalink
Update THAR-* partition labels to BOTTLEROCKET-*
Browse files Browse the repository at this point in the history
  • Loading branch information
tjkirch committed Feb 13, 2020
1 parent 85df90e commit 0340450
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 23 deletions.
9 changes: 4 additions & 5 deletions packages/release/prepare-local.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
Description=Prepare Local Directory (/local)
DefaultDependencies=no

# We need udev to create /dev/disk/by-partlabel/THAR-DATA first.
# TODO: change "THAR" to "BOTTLEROCKET" (here and below) when we change rpm2img
Wants=dev-disk-by\x2dpartlabel-THAR\x2dDATA.device
After=dev-disk-by\x2dpartlabel-THAR\x2dDATA.device
# We need udev to create /dev/disk/by-partlabel/BOTTLEROCKET-DATA first.
Wants=dev-disk-by\x2dpartlabel-BOTTLEROCKET\x2dDATA.device
After=dev-disk-by\x2dpartlabel-BOTTLEROCKET\x2dDATA.device

[Service]
Type=oneshot
Environment=BOTTLEROCKET_DATA=/dev/disk/by-partlabel/THAR-DATA
Environment=BOTTLEROCKET_DATA=/dev/disk/by-partlabel/BOTTLEROCKET-DATA
Environment=LOCAL_DIR=/local

# To "grow" the partition, we delete it and recreate it at the larger size, which
Expand Down
3 changes: 1 addition & 2 deletions packages/release/var-lib-bottlerocket.mount
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ RequiresMountsFor=/var
Before=local-fs.target umount.target

[Mount]
# TODO: change "THAR" to "BOTTLEROCKET" when we change rpm2img
What=/dev/disk/by-partlabel/THAR-PRIVATE
What=/dev/disk/by-partlabel/BOTTLEROCKET-PRIVATE
Where=/var/lib/bottlerocket
Type=ext4
Options=defaults,noatime,nosuid,nodev
Expand Down
31 changes: 15 additions & 16 deletions tools/rpm2img
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,16 @@ truncate -s 2G "${DISK_IMAGE}"
# boot: 40M + root: 920M + hash: 10M + reserved: 30M = 1000M
# boot partition attributes (-A): 48 = gptprio priority bit; 56 = gptprio successful bit
# partitions are backwards so that we don't make things inconsistent when specifying a wrong end sector :)
# TODO: change "THAR" to "BOTTLEROCKET" (here and below) in the labels when we're ready for that upgrade-breaking change
sgdisk --clear \
-n 0:2005M:2047M -c 0:"THAR-PRIVATE" -t 0:"${BOTTLEROCKET_PRIVATE_TYPECODE}" \
-n 0:1975M:0 -c 0:"THAR-RESERVED-B" -t 0:"${BOTTLEROCKET_RESERVED_TYPECODE}" \
-n 0:1965M:0 -c 0:"THAR-HASH-B" -t 0:"${BOTTLEROCKET_HASH_TYPECODE}" \
-n 0:1045M:0 -c 0:"THAR-ROOT-B" -t 0:"${BOTTLEROCKET_ROOT_TYPECODE}" \
-n 0:1005M:0 -c 0:"THAR-BOOT-B" -t 0:"${BOTTLEROCKET_BOOT_TYPECODE}" -A 0:"clear":48 -A 0:"clear":56 \
-n 0:975M:0 -c 0:"THAR-RESERVED-A" -t 0:"${BOTTLEROCKET_RESERVED_TYPECODE}" \
-n 0:965M:0 -c 0:"THAR-HASH-A" -t 0:"${BOTTLEROCKET_HASH_TYPECODE}" \
-n 0:45M:0 -c 0:"THAR-ROOT-A" -t 0:"${BOTTLEROCKET_ROOT_TYPECODE}" \
-n 0:5M:0 -c 0:"THAR-BOOT-A" -t 0:"${BOTTLEROCKET_BOOT_TYPECODE}" -A 0:"set":48 -A 0:"set":56 \
-n 0:2005M:2047M -c 0:"BOTTLEROCKET-PRIVATE" -t 0:"${BOTTLEROCKET_PRIVATE_TYPECODE}" \
-n 0:1975M:0 -c 0:"BOTTLEROCKET-RESERVED-B" -t 0:"${BOTTLEROCKET_RESERVED_TYPECODE}" \
-n 0:1965M:0 -c 0:"BOTTLEROCKET-HASH-B" -t 0:"${BOTTLEROCKET_HASH_TYPECODE}" \
-n 0:1045M:0 -c 0:"BOTTLEROCKET-ROOT-B" -t 0:"${BOTTLEROCKET_ROOT_TYPECODE}" \
-n 0:1005M:0 -c 0:"BOTTLEROCKET-BOOT-B" -t 0:"${BOTTLEROCKET_BOOT_TYPECODE}" -A 0:"clear":48 -A 0:"clear":56 \
-n 0:975M:0 -c 0:"BOTTLEROCKET-RESERVED-A" -t 0:"${BOTTLEROCKET_RESERVED_TYPECODE}" \
-n 0:965M:0 -c 0:"BOTTLEROCKET-HASH-A" -t 0:"${BOTTLEROCKET_HASH_TYPECODE}" \
-n 0:45M:0 -c 0:"BOTTLEROCKET-ROOT-A" -t 0:"${BOTTLEROCKET_ROOT_TYPECODE}" \
-n 0:5M:0 -c 0:"BOTTLEROCKET-BOOT-A" -t 0:"${BOTTLEROCKET_BOOT_TYPECODE}" -A 0:"set":48 -A 0:"set":56 \
-n 0:1M:0 -c 0:"${FIRM_NAME}" -t 0:"${BOTTLEROCKET_FIRM_TYPECODE}" \
--sort --print "${DISK_IMAGE}"

Expand Down Expand Up @@ -120,12 +119,12 @@ echo "VARIANT_ID=${VARIANT}" >> ${ROOT_MOUNT}/${SYS_ROOT}/usr/lib/os-release
echo "VERSION_ID=${VERSION_ID}" >> ${ROOT_MOUNT}/${SYS_ROOT}/usr/lib/os-release
echo "BUILD_ID=${BUILD_ID}" >> ${ROOT_MOUNT}/${SYS_ROOT}/usr/lib/os-release

# THAR-ROOT-A
# BOTTLEROCKET-ROOT-A
mkfs.ext4 -O ^has_journal -b "${VERITY_DATA_BLOCK_SIZE}" -d "${ROOT_MOUNT}" "${ROOT_IMAGE}" 920M
resize2fs -M "${ROOT_IMAGE}"
dd if="${ROOT_IMAGE}" of="${DISK_IMAGE}" conv=notrunc bs=1M seek=45

# THAR-VERITY-A
# BOTTLEROCKET-VERITY-A
truncate -s 8M "${VERITY_IMAGE}"
veritysetup_output="$(veritysetup format \
--format "$VERITY_VERSION" \
Expand Down Expand Up @@ -160,12 +159,12 @@ menuentry "Bottlerocket OS ${VERSION_ID}" {
}
EOF

# THAR-BOOT-A
# BOTTLEROCKET-BOOT-A
mkfs.ext4 -O ^has_journal -d "${BOOT_MOUNT}" "${BOOT_IMAGE}" 40M
resize2fs -M "${BOOT_IMAGE}"
dd if="${BOOT_IMAGE}" of="${DISK_IMAGE}" conv=notrunc bs=1M seek=5

# THAR-PRIVATE
# BOTTLEROCKET-PRIVATE

# Targeted toward the current API server implementation.
# Relative to the ext4 defaults, we:
Expand All @@ -175,10 +174,10 @@ dd if="${BOOT_IMAGE}" of="${DISK_IMAGE}" conv=notrunc bs=1M seek=5
mkfs.ext4 -b 4096 -i 4096 -I 256 "${PRIVATE_IMAGE}" 42M
dd if="${PRIVATE_IMAGE}" of="${DISK_IMAGE}" conv=notrunc bs=1M seek=2005

# THAR-DATA
# BOTTLEROCKET-DATA
truncate -s 1G "${DATA_IMAGE}"
sgdisk --clear \
-n 0:1M:1023M -c 0:"THAR-DATA" -t 0:8300 \
-n 0:1M:1023M -c 0:"BOTTLEROCKET-DATA" -t 0:8300 \
--sort --print "${DATA_IMAGE}"
mkdir -p "${DATA_MOUNT}/var/"{cache,lib,log,spool}
mkfs.ext4 -d "${DATA_MOUNT}" "${BOTTLEROCKET_DATA}" 1022M
Expand Down

0 comments on commit 0340450

Please sign in to comment.