diff --git a/packages/build_executables.sh b/packages/build_executables.sh index b021586..c76fbbf 100755 --- a/packages/build_executables.sh +++ b/packages/build_executables.sh @@ -7,6 +7,10 @@ #!/bin/bash set -e +# Get current user's UID and GID +USER_ID=$(id -u) +GROUP_ID=$(id -g) + # Create output directory if it doesn't exist mkdir -p output @@ -17,26 +21,24 @@ if ! docker image inspect dropshell-builder:latest >/dev/null 2>&1; then fi # Build x86_64 executable -docker run --rm -v "$(pwd)/..:/src" dropshell-builder:latest bash -c ' +docker run --rm -v "$(pwd)/..:/src" -u root dropshell-builder:latest bash -c ' rm -rf build && \ mkdir -p build && \ cd build && \ cmake -DCMAKE_BUILD_TYPE=Release .. && \ make && \ - cp dropshell ../packages/output/dropshell-x86_64 + cp dropshell ../packages/output/dropshell-x86_64 && \ + chown '"$USER_ID:$GROUP_ID"' ../packages/output/dropshell-x86_64 ' # Build arm64 executable -docker run --rm -v "$(pwd)/..:/src" dropshell-builder:latest bash -c ' +docker run --rm -v "$(pwd)/..:/src" -u root dropshell-builder:latest bash -c ' rm -rf build && \ mkdir -p build && \ cd build && \ - cmake -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \ - -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \ + cmake -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \ -DCMAKE_BUILD_TYPE=Release .. && \ make && \ - cp dropshell ../packages/output/dropshell-arm64 + cp dropshell ../packages/output/dropshell-arm64 && \ + chown '"$USER_ID:$GROUP_ID"' ../packages/output/dropshell-arm64 ' - -# Change ownership to current user -chown $(id -u):$(id -g) output/dropshell-*