mirror of
https://github.com/kairos-io/osbuilder.git
synced 2025-12-24 12:22:35 +00:00
Compare commits
13 Commits
v0.7.0-rc1
...
v0.7.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b65986b47e | ||
|
|
b44b329fb7 | ||
|
|
3c419594b4 | ||
|
|
1101a59c9e | ||
|
|
a892113ff6 | ||
|
|
53a74136d6 | ||
|
|
54f67aa091 | ||
|
|
00fb90cc4b | ||
|
|
3d4d8a5416 | ||
|
|
876223099a | ||
|
|
df7e436900 | ||
|
|
411b9404ef | ||
|
|
cd8dd27354 |
@@ -32,9 +32,9 @@ FROM quay.io/kairos/packages:raspberrypi-firmware-dt-firmware-2021.03.15-2.1 AS
|
||||
FROM quay.io/kairos/packages:u-boot-rockchip-arm-vendor-blob-0.1 AS pinebook-u-boot
|
||||
|
||||
## Generic ARM artifacts
|
||||
FROM quay.io/kairos/packages-arm64:grub-efi-static-0.1 AS grub-efi
|
||||
FROM quay.io/kairos/packages-arm64:grub-config-static-0.1 AS grub-config
|
||||
FROM quay.io/kairos/packages-arm64:grub-artifacts-static-0.1 AS grub-artifacts
|
||||
FROM quay.io/kairos/packages-arm64:grub-efi-static-0.2 AS grub-efi
|
||||
FROM quay.io/kairos/packages-arm64:grub-config-static-0.3 AS grub-config
|
||||
FROM quay.io/kairos/packages-arm64:grub-artifacts-static-0.2 AS grub-artifacts
|
||||
|
||||
## RAW images
|
||||
FROM quay.io/kairos/packages:grub-efi-static-0.1 AS grub-raw-efi
|
||||
|
||||
@@ -16,6 +16,7 @@ load_vars() {
|
||||
oem_size="${OEM_SIZE:-64}"
|
||||
recovery_size="${RECOVERY_SIZE:-2192}"
|
||||
default_active_size="${DEFAULT_ACTIVE_SIZE:-2400}"
|
||||
menu_entry="${DEFAULT_MENU_ENTRY:-Kairos}"
|
||||
|
||||
## Repositories
|
||||
final_repo="${FINAL_REPO:-quay.io/costoolkit/releases-teal-arm64}"
|
||||
@@ -70,7 +71,15 @@ cleanup() {
|
||||
if [ -n "$oem" ]; then
|
||||
umount $oem || true
|
||||
fi
|
||||
losetup -D || true
|
||||
|
||||
if [ "$disable_lvm" == "false" ]; then
|
||||
lvremove --yes KairosVG || true
|
||||
fi
|
||||
MAPPER_LOOP=$(basename "$LOOP")
|
||||
for LOOPPART in $(ls /dev/mapper/"${MAPPER_LOOP}"*| awk -F'/' {'print $4'}); do
|
||||
dmsetup remove "${LOOPPART}" || true;
|
||||
done;
|
||||
losetup -d "${LOOP}" || true;
|
||||
}
|
||||
|
||||
ensure_dir_structure() {
|
||||
@@ -287,6 +296,12 @@ else
|
||||
rsync -axq --exclude='host' --exclude='mnt' --exclude='proc' --exclude='sys' --exclude='dev' --exclude='tmp' ${directory}/ $TARGET
|
||||
fi
|
||||
|
||||
# We copy the grubmenu.cfg to a temporary location to be copied later in the state partition
|
||||
# https://github.com/kairos-io/kairos/blob/62c67e3e61d49435c362014522e5c6696335376f/overlay/files/system/oem/08_grub.yaml#L105
|
||||
# This is a hack and we need a better way: https://github.com/kairos-io/kairos/issues/1427
|
||||
tmpgrubconfig=$(mktemp /tmp/grubmeny.cfg.XXXXXX)
|
||||
cp -rfv $TARGET/etc/kairos/branding/grubmenu.cfg "${tmpgrubconfig}"
|
||||
|
||||
umount $TARGET
|
||||
sync
|
||||
|
||||
@@ -313,8 +328,9 @@ tune2fs -L ${SYSTEM_LABEL} ${RECOVERY}/cOS/recovery.img
|
||||
|
||||
# Install real grub config to recovery
|
||||
cp -rfv /arm/grub/config/* $RECOVERY
|
||||
mkdir -p $RECOVERY/grub2
|
||||
mkdir -p $RECOVERY/grub2/fonts
|
||||
cp -rfv /arm/grub/artifacts/* $RECOVERY/grub2
|
||||
mv $RECOVERY/grub2/*pf2 $RECOVERY/grub2/fonts
|
||||
|
||||
sync
|
||||
|
||||
@@ -332,6 +348,8 @@ if [ -n "$EFI" ] && [ -n "$efi_dir" ]; then
|
||||
cp -rfv $efi_dir/* $EFI
|
||||
fi
|
||||
|
||||
partprobe
|
||||
|
||||
echo ">> Writing image and partition table"
|
||||
dd if=/dev/zero of="${output_image}" bs=1024000 count="${size}" || exit 1
|
||||
if [ "$model" == "rpi64" ]; then
|
||||
@@ -413,20 +431,30 @@ fi
|
||||
mount $state $WORKDIR/state
|
||||
mount $efi $WORKDIR/efi
|
||||
|
||||
mkdir $WORKDIR/persistent
|
||||
mount $persistent $WORKDIR/persistent
|
||||
mkdir -p $WORKDIR/persistent/cloud-config
|
||||
|
||||
cp -rfv /defaults.yaml $WORKDIR/persistent/cloud-config/01_defaults.yaml
|
||||
if [ "$disable_lvm" == "false" ]; then
|
||||
mkdir $WORKDIR/oem
|
||||
mount $oem_lv $WORKDIR/oem
|
||||
|
||||
grub2-editenv $WORKDIR/state/grub_oem_env set "default_menu_entry=Kairos"
|
||||
cp -rfv /defaults.yaml $WORKDIR/oem/01_defaults.yaml
|
||||
|
||||
# Set a OEM config file if specified
|
||||
if [ -n "$config" ]; then
|
||||
echo ">> Copying $config OEM config file"
|
||||
get_url $config $WORKDIR/persistent/cloud-config/99_custom.yaml
|
||||
# Set a OEM config file if specified
|
||||
if [ -n "$config" ]; then
|
||||
echo ">> Copying $config OEM config file"
|
||||
get_url $config $WORKDIR/oem/99_custom.yaml
|
||||
fi
|
||||
|
||||
umount $WORKDIR/oem
|
||||
else
|
||||
echo "LVM disabled: Not adding default config with default user/pass and custom config file"
|
||||
echo "Enable LVM to copy those files into /oem"
|
||||
fi
|
||||
umount $WORKDIR/persistent
|
||||
|
||||
grub2-editenv $WORKDIR/state/grub_oem_env set "default_menu_entry=$menu_entry"
|
||||
|
||||
# We copy the file we saved earier to the STATE partition
|
||||
cp -rfv "${tmpgrubconfig}" $WORKDIR/state/grubmenu
|
||||
|
||||
|
||||
# Copy over content
|
||||
cp -arf $EFI/* $WORKDIR/efi
|
||||
|
||||
@@ -20,6 +20,7 @@ size="${SIZE:-7544}"
|
||||
state_size="${STATE_SIZE:-4992}"
|
||||
recovery_size="${RECOVERY_SIZE:-2192}"
|
||||
default_active_size="${DEFAULT_ACTIVE_SIZE:-2400}"
|
||||
menu_entry="${DEFAULT_MENU_ENTRY:-Kairos}"
|
||||
|
||||
container_image="${container_image:-quay.io/kairos/kairos-opensuse-leap-arm-rpi:v1.5.1-k3sv1.25.6-k3s1}"
|
||||
|
||||
@@ -67,6 +68,12 @@ else
|
||||
rsync -axq --exclude='host' --exclude='mnt' --exclude='proc' --exclude='sys' --exclude='dev' --exclude='tmp' ${directory}/ $TARGET
|
||||
fi
|
||||
|
||||
# We copy the grubmenu.cfg to a temporary location to be copied later in the state partition
|
||||
# https://github.com/kairos-io/kairos/blob/62c67e3e61d49435c362014522e5c6696335376f/overlay/files/system/oem/08_grub.yaml#L105
|
||||
# This is a hack and we need a better way: https://github.com/kairos-io/kairos/issues/1427
|
||||
tmpgrubconfig=$(mktemp /tmp/grubmeny.cfg.XXXXXX)
|
||||
cp -rfv $TARGET/etc/kairos/branding/grubmenu.cfg "${tmpgrubconfig}"
|
||||
|
||||
umount $TARGET
|
||||
sync
|
||||
|
||||
@@ -87,8 +94,9 @@ tune2fs -L ${SYSTEM_LABEL} ${RECOVERY}/cOS/recovery.img
|
||||
|
||||
# Install real grub config to recovery
|
||||
cp -rfv /arm/grub/config/* $RECOVERY
|
||||
mkdir -p $RECOVERY/grub2
|
||||
mkdir -p $RECOVERY/grub2/fonts
|
||||
cp -rfv /arm/grub/artifacts/* $RECOVERY/grub2
|
||||
mv $RECOVERY/grub2/*pf2 $RECOVERY/grub2/fonts
|
||||
|
||||
dd if=/dev/zero of=recovery_partition.img bs=1M count=$recovery_size
|
||||
dd if=/dev/zero of=state_partition.img bs=1M count=$state_size
|
||||
@@ -106,7 +114,11 @@ LOOP=$(losetup --show -f state_partition.img)
|
||||
mkdir -p $WORKDIR/state
|
||||
mount $LOOP $WORKDIR/state
|
||||
cp -arf $STATEDIR/* $WORKDIR/state
|
||||
grub2-editenv $WORKDIR/state/grub_oem_env set "default_menu_entry=Kairos"
|
||||
grub2-editenv $WORKDIR/state/grub_oem_env set "default_menu_entry=$menu_entry"
|
||||
|
||||
# We copy the file we saved earier to the STATE partition
|
||||
cp -rfv "${tmpgrubconfig}" $WORKDIR/state/grubmenu
|
||||
|
||||
umount $WORKDIR/state
|
||||
losetup -d $LOOP
|
||||
|
||||
|
||||
Reference in New Issue
Block a user