#!/bin/sh
# Assumes the CWD includes quicklisp.lisp
echo "Make sure swtx user exists with updated resource limits (see /etc/login.conf)"
echo "Failing to increase the vmemoryusage will lead to memory exhaustion errors"
echo "when loading the packaging using ql:quickload"
echo "Installing packages"
doas -u root pkg_add sbcl-2.2.5-threads zstd lmdb fcgi
echo "Installing quicklisp, use (quicklisp-quickstart:install)"
doas -u swtx sbcl --load quicklisp.lisp
echo "Installing cl-swiggy-tix to /usr/local/share/cl-swiggy-tix"
doas -u root mkdir -p /usr/local/share/cl-swiggy-tix
doas -u root chown swtx /usr/local/share/cl-swiggy-tix
echo "Copying the source ball to /usr/local/share/cl-swiggy-tix"
echo "Linking to ~swtx/common-lisp"
doas -u swtx mkdir /home/swtx/common-lisp
doas -u swtx ln -s /usr/local/share/cl-swiggy-tix /home/swtx/common-lisp/cl-swiggy-tix
echo "Building the swtx binary"
doas -u swtx sbcl --dynamic-space-size 1024 \
--load /usr/local/share/cl-swiggy-tix/cl-swiggy-tix.asd \
--eval "(ql:quickload 'cl-swiggy-tix)" \
--eval "(asdf:make :cl-swiggy-tix)"
echo "Copying the httpd.conf.swtx file"
doas -u root install -m 0444 httpd.conf.swtx /etc/
if ! test -f /etc/httpd.conf
then
echo "No /etc/httpd.conf exists; creating..."
echo "include \"/etc/httpd.conf.swtx\"" | doas -u root tee /etc/httpd.conf
else
echo "/etc/httpd.conf exists; make sure it includes /etc/httpd.conf.swtx"
fi
echo "Enabling httpd"
doas -u root rcctl enable httpd
echo "Copying over SPA resources"
doas -u root cp -R tix.sw.gy /var/www/htdocs