refactor(image): Changing rootfs from xz -> gz (#232)
This commit is contained in:
parent
58adddcfbb
commit
a9c91d39f5
@ -27,8 +27,8 @@ pipeline:
|
|||||||
stages:
|
stages:
|
||||||
generate:
|
generate:
|
||||||
artifacts:
|
artifacts:
|
||||||
- source: /generated/rootfs.tar.xz
|
- source: /generated/rootfs.tar.gz
|
||||||
destination: ../../build/rootfs.tar.xz
|
destination: ../../build/rootfs.tar.gz
|
||||||
- source: /generated/boot/vmlinuz
|
- source: /generated/boot/vmlinuz
|
||||||
destination: ../../build/vmlinuz
|
destination: ../../build/vmlinuz
|
||||||
- source: /generated/boot/initramfs.xz
|
- source: /generated/boot/initramfs.xz
|
||||||
@ -55,7 +55,7 @@ tasks:
|
|||||||
FROM alpine:3.7
|
FROM alpine:3.7
|
||||||
RUN apk --update add bash curl e2fsprogs tar cdrkit parted syslinux util-linux xfsprogs xz sgdisk sfdisk qemu-img unzip
|
RUN apk --update add bash curl e2fsprogs tar cdrkit parted syslinux util-linux xfsprogs xz sgdisk sfdisk qemu-img unzip
|
||||||
COPY --from=generated /usr/local/src/syslinux /usr/local/src/syslinux
|
COPY --from=generated /usr/local/src/syslinux /usr/local/src/syslinux
|
||||||
COPY --from=generated /generated/rootfs.tar.xz /generated/rootfs.tar.xz
|
COPY --from=generated /generated/rootfs.tar.gz /generated/rootfs.tar.gz
|
||||||
COPY --from=generated /generated/boot /generated/boot
|
COPY --from=generated /generated/boot /generated/boot
|
||||||
RUN curl -L {{ index .Variables "srcPacker" }} -o /tmp/packer.zip \
|
RUN curl -L {{ index .Variables "srcPacker" }} -o /tmp/packer.zip \
|
||||||
&& unzip -d /tmp /tmp/packer.zip \
|
&& unzip -d /tmp /tmp/packer.zip \
|
||||||
@ -73,4 +73,4 @@ tasks:
|
|||||||
rootfs:
|
rootfs:
|
||||||
template: |
|
template: |
|
||||||
COPY --from=talos/rootfs:{{ .Docker.Image.Tag }} /rootfs /generated/rootfs
|
COPY --from=talos/rootfs:{{ .Docker.Image.Tag }} /rootfs /generated/rootfs
|
||||||
RUN {{if .Git.IsClean}}XZ_OPT=-9e{{else}}XZ_OPT=-0{{end}} tar -cvpJf /generated/rootfs.tar.xz -C /generated/rootfs .
|
RUN tar -cvpzf /generated/rootfs.tar.gz -C /generated/rootfs .
|
||||||
|
@ -71,7 +71,7 @@ function create_iso() {
|
|||||||
cp -v /usr/local/src/syslinux/bios/core/isolinux.bin /mnt/boot/isolinux/isolinux.bin
|
cp -v /usr/local/src/syslinux/bios/core/isolinux.bin /mnt/boot/isolinux/isolinux.bin
|
||||||
cp -v /usr/local/src/syslinux/bios/com32/elflink/ldlinux/ldlinux.c32 /mnt/boot/isolinux/ldlinux.c32
|
cp -v /usr/local/src/syslinux/bios/com32/elflink/ldlinux/ldlinux.c32 /mnt/boot/isolinux/ldlinux.c32
|
||||||
create_extlinux_conf /mnt/boot/isolinux/isolinux.conf
|
create_extlinux_conf /mnt/boot/isolinux/isolinux.conf
|
||||||
tar -xpvJf /generated/rootfs.tar.xz -C /mnt
|
tar -xpvzf /generated/rootfs.tar.gz -C /mnt
|
||||||
mkisofs -o ${ISO_IMAGE} -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table .
|
mkisofs -o ${ISO_IMAGE} -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table .
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +80,11 @@ function create_ami() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function size_xz() {
|
function size_xz() {
|
||||||
xz --robot --list $1 | sed -n '3p' | cut -d$'\t' -f5 | awk '{printf("%.0f", $1*0.000001)}'
|
xz --robot --list $1 | awk 'END { printf("%.0f", $5*0.000001)}'
|
||||||
|
}
|
||||||
|
|
||||||
|
function size_gz() {
|
||||||
|
gzip --list $1 | awk 'END { printf("%.0f", $2*0.000001)}'
|
||||||
}
|
}
|
||||||
|
|
||||||
function extract_boot_partition() {
|
function extract_boot_partition() {
|
||||||
@ -99,7 +103,7 @@ function extract_root_partition() {
|
|||||||
local partition=$1
|
local partition=$1
|
||||||
mkfs.xfs -f -n ftype=1 -L ROOT ${partition}
|
mkfs.xfs -f -n ftype=1 -L ROOT ${partition}
|
||||||
mount -v ${partition} /mnt
|
mount -v ${partition} /mnt
|
||||||
tar -xpvJf /generated/rootfs.tar.xz --exclude="./var" -C /mnt
|
tar -xpvzf /generated/rootfs.tar.gz --exclude="./var" -C /mnt
|
||||||
umount -v /mnt
|
umount -v /mnt
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +111,7 @@ function extract_data_partition() {
|
|||||||
local partition=$1
|
local partition=$1
|
||||||
mkfs.xfs -f -n ftype=1 -L DATA ${partition}
|
mkfs.xfs -f -n ftype=1 -L DATA ${partition}
|
||||||
mount -v ${partition} /mnt
|
mount -v ${partition} /mnt
|
||||||
tar -xpvJf /generated/rootfs.tar.xz --strip-components=2 -C /mnt "./var"
|
tar -xpvzf /generated/rootfs.tar.gz --strip-components=2 -C /mnt "./var"
|
||||||
umount -v /mnt
|
umount -v /mnt
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +143,7 @@ VMDK_IMAGE="/out/image.vmdk"
|
|||||||
ISO_IMAGE="/out/image.iso"
|
ISO_IMAGE="/out/image.iso"
|
||||||
FULL=false
|
FULL=false
|
||||||
RAW=false
|
RAW=false
|
||||||
ROOTFS_SIZE=$(size_xz /generated/rootfs.tar.xz)
|
ROOTFS_SIZE=$(size_gz /generated/rootfs.tar.gz)
|
||||||
INITRAMFS_SIZE=$(size_xz /generated/boot/initramfs.xz)
|
INITRAMFS_SIZE=$(size_xz /generated/boot/initramfs.xz)
|
||||||
# TODO(andrewrynhard): Add slub_debug=P. See https://github.com/autonomy/talos/pull/157.
|
# TODO(andrewrynhard): Add slub_debug=P. See https://github.com/autonomy/talos/pull/157.
|
||||||
KERNEL_SELF_PROTECTION_PROJECT_KERNEL_PARAMS="page_poison=1 slab_nomerge pti=on"
|
KERNEL_SELF_PROTECTION_PROJECT_KERNEL_PARAMS="page_poison=1 slab_nomerge pti=on"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user