#!/bin/sh set -eu # tool used to download. url as argument, output to stdout. DOWNLOAD_BIN=${DOWNLOAD_BIN:-ftp -Vo-} #DOWNLOAD_BIN=${DOWNLOAD_BIN:-curl -s} if [ $# -ne 2 ]; then cat >&2 <&2 exit 0 fi echo "- Getting OpenBSD version" >&2 target_version=`${DOWNLOAD_BIN} "${url}/SHA256" \ | sed -ne 's,.*(base\([0-9]\)\([0-9]\)\.tgz).*,\1\2,p'` echo "- Downloading and extracting libc environment" >&2 mkdir -p "${target_directory}" cat >"${target_directory}/CACHEDIR.TAG" <&2 for lib in "${target_directory}"/usr/lib/lib*.so.*.* ; do ln -fs -- "${lib}" "${lib%.*.*}" done echo "- Creating ZIG_LIBC file" >&2 cat >"${target_directory}/libc.conf" <