#!/bin/bash # This is the endboard software, it is a textboard written for the use # in the darknets. # # This is the installation script, which you can use to make the needed # directories and distribute the files. # # The writing of this code started some time ago with another software # called smolBBS. Although there is almost no original code left now, # I still regard endboard as a fork of smolBBS. # The author of smolBBS has required that the following text be # distributed with any redistribution, so here it goes. # The license and other conditions apply to endboard as well. # # IRC: #dulm @ irc.rizon.net # # Copyright (C) 2020 sandlind # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # (1) Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # (2) Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the # distribution. # # (3) The name of the author may not be used to # endorse or promote products derived from this software without # specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. ### Make directories function make_directories { mkdir -p /srv/endboard/mob /etc/opt/endboard /var/opt/endboard /opt/endboard chown -R www-data:www-data /var/opt/endboard } ### Distribute files to directories (from directory of the endboard archive): function distribute_files { cp -rv ./srv/* /srv/endboard/ cp -v ./opt/*.php /opt/endboard/ } ### Distribute config files (from directory of the endboard archive): function distribute_config_files { cp -v ./etc/config.php /etc/opt/endboard/ cp ./etc/endboard /etc/nginx/sites-available/ } ### Enable the site in nginx config dirs function enable_site { ln -s /etc/nginx/sites-available/endboard /etc/nginx/sites-enabled/ nginx -t && systemctl reload nginx } ### Show some help text to explain what we do here function show_help { echo "This is a little script to automate the installation process." echo "The first step is always to update your system and install " echo "all the needed components. On a debian system, it would be done " echo "like this:" echo echo "apt update " echo "apt upgrade -y " echo "apt install -y php php-json php-mbstring php-sqlite3 php-fpm nginx" echo echo "After that, edit the files etc/config.php and etc/endboard " echo "according to your needs." echo echo "After these steps, you can use the script like this" echo echo "./install.sh dirs : make all needed directories (standard paths)" echo "./install.sh files : distribute files to directories" echo "./install.sh config : distribute config files (endboard & nginx)" echo "./install.sh enable : enable the site and restart nginx" echo "./install.sh all : do all of the above in sequence" } ### Control flow starts here if [ -z "$1" ]; then clear show_help elif [ "$1" == 'dirs' ]; then make_directories elif [ "$1" == 'files' ]; then distribute_files elif [ "$1" == 'config' ]; then distribute_config_files elif [ "$1" == 'enable' ]; then enable_site elif [ "$1" == 'all' ]; then make_directories distribute_files distribute_config_files enable_site else clear echo "unknown parameter: $1" echo show_help fi