mirror of
https://github.com/kairos-io/osbuilder.git
synced 2025-08-31 14:53:13 +00:00
Add option to build netboot files and disk image size
This commit is contained in:
@@ -3,20 +3,20 @@
|
||||
|
||||
ISO=$1
|
||||
OUTPUT_NAME=$2
|
||||
VERSION=$3
|
||||
ARTIFACT_NAME=$(basename $OUTPUT_NAME)
|
||||
|
||||
isoinfo -x /rootfs.squashfs -R -i $ISO > $OUTPUT_NAME.squashfs
|
||||
isoinfo -x /boot/kernel -R -i $ISO > $OUTPUT_NAME-kernel
|
||||
isoinfo -x /boot/initrd -R -i $ISO > $OUTPUT_NAME-initrd
|
||||
|
||||
RELEASE_URL=${RELEASE_URL:-https://github.com/kairos-io/kairos/releases/download}
|
||||
URL=${URL:-https://github.com/kairos-io/kairos/releases/download}
|
||||
|
||||
cat > $OUTPUT_NAME.ipxe << EOF
|
||||
#!ipxe
|
||||
set url ${RELEASE_URL}/
|
||||
set kernel $OUTPUT_NAME-kernel
|
||||
set initrd $OUTPUT_NAME-initrd
|
||||
set rootfs $OUTPUT_NAME.squashfs
|
||||
set url ${URL}/
|
||||
set kernel $ARTIFACT_NAME-kernel
|
||||
set initrd $ARTIFACT_NAME-initrd
|
||||
set rootfs $ARTIFACT_NAME.squashfs
|
||||
# set config https://example.com/machine-config
|
||||
# set cmdline extra.values=1
|
||||
kernel \${url}/\${kernel} initrd=\${initrd} ip=dhcp rd.cos.disable root=live:\${url}/\${rootfs} netboot nodepair.enable config_url=\${config} console=tty1 console=ttyS0 \${cmdline}
|
||||
|
@@ -9,6 +9,7 @@
|
||||
|
||||
: "${OEM_LABEL:=COS_OEM}"
|
||||
: "${RECOVERY_LABEL:=COS_RECOVERY}"
|
||||
: "${EXTEND:=}"
|
||||
|
||||
DIRECTORY=$1
|
||||
OUT=${2:-disk.raw}
|
||||
@@ -66,6 +67,11 @@ truncate -s $((3*1024*1024)) $OUT
|
||||
# Add an extra MB at the end of the disk for the gpt headers, in fact 34 sectors would be enough, but adding some more does not hurt.
|
||||
truncate -s "+$((1024*1024))" $OUT
|
||||
|
||||
if [ -n "$EXTEND" ]; then
|
||||
echo "Extending image of $EXTEND MB"
|
||||
truncate -s "+$(($EXTEND*1024*1024))" $OUT
|
||||
fi
|
||||
|
||||
# Create the partition table in $OUT (assumes sectors of 512 bytes)
|
||||
sgdisk -n 1:2048:+2M -c 1:legacy -t 1:EF02 $OUT
|
||||
sgdisk -n 2:0:+20M -c 2:UEFI -t 2:EF00 $OUT
|
||||
|
Reference in New Issue
Block a user