Create GPT and MBR images
Some SBCs, like the Raspberry Pi (at least up-to RPi4) lineup needs MBR partitioned disks, while other, more newer SBCs, like the Orange Pi 5, needs GPT partitioned disks. So create two disk images.
This commit is contained in:
parent
c5277b0a10
commit
15c5e5afcb
2
Rocky-GPT.ks
Normal file
2
Rocky-GPT.ks
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
clearpart --drives=sda --disklabel=gpt --all
|
||||||
|
%include includes/distros/rocky-base.ksi
|
2
Rocky-MBR.ks
Normal file
2
Rocky-MBR.ks
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
clearpart --drives=sda --all
|
||||||
|
%include includes/distros/rocky-base.ksi
|
6
Rocky.ks
6
Rocky.ks
@ -1,6 +0,0 @@
|
|||||||
# Note to self with OCD: this can be alphabetically sorted
|
|
||||||
%include includes/base-configuration.ksi
|
|
||||||
%include includes/disk-layout.ksi
|
|
||||||
%include includes/package-list.ksi
|
|
||||||
%include includes/post/post-install.ksi
|
|
||||||
%include includes/repos/repos-master.ksi
|
|
@ -2,48 +2,54 @@
|
|||||||
|
|
||||||
set -x
|
set -x
|
||||||
KICKSTART_BASE="Rocky"
|
KICKSTART_BASE="Rocky"
|
||||||
KICKSTART_FILE="${KICKSTART_BASE}.ks"
|
TODAY="$(TZ='UTC' date +%Y.%m.%d)"
|
||||||
APPLIANCE_NAME="${KICKSTART_BASE}-$(dnf config-manager --dump-variables | grep releasever | awk '{print $3}')-$(uname -m)-minimal-$(TZ='UTC' date +%Y.%m.%d)"
|
APPLIANCE_BASE="${KICKSTART_BASE}-$(dnf config-manager --dump-variables | grep releasever | awk '{print $3}')-$(uname -m)-minimal-${TODAY}"
|
||||||
IMAGE_NAME="${APPLIANCE_NAME}.raw"
|
PARTITION_TYPES=('GPT' 'MBR')
|
||||||
Z_IMG_NAME="${IMAGE_NAME}.zst"
|
|
||||||
COMMANDS_TO_CHECK=('appliance-creator' 'shasum' 'zstd')
|
|
||||||
|
|
||||||
for COMMAND in "${COMMANDS_TO_CHECK[@]}"; do
|
for P_LAYOUT in "${PARTITION_TYPES[@]}"; do
|
||||||
if ! command -v "${COMMAND}" > /dev/null; then
|
KICKSTART_FILE="${KICKSTART_BASE}-${P_LAYOUT}.ks"
|
||||||
>&2 echo "$0: ERROR: unable to find command '${COMMAND}' in PATH"
|
APPLIANCE_NAME="${APPLIANCE_BASE}-${P_LAYOUT}"
|
||||||
|
IMAGE_NAME="${APPLIANCE_NAME}.raw"
|
||||||
|
COMMANDS_TO_CHECK=('appliance-creator' 'shasum' 'zstd')
|
||||||
|
|
||||||
|
for COMMAND in "${COMMANDS_TO_CHECK[@]}"; do
|
||||||
|
if ! command -v "${COMMAND}" > /dev/null; then
|
||||||
|
>&2 echo "$0: ERROR: unable to find command '${COMMAND}' in PATH"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
appliance-creator \
|
||||||
|
--config "${KICKSTART_FILE}" \
|
||||||
|
--name "${APPLIANCE_NAME}" \
|
||||||
|
--format raw \
|
||||||
|
--outdir "${PWD}" \
|
||||||
|
--no-compress \
|
||||||
|
--debug \
|
||||||
|
--cache /root/cache \
|
||||||
|
--verbose 2>&1 | tee "${APPLIANCE_NAME}.log" || exit 1
|
||||||
|
|
||||||
|
if [[ -d "${APPLIANCE_NAME}" ]]; then
|
||||||
|
pushd "${APPLIANCE_NAME}" || exit 1
|
||||||
|
mv "${APPLIANCE_NAME}-sda.raw" "${IMAGE_NAME}"
|
||||||
|
zstd --compress -9 "${IMAGE_NAME}"
|
||||||
|
popd || exit 0
|
||||||
|
else
|
||||||
|
>&2 echo "$0: ERROR: unable to find the appliance output directory"
|
||||||
|
>&2 echo "$0: ${APPLIANCE_NAME}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
appliance-creator \
|
rm -rf "${APPLIANCE_BASE}" && mkdir "${APPLIANCE_BASE}"
|
||||||
--config "${KICKSTART_FILE}" \
|
find . -type f \( -name "*.log" -o -name "*.raw*" \) -exec mv {} "${APPLIANCE_BASE}/" \;
|
||||||
--name "${APPLIANCE_NAME}" \
|
rm -rf "${APPLIANCE_BASE}"-{GPT,MBR}
|
||||||
--format raw \
|
|
||||||
--outdir "${PWD}" \
|
|
||||||
--no-compress \
|
|
||||||
--debug \
|
|
||||||
--cache /root/cache \
|
|
||||||
--verbose 2>&1 | tee "${APPLIANCE_NAME}.log" || exit 1
|
|
||||||
mv "${APPLIANCE_NAME}.log" "${APPLIANCE_NAME}/${APPLIANCE_NAME}.log"
|
|
||||||
|
|
||||||
if [[ -d "${APPLIANCE_NAME}" ]]; then
|
pushd "${APPLIANCE_BASE}" || exit 1
|
||||||
pushd "${APPLIANCE_NAME}" || exit 1
|
sha512sum -- *.raw > SHA512SUMS
|
||||||
|
sha256sum -- *.raw > SHA256SUMS
|
||||||
mv -f "${APPLIANCE_NAME}-sda.raw" "${IMAGE_NAME}"
|
popd || exit 1
|
||||||
zstd --compress -9 "${IMAGE_NAME}"
|
|
||||||
|
|
||||||
sha512sum "${IMAGE_NAME}" > SHA512SUMS
|
|
||||||
sha512sum "${Z_IMG_NAME}" >> SHA512SUMS
|
|
||||||
sha256sum "${IMAGE_NAME}" > SHA256SUMS
|
|
||||||
sha256sum "${Z_IMG_NAME}" >> SHA256SUMS
|
|
||||||
|
|
||||||
popd || exit 0
|
|
||||||
else
|
|
||||||
>&2 echo "$0: ERROR: unable to find the appliance output directory"
|
|
||||||
>&2 echo "$0: ${APPLIANCE_NAME}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n "$1" ]]; then
|
if [[ -n "$1" ]]; then
|
||||||
chown "$1":"$1" -vR "${APPLIANCE_NAME}"
|
chown "$1":"$1" -vR "${APPLIANCE_BASE}"
|
||||||
fi
|
fi
|
||||||
|
6
includes/distros/rocky-base.ksi
Normal file
6
includes/distros/rocky-base.ksi
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Note to self with OCD: this can be alphabetically sorted
|
||||||
|
%include ../base-configuration.ksi
|
||||||
|
%include ../disk-layout.ksi
|
||||||
|
%include ../package-list.ksi
|
||||||
|
%include ../post/post-install.ksi
|
||||||
|
%include ../repos/repos-master.ksi
|
Loading…
Reference in New Issue
Block a user