Skip to content

Commit

Permalink
Fix Alpine image preparations
Browse files Browse the repository at this point in the history
Signed-off-by: Ethan Dye <[email protected]>
  • Loading branch information
ecdye committed Jun 24, 2024
1 parent 18f2292 commit e7f4934
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
20 changes: 14 additions & 6 deletions tests/image.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit e7f4934

Please sign in to comment.