- expose command-monitor conversations and preserve visible agent transcripts - add bounded polling and a dedicated shell interrupt tool - improve direct-provider images, skills, tool history, and usage handling - package and brand Galaxy Control across releases, installers, persistence, and docs
95 lines
3.5 KiB
Bash
Executable File
95 lines
3.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Builds a .deb package as part of the bundling process.
|
|
#
|
|
# Required environment variables:
|
|
# - WORKSPACE_ROOT_DIR: The root directory of the Cargo workspace.
|
|
# - DIST_DIR: A temporary directory we can use for staging files as we build the package.
|
|
# - OUT_DIR: The directory into which we should place the final package.
|
|
# - CARGO_TARGET_OUTPUT_DIR: The cargo target directory containing build output.
|
|
# - RELEASE_CHANNEL: The release channel we're bundling (e.g.: "dev").
|
|
# - BUNDLE_ID: The app ID for the bundle (e.g.: "dev.galaxy.GalaxyDev").
|
|
# - 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
|
|
|
|
source "$WORKSPACE_ROOT_DIR/script/linux/package_metadata"
|
|
TEMPLATE_DIR="$WORKSPACE_ROOT_DIR/resources/linux/debian/$ARTIFACT"
|
|
|
|
# Add a simple test to make sure we're generating the appropriate repository
|
|
# name for the stable channel.
|
|
if [ "$RELEASE_CHANNEL" = "stable" ]; then
|
|
if [ "$REPO_NAME" != "warpdotdev" ]; then
|
|
echo "::error ::Unexpected repo name for $RELEASE_CHANNEL channel: $REPO_NAME (expected \"warpdotdev\")"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
BUILD_ARCH="${BUILD_ARCH:-$(uname -m)}"
|
|
if [ "$BUILD_ARCH" = "aarch64" ]; then
|
|
ARCH="arm64"
|
|
else
|
|
ARCH="amd64"
|
|
fi
|
|
|
|
FULL_PACKAGE_NAME="$PACKAGE_NAME-$ARCH"
|
|
PKGDIR="$DIST_DIR/debpkg/$FULL_PACKAGE_NAME"
|
|
|
|
cleanup() {
|
|
# Delete the AppDir that was used as a staging area during the bundling
|
|
# process.
|
|
if [ -d "$PKGDIR" ]; then
|
|
rm -rf "$PKGDIR"
|
|
fi
|
|
}
|
|
|
|
# Run cleanup() when the script terminates (whether it succeeded or failed).
|
|
trap cleanup EXIT
|
|
|
|
# Construct a directory that contains all of the output data.
|
|
rm -rf "$PKGDIR"
|
|
mkdir -p "$PKGDIR"
|
|
|
|
# Populate the directory with the package contents, in the appropriate
|
|
# locations.
|
|
OPT_DIR="/opt/warpdotdev/$PACKAGE_NAME"
|
|
source "$WORKSPACE_ROOT_DIR/script/linux/bundle_install" "$PKGDIR"
|
|
|
|
# Move the Debian-specific package metadata into the package directory.
|
|
DEBIAN_DIR="$PKGDIR/DEBIAN"
|
|
VERSION="$(echo "$GIT_RELEASE_TAG" | sed -E "s/^v//; s/([a-z]+)_/\1./")"
|
|
mkdir "$DEBIAN_DIR"
|
|
sed \
|
|
"s#@@PACKAGE_NAME@@#$PACKAGE_NAME#g; s#@@CHANNEL_SUFFIX@@#$CHANNEL_SUFFIX#g; s#@@VERSION@@#$VERSION#g; s#@@ARCH@@#$ARCH#g" \
|
|
< "$TEMPLATE_DIR/control.template" \
|
|
> "$DEBIAN_DIR/control"
|
|
sed \
|
|
"s#@@PACKAGE_NAME@@#$PACKAGE_NAME#g; s#@@CHANNEL_SUFFIX@@#$CHANNEL_SUFFIX#g; s#@@BINARY_NAME@@#$BINARY_NAME#g; s#@@OPTDIR@@#$OPT_DIR#g; s#@@REPO_NAME@@#$REPO_NAME#g; s#@@CHANNEL@@#$RELEASE_CHANNEL#g; s#@@ARCH@@#$ARCH#g" \
|
|
< "$TEMPLATE_DIR/postinst.template" \
|
|
> "$DEBIAN_DIR/postinst"
|
|
sed \
|
|
"s#@@REPO_NAME@@#$REPO_NAME#g; s#@@CHANNEL@@#$RELEASE_CHANNEL#g; s#@@ARCH@@#$ARCH#g" \
|
|
< "$WORKSPACE_ROOT_DIR/resources/linux/debian/common/postinst.repo.template" \
|
|
>> "$DEBIAN_DIR/postinst"
|
|
sed \
|
|
"s#@@PACKAGE_NAME@@#$PACKAGE_NAME#g; s#@@CHANNEL_SUFFIX@@#$CHANNEL_SUFFIX#g; s#@@BINARY_NAME@@#$BINARY_NAME#g; s#@@OPTDIR@@#$OPT_DIR#g; s#@@REPO_NAME@@#$REPO_NAME#g" \
|
|
< "$TEMPLATE_DIR/postrm.template" \
|
|
> "$DEBIAN_DIR/postrm"
|
|
sed \
|
|
"s#@@REPO_NAME@@#$REPO_NAME#g" \
|
|
< "$WORKSPACE_ROOT_DIR/resources/linux/debian/common/postrm.repo.template" \
|
|
>> "$DEBIAN_DIR/postrm"
|
|
|
|
# Make the package scripts executable.
|
|
chmod 755 \
|
|
"$DEBIAN_DIR/postinst" \
|
|
"$DEBIAN_DIR/postrm"
|
|
|
|
# Build the actual package.
|
|
cd "$DIST_DIR/debpkg"
|
|
fakeroot dpkg-deb -b "$PACKAGE_NAME-$ARCH" "$OUT_DIR"
|
|
|
|
echo "Successfully built .deb package at $OUT_DIR/${PACKAGE_NAME}_${VERSION}_${ARCH}.deb!"
|