Welcome to the CHICKEN Scheme pasting service
setup-and-run-qwiki.sh added by mario-goulart on Sat Jul 18 00:22:24 2026
#! /bin/sh set -e usage() { cat <<EOF Usage: $(basename "$0") <work-dir> <work-dir> is where things will be downloaded and built. EOF } [ "$1" = "-h" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ] && { usage exit 0 } [ -z "$1" ] && { usage >&2 exit 2 } work_dir=$1 # Build eggs with debug info export CSC_OPTIONS="-d3 -O0" command -v wget >/dev/null || { echo "wget is required. Install it and try again." >&2 exit 1 } mkdir -p "$work_dir" work_dir=$(readlink -f "$work_dir") cd "$work_dir" mkcmd=make jobs=1 case "$(uname)" in Linux) jobs=$(nproc) ;; OpenBSD) jobs=$(sysctl -n hw.ncpuonline) mkcmd=gmake ;; esac fetch_chicken() { echo "##### Fetching chicken-core" if [ -d "$work_dir/chicken-core" ]; then git -C "$work_dir/chicken-core" clean -dxf else git clone https://code.call-cc.org/chicken-core fi } fetch_svn_client() { echo "##### Fetching svnclient" if [ -d "$work_dir/svn-client" ]; then rm -f "$work_dir/svn-client"/*.{o,so} else svn --username anonymous --password "" \ co https://code.call-cc.org/svn/chicken-eggs/release/6/svn-client/trunk svn-client fi } fetch_qwiki() { echo "##### Fetching qwiki" if [ -d "$work_dir/qwiki" ]; then rm -f "$work_dir/qwiki"/*.{o,so} else svn --username anonymous --password "" \ co https://code.call-cc.org/svn/chicken-eggs/release/6/qwiki/trunk qwiki fi } fetch_wiki() { echo "##### Fetching wiki content" [ -d "$work_dir/wiki" ] || svn --username anonymous --password "" co https://code.call-cc.org/svn/chicken-eggs/wiki wiki } install_chicken() { echo "##### Installing CHICKEN" if [ ! -e "$work_dir/chicken/bin/csi" ]; then cd ./chicken-core unset CDPATH ./scripts/bootstrap.sh ./configure --chicken ./chicken-boot --debugbuild --prefix "$work_dir/chicken" $mkcmd -j "$jobs" $mkcmd install cd .. fi } install_svn_client() { echo "##### Installing svn-client" cd ./svn-client "$work_dir/chicken/bin/chicken-install" cd .. } install_qwiki() { echo "##### Installing qwiki" cd ./qwiki "$work_dir/chicken/bin/chicken-install" cd .. } run_qwiki() { echo "##### Running qwiki" cat <<EOF > "$work_dir/qwiki-conf.scm" (import spiffy qwiki qwiki-svn) (qwiki-repos-uri "https://code.call-cc.org/svn/chicken-eggs/wiki") (qwiki-source-path "$work_dir/wiki") (qwiki-web-path "$work_dir/tmp/qwiki-test") ;; Ensure this is an absolute path, if you are using Chicken 4.1 or earlier (root-path "$work_dir/tmp/qwiki-test") ;; Pass all requests to non-existent files through qwiki: (vhost-map (quasiquote ((".*" . ,(lambda (continue) (parameterize ((handle-not-found qwiki-handler) (handle-directory qwiki-handler) (index-files '())) (continue))))))) (start-server) EOF touch "$work_dir/ready" "$work_dir/chicken/bin/csi" -s "$work_dir/qwiki-conf.scm" } if [ ! -e "$work_dir/ready" ]; then fetch_chicken fetch_svn_client fetch_qwiki fetch_wiki install_chicken install_svn_client install_qwiki fi run_qwiki