diff --git a/src/run-new.sh b/src/run-new.sh index 713991f..9bde336 100755 --- a/src/run-new.sh +++ b/src/run-new.sh @@ -13,7 +13,7 @@ readonly PROXY_ENABLED="${PROXY_ENABLED:-true}" readonly PROXY_URL="${PROXY_URL:-http://10.0.0.1:3128}" # Source utility functions -source "$(dirname "$0")/lib/docker.sh" +source "/workspace/lib/docker.sh" # Logging function log() { @@ -164,7 +164,7 @@ run_with_container() { # Run container with explicit name and environment docker run --name "$container_name" \ --env-file <(grep -v '^#' "$(dirname "$0")/.env" 2>/dev/null || true) \ - "${env_args[@]}" \ + -e "USER_UID=$(id -u)" \n -e "USER_GID=$(id -g)" \n "${env_args[@]}" \ -v "$(pwd)":/workspace:ro \ -v "$(pwd)/tmp":/build \ -v "$(pwd)/output":/output \ @@ -195,27 +195,27 @@ cmd_build() { cmd_lint() { log_info "Running lint checks" - run_with_container "lint" make lint + run_with_container "lint" bash -c "shellcheck /workspace/src/*.sh /workspace/config/hooks/*/*.sh /workspace/bin/*.sh" } cmd_test() { log_info "Running all tests" - run_with_container "test" make test + run_with_container "test" bats -r /workspace/tests/ } cmd_test_unit() { log_info "Running unit tests" - run_with_container "test-unit" make test-unit + run_with_container "test-unit" bats /workspace/tests/unit/ } cmd_test_integration() { log_info "Running integration tests" - run_with_container "test-integration" make test-integration + run_with_container "test-integration" bats /workspace/tests/integration/ } cmd_test_functional() { log_info "Running functional tests" - run_with_container "test-functional" make test-functional + run_with_container "test-functional" bats /workspace/tests/security/ } cmd_shell() { @@ -232,17 +232,56 @@ cmd_clean() { cmd_iso() { log_info "Building ISO image" - run_with_container "iso" make iso + run_with_container "iso" bash -c " + cd /build + rm -rf ./* + lb config \ + --distribution testing \ + --architectures amd64 \ + --archive-areas 'main contrib non-free' \ + --mode debian \ + --chroot-filesystem squashfs \ + --binary-filesystem iso9660 \ + --binary-images iso-hybrid \ + --iso-application 'KNEL-Football Secure OS' \ + --iso-publisher 'KNEL-Football Security Team' \ + --iso-volume 'KNEL-Football Secure' \ + --linux-packages 'linux-image-amd64 linux-headers-amd64' \ + --debian-installer true \ + --debian-installer-gui true \ + --win32-loader true \ + --memtest memtest86+ \ + --source false \ + --apt-indices false \ + --apt-source-archives false + cp -r /workspace/config/* ./ + timeout 3600 lb build + ISO_FILE=\$(find . -name '*.iso' -type f | head -1) + if [ -n \"\$ISO_FILE\" ]; then + FINAL_ISO=\"knel-football-secure-v1.0.0.iso\" + mv \"\$ISO_FILE\" \"\$FINAL_ISO\" + sha256sum \"\$FINAL_ISO\" > \"\${FINAL_ISO}.sha256\" + md5sum \"\$FINAL_ISO\" > \"\${FINAL_ISO}.md5\" + cp \"\$FINAL_ISO\" \"\${FINAL_ISO}.sha256\" \"\${FINAL_ISO}.md5\" /output/ + fi + " } cmd_secure() { log_info "Generating security configuration" - run_with_container "secure" make secure + run_with_container "secure" bash -c "cd /workspace && src/security-hardening.sh" } cmd_deploy() { log_info "Preparing deployment package" - run_with_container "deploy" make deploy + run_with_container "deploy" bash -c " + cd /workspace + mkdir -p /output/deploy + cp -r config docs src tests /output/deploy/ + cp README.md AGENTS.md LICENSE /output/deploy/ + cp run.sh Dockerfile /output/deploy/ + echo 'Deployment package created at /output/deploy/' + " } # Execute command