website: make the website prefix (software/gnuboot) configurable.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> Acked-by: Adrien 'neox' Bourmault <neox@gnu.org>
This commit is contained in:
parent
6e5e4f3421
commit
776073e2f8
|
@ -24,8 +24,14 @@ BUILD_OPTIONS += --with-untitled-path $(UNTITLED_PATH)
|
|||
GUIX_SHARE_OPTIONS += --share=`realpath $(UNTITLED_PATH)`
|
||||
endif
|
||||
|
||||
index.html: index.html.tmpl
|
||||
sed -e "s#WEBSITE_PREFIX#$(WEBSITE_PREFIX)#g" "$^" > "$@"
|
||||
|
||||
site.cfg: site.cfg.tmpl
|
||||
sed -e "s#WEBSITE_PREFIX#$(WEBSITE_PREFIX)#g" "$^" > "$@"
|
||||
|
||||
if WANT_GUIX
|
||||
build:
|
||||
build: site.cfg
|
||||
guix time-machine \
|
||||
--commit=c15a1cd88f80a90437f4b0159f22dfc84b9e6851 \
|
||||
-- shell \
|
||||
|
@ -44,15 +50,15 @@ build:
|
|||
-- \
|
||||
./build.sh $(BUILD_OPTIONS)
|
||||
else
|
||||
build:
|
||||
build: site.cfg
|
||||
./build.sh $(BUILD_OPTIONS)
|
||||
endif
|
||||
|
||||
if WANT_GUIX
|
||||
check: build website.tar.gz
|
||||
check: build website.tar.gz index.html
|
||||
rm -rf site/
|
||||
mkdir -p site/software/gnuboot/
|
||||
tar xf website.tar.gz -C site/software/gnuboot/
|
||||
mkdir -p site/$(WEBSITE_PREFIX)
|
||||
tar xf website.tar.gz -C site/$(WEBSITE_PREFIX)
|
||||
|
||||
guix shell \
|
||||
--container \
|
||||
|
@ -66,15 +72,17 @@ check: build website.tar.gz
|
|||
sed \
|
||||
tar \
|
||||
-- \
|
||||
./check.sh --directory site && \
|
||||
./check.sh --tarball website.tar.gz
|
||||
./check.sh --website-prefix $(WEBSITE_PREFIX) \
|
||||
--directory site && \
|
||||
./check.sh --website-prefix $(WEBSITE_PREFIX) \
|
||||
--tarball website.tar.gz
|
||||
else
|
||||
check: build website.tar.gz
|
||||
check: build website.tar.gz index.html
|
||||
rm -rf site/
|
||||
mkdir -p site/software/gnuboot/
|
||||
tar xf website.tar.gz -C site/software/gnuboot/
|
||||
./check.sh --directory site
|
||||
./check.sh --tarball website.tar.gz
|
||||
mkdir -p site/$(WEBSITE_PREFIX)
|
||||
tar xf website.tar.gz -C site/$(WEBSITE_PREFIX)
|
||||
./check.sh --website-prefix $(WEBSITE_PREFIX) --directory site
|
||||
./check.sh --website-prefix $(WEBSITE_PREFIX) --tarball website.tar.gz
|
||||
endif
|
||||
|
||||
help:
|
||||
|
@ -83,7 +91,7 @@ help:
|
|||
"help # Print this help" \
|
||||
"build # Build the website" \
|
||||
"serve # run lighttpd on localhost:$(LIGHTTPD_PORT)" \
|
||||
"publish # Publish the website to https://gnu.org/software/gnuboot" \
|
||||
"publish # Publish the website to https://gnu.org/$(WEBSITE_PREFIX)" \
|
||||
"check # Run automatic tests" \
|
||||
"website.tar.gz # Create a tarball of the website"
|
||||
|
||||
|
@ -100,11 +108,13 @@ serve: website.tar.gz
|
|||
sed \
|
||||
tar \
|
||||
-- \
|
||||
./serve.sh website.tar.gz $(LIGHTTPD_PORT)
|
||||
./serve.sh --website-prefix $(WEBSITE_PREFIX) \
|
||||
website.tar.gz $(LIGHTTPD_PORT)
|
||||
else
|
||||
if WANT_LIGHTTPD
|
||||
serve: website.tar.gz
|
||||
./serve.sh website.tar.gz $(LIGHTTPD_PORT)
|
||||
./serve.sh --website-prefix $(WEBSITE_PREFIX) \
|
||||
website.tar.gz $(LIGHTTPD_PORT)
|
||||
else
|
||||
serve:
|
||||
@printf "%s %s\n" \
|
||||
|
@ -127,7 +137,7 @@ publish: website.tar.gz
|
|||
deploy/ \
|
||||
$(RSYNC_DESTINATION)/
|
||||
|
||||
website.tar.gz: build
|
||||
website.tar.gz: build index.html
|
||||
tar \
|
||||
--exclude-vcs \
|
||||
--format=gnu \
|
||||
|
|
|
@ -23,15 +23,34 @@ usage()
|
|||
{
|
||||
progname="$1"
|
||||
|
||||
echo "Usage: ${progname} <option [ARGUMENT]>"
|
||||
echo ""
|
||||
echo "Available options:"
|
||||
echo -e "\t-h, --help"
|
||||
echo -e "\t\tDisplay this help and exit."
|
||||
echo -e "\t-d, --directory DIRECTORY"
|
||||
echo -e "\t\tCheck DIRECTORY"
|
||||
echo -e "\t-t, --tarball TARBALL"
|
||||
echo -e "\t\tCheck TARBALL\n"
|
||||
printf "Examples:\n"
|
||||
printf "\t%s %s %s\n" \
|
||||
"${progname}" \
|
||||
"--website-prefix software/gnuboot" \
|
||||
"--directory site"
|
||||
printf "\t%s %s %s\n" \
|
||||
"${progname}" \
|
||||
"--website-prefix software/gnuboot" \
|
||||
"--tarball website.tar.gz"
|
||||
printf "\n"
|
||||
|
||||
printf "Usage:\n"
|
||||
printf "\t%s %s\n" "${progname}" "<-h|--help>"
|
||||
printf "\t%s %s %s\n" "${progname}" \
|
||||
"--website-prefix PREFIX" "<COMMAND [ARGUMENT]>"
|
||||
printf "\n"
|
||||
|
||||
printf "Main commands:\n"
|
||||
printf "\t-d, --directory DIRECTORY\n"
|
||||
printf "\t\tCheck DIRECTORY\n"
|
||||
printf "\t-t, --tarball TARBALL\n"
|
||||
printf "\t\tCheck TARBALL\n"
|
||||
printf "\n"
|
||||
|
||||
printf "Other options:\n"
|
||||
printf "\t-h, --help\n"
|
||||
printf "\t\tDisplay this help and exit.\n"
|
||||
printf "\n"
|
||||
}
|
||||
|
||||
test_directory_pattern()
|
||||
|
@ -88,21 +107,23 @@ test_tarball_savannah_cvs_constraints()
|
|||
run_directory_tests()
|
||||
{
|
||||
directory="$1"
|
||||
prefix="$2"
|
||||
|
||||
directory_name="$(basename "${directory}")"
|
||||
|
||||
test_directory_pattern "${directory_name}: index.html present test" \
|
||||
"${directory}" \
|
||||
'software/gnuboot/index.html'
|
||||
"${prefix}/index.html"
|
||||
|
||||
test_directory_pattern "${directory_name}: html test" \
|
||||
"${directory}" \
|
||||
'software/gnuboot/web/.*\.html$'
|
||||
"${prefix}/web/.*\.html$"
|
||||
}
|
||||
|
||||
run_tarball_tests()
|
||||
{
|
||||
tarball="$1"
|
||||
prefix="$2"
|
||||
|
||||
filename="$(basename "${tarball}")"
|
||||
test_tarball_pattern "${filename}: html test" "${tarball}" '\.html$'
|
||||
|
@ -117,12 +138,18 @@ run_tarball_tests()
|
|||
if [ $# -eq 1 ] && [ "$1" = "-h" -o "$1" == "--help" ] ; then
|
||||
usage "check.sh"
|
||||
exit 0
|
||||
elif [ $# -eq 2 ] && [ "$1" = "-d" -o "$1" = "--directory" ] ; then
|
||||
directory="$(realpath "$2")"
|
||||
run_directory_tests "${directory}"
|
||||
elif [ $# -eq 2 ] && [ "$1" = "-t" -o "$1" = "--tarball" ] ; then
|
||||
tarball="$(realpath "$2")"
|
||||
run_tarball_tests "${tarball}"
|
||||
elif [ $# -eq 4 ] && [ "$1" = "--website-prefix" ] ; then
|
||||
prefix="$2"
|
||||
if [ "$3" = "-d" -o "$3" = "--directory" ] ; then
|
||||
directory="$(realpath "$4")"
|
||||
run_directory_tests "${directory}" "${prefix}"
|
||||
elif [ "$3" = "-t" -o "$3" = "--tarball" ] ; then
|
||||
tarball="$(realpath "$4")"
|
||||
run_tarball_tests "${tarball}" "${prefix}"
|
||||
else
|
||||
usage "check.sh"
|
||||
exit ${EX_USAGE}
|
||||
fi
|
||||
else
|
||||
usage "check.sh"
|
||||
exit ${EX_USAGE}
|
||||
|
|
|
@ -21,6 +21,7 @@ AC_SUBST([LIGHTTPD_PORT], [])
|
|||
AC_SUBST([RSYNC_DESTINATION], [])
|
||||
AC_SUBST([UNTITLED_PATH], [])
|
||||
AC_SUBST([UNTITLED_GIT_FOUND], [])
|
||||
AC_SUBST([WEBSITE_PREFIX], [])
|
||||
|
||||
# --enable-guix
|
||||
AC_ARG_ENABLE(guix,
|
||||
|
@ -67,6 +68,19 @@ AC_ARG_WITH([untitled-path],
|
|||
|
||||
AM_CONDITIONAL( [WANT_UNTITLED_PATH], [test x"$UNTITLED_PATH" != x""])
|
||||
|
||||
# --with-website-prefix
|
||||
AC_ARG_WITH([website-prefix],
|
||||
[AS_HELP_STRING(
|
||||
[--with-website-prefix=PREFIX],
|
||||
[By default, the website is to be deployed to
|
||||
https://www.gnu.org/software/gnuboot/. But if you want to deploy to another
|
||||
URL like https://mysite.org/test/, you would need to change the website
|
||||
prefix to /test/ instead of the default one (software/gnuboot).])],
|
||||
[WEBSITE_PREFIX=$withval],
|
||||
[WEBSITE_PREFIX=software/gnuboot])
|
||||
|
||||
AM_CONDITIONAL( [WANT_UNTITLED_PATH], [test x"$UNTITLED_PATH" != x""])
|
||||
|
||||
# Check dependencies
|
||||
AC_CHECK_PROG([FOUND_AWK], [awk], [awk])
|
||||
AS_IF([test x"$FOUND_AWK" = x""],
|
||||
|
@ -175,3 +189,5 @@ AS_ECHO([" RSYNC_DESTINATION: $RSYNC_DESTINATION"])
|
|||
|
||||
AS_IF([test x"$UNTITLED_PATH" != x""],
|
||||
[AS_ECHO([" UNTITLED_PATH: $UNTITLED_PATH"])])
|
||||
|
||||
AS_ECHO([" WEBSITE_PREFIX: $WEBSITE_PREFIX"])
|
||||
|
|
|
@ -21,6 +21,6 @@
|
|||
-- If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="Refresh" content="0; url='https://gnu.org/software/gnuboot/web/'" />
|
||||
<meta http-equiv="Refresh" content="0; url='https://gnu.org/WEBSITE_PREFIX/web/'" />
|
||||
</head>
|
||||
</html>
|
|
@ -20,27 +20,26 @@ usage()
|
|||
{
|
||||
progname="$1"
|
||||
|
||||
echo "${progname} <path/to/tarball> [PORT]"
|
||||
echo "${progname} --website-prefix PREFIX <path/to/tarball> [PORT]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ $# -ne 1 ] && [ $# -ne 2 ] ; then
|
||||
if [ $# -ne 3 ] && [ $# -ne 4 ] && [ "$1" != "--website-prefix" ] ; then
|
||||
usage "serve.sh"
|
||||
fi
|
||||
|
||||
basedir="$(dirname $(realpath $0))"
|
||||
|
||||
tarball="$1"
|
||||
prefix="$2"
|
||||
tarball="$3"
|
||||
|
||||
lighttpd_port=8086
|
||||
if [ $# -eq 2 ] ; then
|
||||
lighttpd_port="$2"
|
||||
lighttpd_port="$4"
|
||||
fi
|
||||
|
||||
destdir="site/software/gnuboot/"
|
||||
mkdir -p "${destdir}"
|
||||
|
||||
tar xf "${tarball}" -C "${destdir}"
|
||||
mkdir -p "site/${prefix}"
|
||||
tar xf "${tarball}" -C "site/${prefix}"
|
||||
|
||||
sed -e "s#LIGHTTPD_PORT#${lighttpd_port}#g" \
|
||||
"${basedir}/lighttpd.conf.tmpl" > \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (C) 2022-2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
||||
# Copyright (C) 2022-2024 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
||||
#
|
||||
# Permission is granted to copy, distribute and/or modify this document
|
||||
# under the terms of the GNU Free Documentation License, Version 1.3
|
||||
|
@ -7,6 +7,6 @@
|
|||
# A copy of the license is included in the website/COPYING directory.
|
||||
|
||||
TITLE="GNU Boot"
|
||||
CSS="/software/gnuboot/web/global.css"
|
||||
DOMAIN="https://gnu.org/software/gnuboot/web/"
|
||||
CSS="/WEBSITE_PREFIX/web/global.css"
|
||||
DOMAIN="https://gnu.org/WEBSITE_PREFIX/web/"
|
||||
BLOGDIR="news/"
|
Loading…
Reference in New Issue