From a2fac247975b4bffe7cbdc4c56aa69f4009e455f Mon Sep 17 00:00:00 2001 From: John Polstra Date: Sun, 2 Feb 1997 04:11:35 +0000 Subject: The cvsup-mirror port, a kit that makes it easy to set up a FreeBSD mirror site. --- net/cvsup-mirror/scripts/configure | 198 +++++++++++++++++++++++++++++++++++++ 1 file changed, 198 insertions(+) create mode 100644 net/cvsup-mirror/scripts/configure (limited to 'net/cvsup-mirror/scripts/configure') diff --git a/net/cvsup-mirror/scripts/configure b/net/cvsup-mirror/scripts/configure new file mode 100644 index 000000000000..6854f90ad8f0 --- /dev/null +++ b/net/cvsup-mirror/scripts/configure @@ -0,0 +1,198 @@ +#! /bin/sh + +base=${PREFIX}/etc/cvsup +variables="user group host host_crypto interval maxclients facility distribs" + +ask() { + local question default answer + + question=$1 + default=$2 + if [ -z "${PACKAGE_BUILDING}" ]; then + read -p "${question} [${default}]? " answer + fi + if [ x${answer} = x ]; then + answer=${default} + fi + echo ${answer} +} + +yesno() { + local dflt question answer + + question=$1 + dflt=$2 + while :; do + answer=$(ask "${question}" "${dflt}") + case "${answer}" in + [Yy]*) return 0;; + [Nn]*) return 1;; + esac + echo "Please answer yes or no." + done +} + +ask_distrib() { + local desc dflt link dir subdir + + link=$1 + dflt=$2 + subdir=$3 + desc=$4 + if yesno "Do you wish to mirror the ${desc}" y; then + while :; do + dir=$(ask "Where would you like to put it" ${dflt}) + if [ "${subdir}" = "." ]; then + break + fi + dir=$(expr "${dir}" : "\(.*\)/${subdir}\$") + if [ "x${dir}" != x ]; then + break + fi + echo "The location must match \"*/${subdir}\"" + done + distribs="${distribs} ${link} ${dir} ${subdir}" + return 0 + else + distribs="${distribs} ${link} SKIP ${subdir}" + return 1 + fi +} + +canonicalize() { + echo $1 | tr "[:upper:]" "[:lower:]" +} + +#------------------------------------------------------------------------------ + +cat </dev/null 2>&1; then + break + fi + echo "Please answer with a number" +done + +#------------------------------------------------------------------------------ + +echo "" +echo -n "Building the \"config.sh\" file ... " +for var in ${variables}; do + eval echo ${var}=\\\"\${${var}}\\\" +done > ${WRKSRC}/config.sh +echo "Done." -- cgit v1.2.3