#!/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 (e.g.: "dev"). # - BUNDLE_ID: The app ID for the bundle (e.g.: "dev.warp.WarpDev"). # - 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 install -Dm644 "$WORKSPACE_ROOT_DIR/app/channels/$RELEASE_CHANNEL/$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/$RELEASE_CHANNEL/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"