summaryrefslogtreecommitdiff
path: root/net/cvsup-mirror/scripts
diff options
context:
space:
mode:
authorJohn Polstra <jdp@FreeBSD.org>1997-02-02 04:11:35 +0000
committerJohn Polstra <jdp@FreeBSD.org>1997-02-02 04:11:35 +0000
commita2fac247975b4bffe7cbdc4c56aa69f4009e455f (patch)
tree30cbdc7bdf911f802be744e3041c09da9de817b6 /net/cvsup-mirror/scripts
parentChange Makefile more to my likeing. (diff)
The cvsup-mirror port, a kit that makes it easy to set up a FreeBSD
mirror site.
Notes
Notes: svn path=/head/; revision=5495
Diffstat (limited to 'net/cvsup-mirror/scripts')
-rw-r--r--net/cvsup-mirror/scripts/configure198
1 files changed, 198 insertions, 0 deletions
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 <<EOF
+I am going to ask you a few questions so that I can set up your
+FreeBSD mirror configuration. Every question has a [default]
+answer. To accept the default, just press ENTER.
+
+At this point, I am just gathering information. I will not touch
+your system until you type "make install".
+
+EOF
+
+if [ x${USA_RESIDENT} = xYES ]; then
+ dflt_domestic=y
+else
+ dflt_domestic=n
+fi
+if yesno "Is this host in the USA or Canada" ${dflt_domestic}; then
+ domestic=yes
+else
+ domestic=no
+fi
+
+host=$(ask "Master site for your non-crypto updates" freefall.freebsd.org)
+if [ ${domestic} = yes ]; then
+ dflt_host_crypto=${host}
+else
+ dflt_host_crypto=cvsup.internat.freebsd.org
+fi
+
+cat <<EOF
+
+If you are not planning to mirror the crypto files, just accept
+the default answer for the next question.
+
+EOF
+host_crypto=$(ask "Master site for your crypto updates" ${dflt_host_crypto})
+
+host=$(canonicalize ${host})
+host_crypto=$(canonicalize ${host_crypto})
+
+while :; do
+ interval=$(ask "How many hours between updates of your files" 1)
+ case ${interval} in
+ 1|2|3|4|6|8|12|24) break;;
+ esac
+ echo "Please answer 1, 2, 3, 4, 6, 8, 12, or 24"
+done
+
+cat <<EOF
+
+Now you must decide which sets of files you wish to make available
+from your mirror site. You can choose any combination, and you
+can put each set anywhere you want to on your disks. Although each
+set is optional, we strongly encourage every mirror site to carry
+at least the main source tree.
+
+EOF
+
+distribs="distrib.self .. ."
+ask_distrib FreeBSD.cvs /home/ncvs . \
+ "main source tree, except crypto code (340 MB)"
+ask_distrib FreeBSD-crypto.cvs /home/ncvs . \
+ "crypto code (7 MB)"
+ask_distrib FreeBSD.lite2 /home/lite2 . \
+ "BSD-4.4lite2 merge source tree (45 MB)"
+ask_distrib FreeBSD.smp /home/smp . \
+ "SMP support source tree (25 MB)"
+ask_distrib FreeBSD-www.current /usr/local/www . \
+ "installed World Wide Web data (16 MB)"
+ask_distrib FreeBSD-gnats.current /home/gnats gnats \
+ "GNATS bug tracking database (12 MB)"
+
+cat <<EOF
+
+Now, a few questions so that I can set up your CVSup server properly.
+
+For security reasons, the CVSup server should run under its own
+unique user and group IDs. These IDs should have no special access
+privileges. Normally, the user "cvsup" and group "cvsup" are used,
+but you can choose other names if you wish. At "make install"
+time, I will create the user and group, if they don't already exist.
+
+For security reasons, you must use unique user and group IDs for
+this. Do NOT use "nobody", "nonroot", or "nogroup".
+
+EOF
+
+user=$(ask "Unique unprivileged user ID for running the server" cvsup)
+group=$(ask "Unique unprivileged group ID for running the server" cvsup)
+
+cat <<EOF
+
+The CVSup server does its logging via syslog. At "make install"
+time, I will set up the logging for you, if necessary. I will use
+the "!program" feature of syslog to keep your CVSup log messages
+separate from the messages of your other daemons.
+
+EOF
+
+while :; do
+ facility=$(ask "Syslog facility for the server log" daemon)
+ case ${facility} in
+ daemon|local[0-7]|ftp|user) break;;
+ esac
+ echo "Please answer daemon, local0-local7, ftp, or user"
+done
+
+cat <<EOF
+
+You can control the load on your machine by limiting the number of
+clients that the CVSup server will serve at once. CVSup won't load
+your network especially heavily, but it is more CPU and disk
+intensive than most other file server software.
+
+EOF
+
+while :; do
+ maxclients=$(ask "Maximum simultaneous client connections" 8)
+ if expr "${maxclients}" : "[0-9][0-9]*\$" >/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."