80 lines · 1.9 KB · Text
RawDownload
#!/usr/bin/env bashset -e workspace_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"temp_dir="$(mktemp -d)"trap 'rm -rf "$temp_dir"' EXIT mkdir -p "$temp_dir/bin"cat > "$temp_dir/bin/cargo" <<'EOF'#!/usr/bin/env bashprintf '%s\n' "$@" > "$CARGO_ARGS_FILE"EOFchmod +x "$temp_dir/bin/cargo"cat > "$temp_dir/bin/rustup" <<'EOF'#!/usr/bin/env bashexit 0EOFchmod +x "$temp_dir/bin/rustup" case "$(uname -m)" in  arm64|aarch64)    arch="aarch64"    ;;  x86_64|amd64)    arch="x86_64"    ;;  *)    echo "Unsupported architecture: $(uname -m)" >&2    exit 1    ;;esactarget="$arch-unknown-linux-musl"for compiler in "$target-gcc" "$target-g++" "$target-strip"; do  cat > "$temp_dir/bin/$compiler" <<'EOF'#!/usr/bin/env bashexit 0EOF  chmod +x "$temp_dir/bin/$compiler"done PATH="$temp_dir/bin:$PATH" \  CARGO_ARGS_FILE="$temp_dir/cargo-args" \  CARGO_TARGET_DIR="$temp_dir/target" \  "$workspace_root/script/linux/bundle" \  --check-only \  --artifact warpctrl \  --arch "$arch" \  --features smoke_feature grep -qx -- '--features' "$temp_dir/cargo-args"grep -qx -- 'release_bundle,crash_reporting,agent_mode_debug,jemalloc_pprof,heap_usage_tracking,standalone,warp_control_cli,smoke_feature' "$temp_dir/cargo-args" profile_dir="$temp_dir/target/$target/release-cli-debug_assertions"mkdir -p "$profile_dir"cat > "$profile_dir/dev" <<'EOF'#!/usr/bin/env bashprintf '%s\n' "$@" > "$FORWARDED_ARGS_FILE"EOFchmod +x "$profile_dir/dev" PATH="$temp_dir/bin:$PATH" \  CARGO_TARGET_DIR="$temp_dir/target" \  NO_LICENSES=1 \  SKIP_SETTINGS_SCHEMA=1 \  "$workspace_root/script/linux/bundle" \  --skip-build \  --artifact warpctrl \  --arch "$arch" FORWARDED_ARGS_FILE="$temp_dir/forwarded-args" \  "$profile_dir/bundle/linux/warpctrl" tab create --instance "inst 123" cat > "$temp_dir/expected-forwarded-args" <<'EOF'--warpctrltabcreate--instanceinst 123EOFcmp "$temp_dir/expected-forwarded-args" "$temp_dir/forwarded-args"