85 lines
2.0 KiB
Bash
Executable File
85 lines
2.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -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 bash
|
|
printf '%s\n' "$@" > "$CARGO_ARGS_FILE"
|
|
EOF
|
|
chmod +x "$temp_dir/bin/cargo"
|
|
cat > "$temp_dir/bin/rustup" <<'EOF'
|
|
#!/usr/bin/env bash
|
|
exit 0
|
|
EOF
|
|
chmod +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
|
|
;;
|
|
esac
|
|
target="$arch-unknown-linux-musl"
|
|
for compiler in "$target-gcc" "$target-g++" "$target-strip"; do
|
|
cat > "$temp_dir/bin/$compiler" <<'EOF'
|
|
#!/usr/bin/env bash
|
|
exit 0
|
|
EOF
|
|
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 galaxyctrl \
|
|
--arch "$arch" \
|
|
--features smoke_feature
|
|
|
|
grep -qx -- '--features' "$temp_dir/cargo-args"
|
|
grep -qx -- 'galaxy' "$temp_dir/cargo-args"
|
|
grep -qx -- 'galaxy-oss' "$temp_dir/cargo-args"
|
|
grep -qx -- 'release_bundle,standalone,galaxy_control_cli,smoke_feature' "$temp_dir/cargo-args"
|
|
|
|
profile_dir="$temp_dir/target/$target/release-cli"
|
|
mkdir -p "$profile_dir"
|
|
cat > "$profile_dir/galaxy-oss" <<'EOF'
|
|
#!/usr/bin/env bash
|
|
printf '%s\n' "$@" > "$FORWARDED_ARGS_FILE"
|
|
EOF
|
|
chmod +x "$profile_dir/galaxy-oss"
|
|
|
|
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 galaxyctrl \
|
|
--arch "$arch"
|
|
|
|
grep -Fq 'exec -a "$0"' "$profile_dir/bundle/linux/galaxyctrl"
|
|
|
|
FORWARDED_ARGS_FILE="$temp_dir/forwarded-args" \
|
|
"$profile_dir/bundle/linux/galaxyctrl" tab create --instance "inst 123"
|
|
|
|
cat > "$temp_dir/expected-forwarded-args" <<'EOF'
|
|
--galaxyctrl
|
|
tab
|
|
create
|
|
--instance
|
|
inst 123
|
|
EOF
|
|
cmp "$temp_dir/expected-forwarded-args" "$temp_dir/forwarded-args"
|