@@ -28,8 +28,26 @@ check_packages() {
2828 fi
2929}
3030
31- # Make sure we have curl, jq, and hurl runtime dependencies
32- check_packages curl jq ca-certificates libxml2 libcurl4 libssl3
31+ # Make sure we have curl and jq
32+ check_packages curl jq ca-certificates
33+
34+ # Install libxml2 runtime dependency
35+ # On newer Ubuntu (25.04+), the package is libxml2-16 and provides libxml2.so.16
36+ # but hurl is linked against libxml2.so.2, so we need a compatibility symlink
37+ if [ " $( find /var/lib/apt/lists/* 2> /dev/null | wc -l) " = " 0" ]; then
38+ apt-get update -y
39+ fi
40+ if apt-cache show libxml2 2>&1 | grep -q " ^Version:" ; then
41+ check_packages libxml2
42+ else
43+ check_packages libxml2-16
44+ # Create compatibility symlink for binaries expecting libxml2.so.2
45+ LIBXML2_SO=$( find /usr/lib -name " libxml2.so.*" ! -name " *.so.*.*" | head -1)
46+ if [ -n " $LIBXML2_SO " ] && [ ! -e " $( dirname " $LIBXML2_SO " ) /libxml2.so.2" ]; then
47+ ln -s " $LIBXML2_SO " " $( dirname " $LIBXML2_SO " ) /libxml2.so.2"
48+ ldconfig
49+ fi
50+ fi
3351
3452# Function to get the latest version from GitHub API
3553get_latest_version () {
@@ -38,17 +56,14 @@ get_latest_version() {
3856
3957# Check if a version is passed as an argument
4058if [ -z " $HURL_VERSION " ] || [ " $HURL_VERSION " == " latest" ]; then
41- # No version provided, get the latest version
4259 HURL_VERSION=$( get_latest_version)
4360 echo " No version provided or 'latest' specified, installing the latest version: $HURL_VERSION "
4461else
4562 echo " Installing version from environment variable: $HURL_VERSION "
4663fi
4764
4865# Determine the OS and architecture
49- OS=$( uname -s | tr ' [:upper:]' ' [:lower:]' )
5066ARCH=$( uname -m)
51-
5267case " $ARCH " in
5368 x86_64)
5469 ARCH=" x86_64"
@@ -62,21 +77,8 @@ case "$ARCH" in
6277 ;;
6378esac
6479
65- case " $OS " in
66- linux)
67- OS=" unknown-linux-gnu"
68- ;;
69- darwin)
70- OS=" apple-darwin"
71- ;;
72- * )
73- echo " Unsupported OS: $OS "
74- exit 1
75- ;;
76- esac
77-
7880# Construct the download URL
79- DOWNLOAD_URL=" https://github.com/${REPO_OWNER} /${REPO_NAME} /releases/download/${HURL_VERSION} /hurl-${HURL_VERSION} -${ARCH} -${OS} .tar.gz"
81+ DOWNLOAD_URL=" https://github.com/${REPO_OWNER} /${REPO_NAME} /releases/download/${HURL_VERSION} /hurl-${HURL_VERSION} -${ARCH} -unknown-linux-gnu .tar.gz"
8082
8183# Create a temporary directory for the download
8284TMP_DIR=$( mktemp -d)
@@ -102,7 +104,7 @@ mv "${EXTRACTED_DIR}/bin/hurl" /usr/local/bin/
102104mv " ${EXTRACTED_DIR} /bin/hurlfmt" /usr/local/bin/
103105
104106# Cleanup
105- cd - || exit
107+ cd / || exit
106108rm -rf " $TMP_DIR "
107109
108110# Clean up
0 commit comments