fix: resolve UID/GID readonly variable conflict

- Changed UID/GID to USER_UID/USER_GID to avoid bash readonly variable error
- Updated both build.sh and docker-compose.yml with new variable names
- Fixes 'UID: readonly variable' error during clean build process

Now './build.sh --clean' should work without variable conflicts.
This commit is contained in:
2025-08-22 18:49:14 +02:00
parent 193662fb67
commit 8a38c372aa
2 changed files with 6 additions and 6 deletions

View File

@@ -117,8 +117,8 @@ if [ "$CLEAN_BUILD" = true ]; then
# Remove output artifacts (use sudo if needed for root-owned files)
if ! rm -rf ../output/* 2>/dev/null; then
print_info " Some files owned by root, using container to clean..."
export UID=$(id -u)
export GID=$(id -g)
export USER_UID=$(id -u)
export USER_GID=$(id -g)
docker compose run --rm builder sh -c "rm -rf /build/output/*" || {
print_warning "Failed to clean output directory, trying with sudo"
sudo rm -rf ../output/*
@@ -150,8 +150,8 @@ mkdir -p ../output ../cache/github ../cache/packages
export BUILDMODE
export MINIMAL_MODE
export TARGETARCH="${TARGETARCH:-amd64}"
export UID=$(id -u)
export GID=$(id -g)
export USER_UID=$(id -u)
export USER_GID=$(id -g)
if [ "$DEV_MODE" = true ]; then
print_info "Starting development container..."

View File

@@ -12,7 +12,7 @@ services:
image: zero-os-alpine-builder:cached-${BUILDMODE:-debug}
container_name: zero-os-alpine-builder-cached
privileged: true
user: "${UID:-1000}:${GID:-1000}"
user: "${USER_UID:-1000}:${USER_GID:-1000}"
volumes:
# Mount source configs and scripts (read-only for cache efficiency)
- ../configs:/build/configs:ro
@@ -46,7 +46,7 @@ services:
image: zero-os-alpine-builder:legacy
container_name: zero-os-alpine-builder-legacy
privileged: true
user: "${UID:-1000}:${GID:-1000}"
user: "${USER_UID:-1000}:${USER_GID:-1000}"
volumes:
- ../configs:/build/configs:ro
- ../scripts:/build/scripts:ro