From: Arran Cudbard-Bell Date: Thu, 9 Nov 2023 23:29:20 +0000 (-0600) Subject: Allow overriding the socket path to work around weird permissions issues X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=319e2ed84faa2d4f11af61e1af78be31f3d6a3c7;p=thirdparty%2Ffreeradius-server.git Allow overriding the socket path to work around weird permissions issues --- diff --git a/scripts/ci/ldap-setup.sh b/scripts/ci/ldap-setup.sh index 065143df173..74161d12b12 100755 --- a/scripts/ci/ldap-setup.sh +++ b/scripts/ci/ldap-setup.sh @@ -1,20 +1,33 @@ #!/usr/bin/env bash urlencode() { - local string="${1}" - local strlen=${#string} - local encoded="" - local pos c o - - for (( pos=0 ; pos&2 +} + +debug () { + if $VERBOSE; then + echo "$@" + fi } # Allow setup script to work with homebrew too @@ -26,13 +39,35 @@ suffix=$(echo "${0##*/}" | sed -E 's/^ldap(.*)-setup.sh$/\1/') [ -e "/tmp/slapd${suffix}.pid" ] && kill $(cat /tmp/slapd${suffix}.pid) base_dir="/tmp/ldap${suffix}" + +# +# Command line options to override the default template values +# +while getopts 's:b:' opt; do + case "$opt" in + b) + base_dir="$OPTARG" + ;; + + s) + socket_path="$OPTARG" + ;; + + *) + error "Usage: $0 [-b base_dir] [-s socket_path]" + exit 1 + ;; + esac +done +shift "$(($OPTIND -1))" + cert_dir="${base_dir}/certs" data_dir="${base_dir}/db" schema_dir="${base_dir}/schema" socket_path="${base_dir}/socket" socket_url=ldapi://$(urlencode "${socket_path}") -echo "base_dir \"${base_dir}\"" +debug "base_dir \"${base_dir}\"" # Clean out any existing DB rm -rf "${data_dir}"