diff --git a/.devcontainer/devcontainer-lock.json b/.devcontainer/devcontainer-lock.json new file mode 100644 index 0000000..889fec9 --- /dev/null +++ b/.devcontainer/devcontainer-lock.json @@ -0,0 +1,34 @@ +{ + "features": { + "ghcr.io/devcontainers/features/copilot-cli": { + "version": "1.1.2", + "resolved": "ghcr.io/devcontainers/features/copilot-cli@sha256:757c6c2899dc902c44a9f6164c1f7392832ced13c6bb632d8d60a880f2e92456", + "integrity": "sha256:757c6c2899dc902c44a9f6164c1f7392832ced13c6bb632d8d60a880f2e92456" + }, + "ghcr.io/devcontainers/features/docker-in-docker:2": { + "version": "2.16.1", + "resolved": "ghcr.io/devcontainers/features/docker-in-docker@sha256:ce078b7bf7d9ef3bcb9813b32103795d8d72172446890b64772cbe1dec6baafd", + "integrity": "sha256:ce078b7bf7d9ef3bcb9813b32103795d8d72172446890b64772cbe1dec6baafd" + }, + "ghcr.io/devcontainers/features/github-cli:latest": { + "version": "1.1.0", + "resolved": "ghcr.io/devcontainers/features/github-cli@sha256:d22f50b70ed75339b4eed1ba9ecde3a1791f90e88d37936517e3bace0bbad671", + "integrity": "sha256:d22f50b70ed75339b4eed1ba9ecde3a1791f90e88d37936517e3bace0bbad671" + }, + "ghcr.io/jsburckhardt/devcontainer-features/tmux:1": { + "version": "1.0.0", + "resolved": "ghcr.io/jsburckhardt/devcontainer-features/tmux@sha256:f75eb8e2c8f9ea30980729d5303b96071a4f17ad3d5eccab0c75efc5d8271498", + "integrity": "sha256:f75eb8e2c8f9ea30980729d5303b96071a4f17ad3d5eccab0c75efc5d8271498" + }, + "ghcr.io/jsburckhardt/devcontainer-features/yazi:1.0.1": { + "version": "1.0.1", + "resolved": "ghcr.io/jsburckhardt/devcontainer-features/yazi@sha256:35383727c0eee36d02f89ee7e805cbd94dfabe6c86d24c2e07e33b1a678e098a", + "integrity": "sha256:35383727c0eee36d02f89ee7e805cbd94dfabe6c86d24c2e07e33b1a678e098a" + }, + "ghcr.io/stuartleeks/dev-container-features/shell-history:0": { + "version": "0.0.6", + "resolved": "ghcr.io/stuartleeks/dev-container-features/shell-history@sha256:f266af2d093e0611921ccf510046e53affeccb353405ee05d2b91fcc4f69c1c9", + "integrity": "sha256:f266af2d093e0611921ccf510046e53affeccb353405ee05d2b91fcc4f69c1c9" + } + } +} \ No newline at end of file diff --git a/README.md b/README.md index 3e6c93e..0a80e2d 100644 --- a/README.md +++ b/README.md @@ -437,15 +437,15 @@ Running `hurl --version` inside the built container will print the version of hu { "image": "mcr.microsoft.com/devcontainers/base:ubuntu", "features": { - "ghcr.io/jsburckhardt/devcontainer-features/fzf:1": {} - "ghcr.io/jsburckhardt/devcontainer-features/lazygit:1": {} - "ghcr.io/jsburckhardt/devcontainer-features/ripgrep:1": {} - "ghcr.io/jsburckhardt/devcontainer-features/fd:1": {} - "ghcr.io/jsburckhardt/devcontainer-features/rtk:1": {} - "ghcr.io/jsburckhardt/devcontainer-features/zoxide:1": {} - "ghcr.io/jsburckhardt/devcontainer-features/hyperfine:1": {} - "ghcr.io/jsburckhardt/devcontainer-features/glow:1": {} - "ghcr.io/jsburckhardt/devcontainer-features/fx:1": {} + "ghcr.io/jsburckhardt/devcontainer-features/fzf:1": {}, + "ghcr.io/jsburckhardt/devcontainer-features/lazygit:1": {}, + "ghcr.io/jsburckhardt/devcontainer-features/ripgrep:1": {}, + "ghcr.io/jsburckhardt/devcontainer-features/fd:1": {}, + "ghcr.io/jsburckhardt/devcontainer-features/rtk:1": {}, + "ghcr.io/jsburckhardt/devcontainer-features/zoxide:1": {}, + "ghcr.io/jsburckhardt/devcontainer-features/hyperfine:1": {}, + "ghcr.io/jsburckhardt/devcontainer-features/glow:1": {}, + "ghcr.io/jsburckhardt/devcontainer-features/fx:1": {}, "ghcr.io/jsburckhardt/devcontainer-features/hurl:1": {} } } diff --git a/src/hurl/install.sh b/src/hurl/install.sh index c52c240..1a499be 100644 --- a/src/hurl/install.sh +++ b/src/hurl/install.sh @@ -28,8 +28,26 @@ check_packages() { fi } -# Make sure we have curl, jq, and hurl runtime dependencies -check_packages curl jq ca-certificates libxml2 libcurl4 libssl3 +# Make sure we have curl and jq +check_packages curl jq ca-certificates + +# Install libxml2 runtime dependency +# On newer Ubuntu (25.04+), the package is libxml2-16 and provides libxml2.so.16 +# but hurl is linked against libxml2.so.2, so we need a compatibility symlink +if [ "$(find /var/lib/apt/lists/* 2>/dev/null | wc -l)" = "0" ]; then + apt-get update -y +fi +if apt-cache show libxml2 2>&1 | grep -q "^Version:"; then + check_packages libxml2 +else + check_packages libxml2-16 + # Create compatibility symlink for binaries expecting libxml2.so.2 + LIBXML2_SO=$(find /usr/lib -name "libxml2.so.*" ! -name "*.so.*.*" | head -1) + if [ -n "$LIBXML2_SO" ] && [ ! -e "$(dirname "$LIBXML2_SO")/libxml2.so.2" ]; then + ln -s "$LIBXML2_SO" "$(dirname "$LIBXML2_SO")/libxml2.so.2" + ldconfig + fi +fi # Function to get the latest version from GitHub API get_latest_version() { @@ -38,7 +56,6 @@ get_latest_version() { # Check if a version is passed as an argument if [ -z "$HURL_VERSION" ] || [ "$HURL_VERSION" == "latest" ]; then - # No version provided, get the latest version HURL_VERSION=$(get_latest_version) echo "No version provided or 'latest' specified, installing the latest version: $HURL_VERSION" else @@ -46,9 +63,7 @@ else fi # Determine the OS and architecture -OS=$(uname -s | tr '[:upper:]' '[:lower:]') ARCH=$(uname -m) - case "$ARCH" in x86_64) ARCH="x86_64" @@ -62,21 +77,8 @@ case "$ARCH" in ;; esac -case "$OS" in - linux) - OS="unknown-linux-gnu" - ;; - darwin) - OS="apple-darwin" - ;; - *) - echo "Unsupported OS: $OS" - exit 1 - ;; -esac - # Construct the download URL -DOWNLOAD_URL="https://github.com/${REPO_OWNER}/${REPO_NAME}/releases/download/${HURL_VERSION}/hurl-${HURL_VERSION}-${ARCH}-${OS}.tar.gz" +DOWNLOAD_URL="https://github.com/${REPO_OWNER}/${REPO_NAME}/releases/download/${HURL_VERSION}/hurl-${HURL_VERSION}-${ARCH}-unknown-linux-gnu.tar.gz" # Create a temporary directory for the download TMP_DIR=$(mktemp -d) @@ -102,7 +104,7 @@ mv "${EXTRACTED_DIR}/bin/hurl" /usr/local/bin/ mv "${EXTRACTED_DIR}/bin/hurlfmt" /usr/local/bin/ # Cleanup -cd - || exit +cd / || exit rm -rf "$TMP_DIR" # Clean up