From e7f4934daa053f062db232de658e033dc28b7692 Mon Sep 17 00:00:00 2001 From: Ethan Dye Date: Sun, 23 Jun 2024 23:23:37 -0600 Subject: [PATCH] Fix Alpine image preparations Signed-off-by: Ethan Dye --- .github/workflows/test-action.yml | 2 +- tests/image.bash | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-action.yml b/.github/workflows/test-action.yml index ae610d9..be93a50 100644 --- a/.github/workflows/test-action.yml +++ b/.github/workflows/test-action.yml @@ -68,7 +68,7 @@ jobs: sudo apt-get install --yes gnupg xz-utils expect systemd-container qemu-user-static qemu-utils qemu-system-arm libfdt-dev echo "imagegz=alpine-rpi-3.20.1-armhf.img.gz" >> $GITHUB_OUTPUT echo "image=alpine-rpi-3.20.1-armhf.img" >> $GITHUB_OUTPUT - - name: Cache Raspberry Pi OS 32bit image + - name: Cache Alpine 32bit image uses: actions/cache@v4 with: path: ${{ steps.setup.outputs.image }} diff --git a/tests/image.bash b/tests/image.bash index 0c87faf..533802f 100755 --- a/tests/image.bash +++ b/tests/image.bash @@ -6,12 +6,16 @@ imageFile() { if [[ $1 == "mount" ]]; then loopPrefix="$(kpartx -asv "$2" | grep -oE "loop([0-9]+)" | head -n 1)" - mkdir -p tests/{fs,kernel,dtb} - mount -o rw -t ext4 "/dev/mapper/${loopPrefix}p2" "tests/fs" - mount -o rw -t vfat "/dev/mapper/${loopPrefix}p1" "tests/fs/boot" + mkdir -p tests/{fs,kernel} + if [[ "$2" == "alpine-rpi-3.20.1-armhf.img" ]]; then + mount -o rw -t vfat "/dev/mapper/${loopPrefix}p1" "tests/fs" + else + mount -o rw -t ext4 "/dev/mapper/${loopPrefix}p2" "tests/fs" + mount -o rw -t vfat "/dev/mapper/${loopPrefix}p1" "tests/fs/boot" + fi elif [[ $1 == "umount" ]]; then sync - umount tests/fs/boot + [[ "$2" == "alpine-rpi-3.20.1-armhf.img" ]] || umount tests/fs/boot umount tests/fs kpartx -d "$2" fi @@ -34,9 +38,13 @@ if [[ $1 == "setup" ]]; then fi fi qemu-img resize -f raw "$3" 4G - echo ", +" | sfdisk -N 2 "$3" + if [[ "$3" == "alpine-rpi-3.20.1-armhf.img" ]]; then + echo ", +" | sfdisk -N 1 "$3" + else + echo ", +" | sfdisk -N 2 "$3" + fi imageFile "mount" "$3" - rsync -avr --exclude="*.img" --exclude="*.sig" --exclude="*.asc" --exclude="tests/fs" --exclude="tests/dtb" --exclude="tests/kernel" ./ tests/fs/opt/zram + rsync -avr --exclude="*.img" --exclude="*.sig" --exclude="*.asc" --exclude="tests/fs" --exclude="*.dtb" --exclude="tests/kernel" ./ tests/fs/opt/zram [[ "$3" == "alpine-rpi-3.20.1-armhf.img" ]] || systemd-nspawn --directory="tests/fs" /opt/zram/tests/install-packages.bash echo "set enable-bracketed-paste off" >> tests/fs/etc/inputrc # Prevents weird character output cp tests/fs/boot/kernel* tests/kernel