@@ -90,22 +90,32 @@ zopen_init()
9090 return 8
9191 fi
9292
93- # Download curl package if not present
93+ # Download curl package
9494 CURL_PACKAGE="curl-8.10.1.20241001_214340.zos.pax.Z"
9595 CURL_URL="https://github.com/zopencommunity/curlport/releases/download/STABLE_curlport_2544/${CURL_PACKAGE}"
9696 mkdir -p "$PWD/packages"
9797
98- # Check if any curl package already exists
99- existing_curl=$(ls "$PWD/packages"/curl-*.zos.pax.Z 2>/dev/null | head -1)
100-
101- if [ -n "$existing_curl" ]; then
102- echo "Found existing curl package: $(basename "$existing_curl"), skipping download"
98+ echo "Downloading curl package from ${CURL_URL}..."
99+ curl -L -o "$PWD/packages/${CURL_PACKAGE}" "${CURL_URL}" || {
100+ echo "Error: Failed to download curl package"
101+ return 1
102+ }
103+
104+ # Copy date and sha256sum utilities from coreutils dependency
105+ mkdir -p "$PWD/utilities"
106+ if [ -n "$COREUTILS_HOME" ] && [ -d "$COREUTILS_HOME/bin" ]; then
107+ for util in date sha256sum; do
108+ # Try both regular and GNU-prefixed versions
109+ if [ -f "$COREUTILS_HOME/bin/$util" ]; then
110+ cp -v "$COREUTILS_HOME/bin/$util" "$PWD/utilities/"
111+ elif [ -f "$COREUTILS_HOME/bin/g$util" ]; then
112+ cp -v "$COREUTILS_HOME/bin/g$util" "$PWD/utilities/$util"
113+ else
114+ echo "Warning: $util (or g$util) not found in coreutils at $COREUTILS_HOME/bin"
115+ fi
116+ done
103117 else
104- echo "Downloading curl package from ${CURL_URL}..."
105- curl -L -o "$PWD/packages/${CURL_PACKAGE}" "${CURL_URL}" || {
106- echo "Error: Failed to download curl package"
107- return 1
108- }
118+ echo "Warning: COREUTILS_HOME not set or coreutils bin directory not found"
109119 fi
110120}
111121
@@ -177,20 +187,12 @@ zopen_install()
177187 fi
178188
179189 # Copy essential runtime folders
180- for folder in bin include man data utilities patch-utils; do
190+ for folder in bin include man data utilities packages patch-utils; do
181191 if [ -d "$PWD/$folder" ]; then
182192 cp -rv "$PWD/$folder" "$ZOPEN_INSTALL_DIR/"
183193 fi
184194 done
185195
186- # Copy only curl packages
187- if [ -d "$PWD/packages" ]; then
188- mkdir -p "$ZOPEN_INSTALL_DIR/packages"
189- for curl_pkg in "$PWD/packages"/curl-*.zos.pax.Z; do
190- [ -f "$curl_pkg" ] && cp -v "$curl_pkg" "$ZOPEN_INSTALL_DIR/packages/"
191- done
192- fi
193-
194196 # Copy essential runtime files
195197 for file in .env cacert.pem LICENSE; do
196198 if [ -f "$PWD/$file" ]; then
0 commit comments