#!/bin/bash
# $Header: /opt/coblabs/public_cvs/public_html/cal/setup.bash,v 1.1 2026/01/07 16:54:08 asm Exp $
#
# Flan: free plan/schedule digital signage suite
# http://www.aperture.akron.oh.us/~asm/flan/
#
# Copyright (C) 2025 Anton McClure <asm@aperture.akron.oh.us>
#
# Maintainer: Anton McClure
#             http://www.aperture.akron.oh.us/~asm/
#             asm@aperture.akron.oh.us
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# $Log: setup.bash,v $
# Revision 1.1  2026/01/07 16:54:08  asm
# Add CoB setup script to CVS.
#
apt-get install -y make gcc lib{x{11,pm},curl4-gnutls}-dev xinit xfonts-{base,{75,100}dpi}
mkdir -p /usr/local/share/flan/ && \
wget http://www.aperture.akron.oh.us/~coblabs/cal/uakron.xpm -O /usr/local/share/flan/uakron.xpm && \
cd /tmp/ && \
wget "http://www.aperture.akron.oh.us/ucgi/~asm/cvsweb/flan/flan.tar.gz?tarball=1" -O flan.tar.gz && \
tar -xzvf flan.tar.gz && \
cd flan/ && \
wget http://www.aperture.akron.oh.us/ucgi/~coblabs/cobcal/config.cgi?$(hostname -s | tr -d '\r\n') -O /tmp/flan/config.h && \
cp -v Makefile.example Makefile && \
make clean && \
make && \
make install && \
rm -rvf /tmp/flan/ /tmp/flan.tar.gz && \
wget http://www.aperture.akron.oh.us/ucgi/~coblabs/cobcal/cron.cgi?$(hostname -s | tr -d '\r\n') -O /etc/cron.d/cobcal && \
printf "/bin/wget --retry-connrefused --waitretry=1 --timeout=60 --quiet --output-document=/tmp/setup.bash http://www.aperture.akron.oh.us/~coblabs/cal/setup.bash && /bin/bash /tmp/setup.bash; /bin/rm /tmp/setup.bash" > /usr/local/bin/update-cobcal && \
chmod +x /usr/local/bin/update-cobcal && \
systemctl enable flan && \
systemctl restart flan
