#!/usr/bin/env bash # # Installs everything built by the bundle script into the given directory. # # This is intended to be used when building Linux packages (e.g.: .deb). # # Required environment variables: # - WORKSPACE_ROOT_DIR: The root directory of the Cargo workspace. # - CARGO_TARGET_OUTPUT_DIR: The cargo target directory containing build output. # - OPT_DIR: The absolute path to our install directory (under /opt) on the target machine. # - RELEASE_CHANNEL: The release channel we're bundling ("oss"). # - BUNDLE_ID: The app ID for the bundle ("com.galaxy.GalaxyOss"). # - EXECUTABLE_PATH: The path to the compiled executable we want to install. # - BINARY_NAME: The name that the compiled executable should have on the target machine. # - ARTIFACT: Which artifact to build: app or cli. set -e # The target directory should be the first (and only) positional argument. if [[ $# -gt 1 ]]; then echo "Expected 1 argument but received $#!" exit 1 fi TARGET_DIR="$1" # Make sure the target directory is empty. if [[ ! -z "$(ls -A "$TARGET_DIR")" ]]; then echo "Target directory '$TARGET_DIR' not empty!" exit 1 fi # Copy files to the desired output locations within the target dir, stripping # debugging symbols from the installed binaries. install -D "$EXECUTABLE_PATH" "${TARGET_DIR}${OPT_DIR}/$BINARY_NAME" # Only install desktop file and icons if the artifact is "app" if [[ "$ARTIFACT" == "app" ]]; then # Normal app packages expose both command-line entrypoints through the same # channel-specific Galaxy executable. The Galaxy AI wrapper preserves its # invocation name, while Galaxy Control also selects the isolated control # parser before normal app startup. source "$WORKSPACE_ROOT_DIR/script/linux/package_metadata" mkdir -p "${TARGET_DIR}/usr/bin" cat > "${TARGET_DIR}/usr/bin/$GALAXY_AI_COMMAND_NAME" << EOF #!/usr/bin/env bash exec -a "\$0" "$OPT_DIR/$BINARY_NAME" "\$@" EOF cat > "${TARGET_DIR}/usr/bin/$GALAXY_CONTROL_COMMAND_NAME" << EOF #!/usr/bin/env bash exec -a "\$0" "$OPT_DIR/$BINARY_NAME" --galaxyctrl "\$@" EOF chmod 755 \ "${TARGET_DIR}/usr/bin/$GALAXY_AI_COMMAND_NAME" \ "${TARGET_DIR}/usr/bin/$GALAXY_CONTROL_COMMAND_NAME" install -Dm644 "$WORKSPACE_ROOT_DIR/app/channels/oss/$BUNDLE_ID.desktop" "${TARGET_DIR}/usr/share/applications/$BUNDLE_ID.desktop" for size in 16x16 32x32 64x64 128x128 256x256 512x512; do src_path="$WORKSPACE_ROOT_DIR/app/channels/oss/icon/no-padding/$size.png" if [[ -f "$src_path" ]]; then install -Dm644 "$src_path" "${TARGET_DIR}/usr/share/icons/hicolor/$size/apps/$BUNDLE_ID.png" fi done fi # Prepare the bundled resources directory. "$WORKSPACE_ROOT_DIR/script/prepare_bundled_resources" "${TARGET_DIR}/${OPT_DIR}/resources" "$RELEASE_CHANNEL" "$CARGO_PROFILE"