Skip to content

Version the shell files outside of init.rs #387

Description

@mcint

zerobrew is serving as a bad citizen by insisting on setting these widely used environment variables.

zerobrew/zb_cli/src/init.rs

Lines 301 to 347 in 8d9af90

r#"
# zerobrew
export ZEROBREW_DIR={zerobrew_dir}
export ZEROBREW_BIN={zerobrew_bin}
export ZEROBREW_ROOT={root}
export ZEROBREW_PREFIX={prefix}
export PKG_CONFIG_PATH="$ZEROBREW_PREFIX/lib/pkgconfig:${{PKG_CONFIG_PATH:-}}"
# SSL/TLS certificates (only if ca-certificates is installed)
if [ -z "${{CURL_CA_BUNDLE:-}}" ] || [ -z "${{SSL_CERT_FILE:-}}" ]; then
if [ -f "$ZEROBREW_PREFIX/opt/ca-certificates/share/ca-certificates/cacert.pem" ]; then
[ -z "${{CURL_CA_BUNDLE:-}}" ] && export CURL_CA_BUNDLE="$ZEROBREW_PREFIX/opt/ca-certificates/share/ca-certificates/cacert.pem"
[ -z "${{SSL_CERT_FILE:-}}" ] && export SSL_CERT_FILE="$ZEROBREW_PREFIX/opt/ca-certificates/share/ca-certificates/cacert.pem"
elif [ -f "$ZEROBREW_PREFIX/etc/ca-certificates/cacert.pem" ]; then
[ -z "${{CURL_CA_BUNDLE:-}}" ] && export CURL_CA_BUNDLE="$ZEROBREW_PREFIX/etc/ca-certificates/cacert.pem"
[ -z "${{SSL_CERT_FILE:-}}" ] && export SSL_CERT_FILE="$ZEROBREW_PREFIX/etc/ca-certificates/cacert.pem"
elif [ -f "$ZEROBREW_PREFIX/etc/openssl/cert.pem" ]; then
[ -z "${{CURL_CA_BUNDLE:-}}" ] && export CURL_CA_BUNDLE="$ZEROBREW_PREFIX/etc/openssl/cert.pem"
[ -z "${{SSL_CERT_FILE:-}}" ] && export SSL_CERT_FILE="$ZEROBREW_PREFIX/etc/openssl/cert.pem"
elif [ -f "$ZEROBREW_PREFIX/share/ca-certificates/cacert.pem" ]; then
[ -z "${{CURL_CA_BUNDLE:-}}" ] && export CURL_CA_BUNDLE="$ZEROBREW_PREFIX/share/ca-certificates/cacert.pem"
[ -z "${{SSL_CERT_FILE:-}}" ] && export SSL_CERT_FILE="$ZEROBREW_PREFIX/share/ca-certificates/cacert.pem"
fi
fi
if [ -z "${{SSL_CERT_DIR:-}}" ]; then
if [ -d "$ZEROBREW_PREFIX/etc/ca-certificates" ]; then
export SSL_CERT_DIR="$ZEROBREW_PREFIX/etc/ca-certificates"
elif [ -d "$ZEROBREW_PREFIX/etc/openssl/certs" ]; then
export SSL_CERT_DIR="$ZEROBREW_PREFIX/etc/openssl/certs"
elif [ -d "$ZEROBREW_PREFIX/share/ca-certificates" ]; then
export SSL_CERT_DIR="$ZEROBREW_PREFIX/share/ca-certificates"
fi
fi
# Helper function to safely append to PATH
_zb_path_append() {{
local argpath="$1"
case ":${{PATH}}:" in
*:"$argpath":*) ;;
*) export PATH="$argpath:$PATH" ;;
esac;
}}
_zb_path_append "$ZEROBREW_BIN"
_zb_path_append "$ZEROBREW_PREFIX/bin"
"#,

I don't have zerobrew-managed ca-certificates installed, don't want, and don't need.

A considerate developer or agent, would create a ZEROBREW_SSL_CERT_FILE or ZEROBREW_SSL_CERT_DIR env vars to use


I re-attempted to install from tap, which left me with v0.1.1, already filed #386 here and there lucasgelfond/homebrew-zerobrew#1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: clizb and zbx command-line behaviorarea: installinstall, uninstall, upgrade, outdated, and migration flowsarea: networkingapi, cache, tls, and downloadspriority: mediumnormal prioritystatus: acceptedvalid and ready for someone to work ontype: featurenew user-facing behavior or capability

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions