1
0
mirror of https://git.fsfe.org/FSFE/fsfe-local-build.git synced 2026-04-20 11:23:06 +02:00

adding README and license

This commit is contained in:
2016-11-14 02:09:44 +01:00
parent ffd5b6ef74
commit f0e2772ddd
3 changed files with 657 additions and 8 deletions

View File

@@ -1,15 +1,34 @@
#!/bin/bash
########################################################################
# Copyright (C) 2016 Max Mehl <max.mehl@fsfe.org>
########################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
########################################################################
#
# A script to preview XHTML files locally, best to use with FSFE's
# website setup.
#
# Instructions: https://blog.mehl.mx/2016/build-fsfe-websites-locally/
#
#######################################################################
ROOT=$(dirname "$(readlink -f "$0")")
if [ ! -e "$ROOT"/config.cfg ]; then echo "Missing config.cfg file. Edit and rename config.cfg.sample"; exit 1; fi
source "$ROOT"/config.cfg
# XMLLINT test
# Alles in args, selbst erkennen ob build
# Webserver und Path nur anzeigen bei XHTML
# CONFIG file
if [ "$1" = "" ]; then
self=$(basename $0)
echo "No parameters or variables given!"
@@ -67,11 +86,17 @@ DST_full=$(echo $SRC_full | sed -E "s|$LOC_trunk|$LOC_out|") # replace SVN dire
ftype=${SRC_full##*.} # get extension of file
ftype=$(echo "$ftype" | tr '[:upper:]' '[:lower:]')
ftype_build="xhtml" # file types which have to be built
if [[ "$ftype" == @($ftype_build) ]]; then # file type of source has to be built
if [[ "$ftype" == @($ftype_build) ]]; then # XHTML file
DST_full=$(echo $DST_full | sed -E "s/$ftype_build/html/") # Replace xhtml by html
echo "[INFO] XHTML file detected. Going to build into $DST_full ..."
xmllint --noout "$SRC_full" || (echo; echo "[ERROR] Syntax error in $SRC_full. Error message above. Please fix!"; exit 1)
if [[ "$?" != "0" ]]; then exit 1; fi
$LOC_trunk/build/build_main.sh process_file $SRC_full > $DST_full
else # if not built, just move it
else # just copy file
echo "[INFO] File type ($ftype) is detected as not to be built. Just copying it to $DST_full ..."
cp $SRC_full $DST_full
fi