@@ -51,38 +51,39 @@ jobs:
5151 echo "BUILD_MODE=$BUILD_MODE" >> $GITHUB_ENV
5252 echo "==> Build mode: $BUILD_MODE"
5353
54- - name : Setup LFS loopback partition
54+ - name : Setup LFS directory
5555 run : |
5656 set -euo pipefail
5757
5858 LFS="${{ env.LFS }}"
59- LFS_SIZE="${{ env.LFS_SIZE }}"
6059
6160 # Check current user and privileges
6261 echo "Running as: $(whoami) (UID: $(id -u))"
6362
6463 # Create LFS directory if it doesn't exist
64+ # This should be a host-mounted writable volume
6565 mkdir -p "$LFS"
6666
67- # Check if LFS is already mounted
68- if mountpoint -q "$LFS" 2>/dev/null; then
69- echo "LFS is already mounted at $LFS"
70- else
71- IMAGE="$LFS/lfs.img"
67+ # Verify we can write to LFS
68+ touch "$LFS/.write_test" && rm "$LFS/.write_test" || \
69+ die "Cannot write to $LFS - ensure the volume is mounted with write permissions"
7270
73- # Check if we have an existing image
74- if [[ -f "$IMAGE" ]]; then
75- echo "Using existing LFS image: $IMAGE"
71+ # Check if LFS image exists (for loopback mode)
72+ IMAGE="$LFS/lfs.img"
73+ if [[ -f "$IMAGE" ]]; then
74+ echo "Using existing LFS image: $IMAGE"
75+ else
76+ # Try to create loopback image (may fail in unprivileged container)
77+ echo "Attempting to create loopback image..."
78+ if truncate -s "${{ env.LFS_SIZE }}" "$IMAGE" 2>/dev/null && \
79+ mkfs.ext4 -F -L lfs "$IMAGE" 2>/dev/null && \
80+ mount -o loop "$IMAGE" "$LFS" 2>/dev/null; then
81+ echo "Loopback image created and mounted successfully."
7682 else
77- echo "Creating ${LFS_SIZE} loopback image..."
78- truncate -s "$LFS_SIZE" "$IMAGE"
79- mkfs.ext4 -F -L lfs "$IMAGE"
80- echo "New LFS image created and formatted."
83+ echo "WARNING: Could not create loopback image."
84+ echo "The LFS directory must be pre-formatted and mounted on the host."
85+ echo "See README for runner setup instructions."
8186 fi
82-
83- # Mount the image
84- mount -o loop "$IMAGE" "$LFS"
85- echo "Mounted $IMAGE at $LFS"
8687 fi
8788
8889 # Verify mount
0 commit comments