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)`
|
GUIX_SHARE_OPTIONS += --share=`realpath $(UNTITLED_PATH)`
|
||||||
endif
|
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
|
if WANT_GUIX
|
||||||
build:
|
build: site.cfg
|
||||||
guix time-machine \
|
guix time-machine \
|
||||||
--commit=c15a1cd88f80a90437f4b0159f22dfc84b9e6851 \
|
--commit=c15a1cd88f80a90437f4b0159f22dfc84b9e6851 \
|
||||||
-- shell \
|
-- shell \
|
||||||
|
@ -44,15 +50,15 @@ build:
|
||||||
-- \
|
-- \
|
||||||
./build.sh $(BUILD_OPTIONS)
|
./build.sh $(BUILD_OPTIONS)
|
||||||
else
|
else
|
||||||
build:
|
build: site.cfg
|
||||||
./build.sh $(BUILD_OPTIONS)
|
./build.sh $(BUILD_OPTIONS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if WANT_GUIX
|
if WANT_GUIX
|
||||||
check: build website.tar.gz
|
check: build website.tar.gz index.html
|
||||||
rm -rf site/
|
rm -rf site/
|
||||||
mkdir -p site/software/gnuboot/
|
mkdir -p site/$(WEBSITE_PREFIX)
|
||||||
tar xf website.tar.gz -C site/software/gnuboot/
|
tar xf website.tar.gz -C site/$(WEBSITE_PREFIX)
|
||||||
|
|
||||||
guix shell \
|
guix shell \
|
||||||
--container \
|
--container \
|
||||||
|
@ -66,15 +72,17 @@ check: build website.tar.gz
|
||||||
sed \
|
sed \
|
||||||
tar \
|
tar \
|
||||||
-- \
|
-- \
|
||||||
./check.sh --directory site && \
|
./check.sh --website-prefix $(WEBSITE_PREFIX) \
|
||||||
./check.sh --tarball website.tar.gz
|
--directory site && \
|
||||||
|
./check.sh --website-prefix $(WEBSITE_PREFIX) \
|
||||||
|
--tarball website.tar.gz
|
||||||
else
|
else
|
||||||
check: build website.tar.gz
|
check: build website.tar.gz index.html
|
||||||
rm -rf site/
|
rm -rf site/
|
||||||
mkdir -p site/software/gnuboot/
|
mkdir -p site/$(WEBSITE_PREFIX)
|
||||||
tar xf website.tar.gz -C site/software/gnuboot/
|
tar xf website.tar.gz -C site/$(WEBSITE_PREFIX)
|
||||||
./check.sh --directory site
|
./check.sh --website-prefix $(WEBSITE_PREFIX) --directory site
|
||||||
./check.sh --tarball website.tar.gz
|
./check.sh --website-prefix $(WEBSITE_PREFIX) --tarball website.tar.gz
|
||||||
endif
|
endif
|
||||||
|
|
||||||
help:
|
help:
|
||||||
|
@ -83,7 +91,7 @@ help:
|
||||||
"help # Print this help" \
|
"help # Print this help" \
|
||||||
"build # Build the website" \
|
"build # Build the website" \
|
||||||
"serve # run lighttpd on localhost:$(LIGHTTPD_PORT)" \
|
"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" \
|
"check # Run automatic tests" \
|
||||||
"website.tar.gz # Create a tarball of the website"
|
"website.tar.gz # Create a tarball of the website"
|
||||||
|
|
||||||
|
@ -100,11 +108,13 @@ serve: website.tar.gz
|
||||||
sed \
|
sed \
|
||||||
tar \
|
tar \
|
||||||
-- \
|
-- \
|
||||||
./serve.sh website.tar.gz $(LIGHTTPD_PORT)
|
./serve.sh --website-prefix $(WEBSITE_PREFIX) \
|
||||||
|
website.tar.gz $(LIGHTTPD_PORT)
|
||||||
else
|
else
|
||||||
if WANT_LIGHTTPD
|
if WANT_LIGHTTPD
|
||||||
serve: website.tar.gz
|
serve: website.tar.gz
|
||||||
./serve.sh website.tar.gz $(LIGHTTPD_PORT)
|
./serve.sh --website-prefix $(WEBSITE_PREFIX) \
|
||||||
|
website.tar.gz $(LIGHTTPD_PORT)
|
||||||
else
|
else
|
||||||
serve:
|
serve:
|
||||||
@printf "%s %s\n" \
|
@printf "%s %s\n" \
|
||||||
|
@ -127,7 +137,7 @@ publish: website.tar.gz
|
||||||
deploy/ \
|
deploy/ \
|
||||||
$(RSYNC_DESTINATION)/
|
$(RSYNC_DESTINATION)/
|
||||||
|
|
||||||
website.tar.gz: build
|
website.tar.gz: build index.html
|
||||||
tar \
|
tar \
|
||||||
--exclude-vcs \
|
--exclude-vcs \
|
||||||
--format=gnu \
|
--format=gnu \
|
||||||
|
|
|
@ -23,15 +23,34 @@ usage()
|
||||||
{
|
{
|
||||||
progname="$1"
|
progname="$1"
|
||||||
|
|
||||||
echo "Usage: ${progname} <option [ARGUMENT]>"
|
printf "Examples:\n"
|
||||||
echo ""
|
printf "\t%s %s %s\n" \
|
||||||
echo "Available options:"
|
"${progname}" \
|
||||||
echo -e "\t-h, --help"
|
"--website-prefix software/gnuboot" \
|
||||||
echo -e "\t\tDisplay this help and exit."
|
"--directory site"
|
||||||
echo -e "\t-d, --directory DIRECTORY"
|
printf "\t%s %s %s\n" \
|
||||||
echo -e "\t\tCheck DIRECTORY"
|
"${progname}" \
|
||||||
echo -e "\t-t, --tarball TARBALL"
|
"--website-prefix software/gnuboot" \
|
||||||
echo -e "\t\tCheck TARBALL\n"
|
"--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()
|
test_directory_pattern()
|
||||||
|
@ -88,21 +107,23 @@ test_tarball_savannah_cvs_constraints()
|
||||||
run_directory_tests()
|
run_directory_tests()
|
||||||
{
|
{
|
||||||
directory="$1"
|
directory="$1"
|
||||||
|
prefix="$2"
|
||||||
|
|
||||||
directory_name="$(basename "${directory}")"
|
directory_name="$(basename "${directory}")"
|
||||||
|
|
||||||
test_directory_pattern "${directory_name}: index.html present test" \
|
test_directory_pattern "${directory_name}: index.html present test" \
|
||||||
"${directory}" \
|
"${directory}" \
|
||||||
'software/gnuboot/index.html'
|
"${prefix}/index.html"
|
||||||
|
|
||||||
test_directory_pattern "${directory_name}: html test" \
|
test_directory_pattern "${directory_name}: html test" \
|
||||||
"${directory}" \
|
"${directory}" \
|
||||||
'software/gnuboot/web/.*\.html$'
|
"${prefix}/web/.*\.html$"
|
||||||
}
|
}
|
||||||
|
|
||||||
run_tarball_tests()
|
run_tarball_tests()
|
||||||
{
|
{
|
||||||
tarball="$1"
|
tarball="$1"
|
||||||
|
prefix="$2"
|
||||||
|
|
||||||
filename="$(basename "${tarball}")"
|
filename="$(basename "${tarball}")"
|
||||||
test_tarball_pattern "${filename}: html test" "${tarball}" '\.html$'
|
test_tarball_pattern "${filename}: html test" "${tarball}" '\.html$'
|
||||||
|
@ -117,12 +138,18 @@ run_tarball_tests()
|
||||||
if [ $# -eq 1 ] && [ "$1" = "-h" -o "$1" == "--help" ] ; then
|
if [ $# -eq 1 ] && [ "$1" = "-h" -o "$1" == "--help" ] ; then
|
||||||
usage "check.sh"
|
usage "check.sh"
|
||||||
exit 0
|
exit 0
|
||||||
elif [ $# -eq 2 ] && [ "$1" = "-d" -o "$1" = "--directory" ] ; then
|
elif [ $# -eq 4 ] && [ "$1" = "--website-prefix" ] ; then
|
||||||
directory="$(realpath "$2")"
|
prefix="$2"
|
||||||
run_directory_tests "${directory}"
|
if [ "$3" = "-d" -o "$3" = "--directory" ] ; then
|
||||||
elif [ $# -eq 2 ] && [ "$1" = "-t" -o "$1" = "--tarball" ] ; then
|
directory="$(realpath "$4")"
|
||||||
tarball="$(realpath "$2")"
|
run_directory_tests "${directory}" "${prefix}"
|
||||||
run_tarball_tests "${tarball}"
|
elif [ "$3" = "-t" -o "$3" = "--tarball" ] ; then
|
||||||
|
tarball="$(realpath "$4")"
|
||||||
|
run_tarball_tests "${tarball}" "${prefix}"
|
||||||
|
else
|
||||||
|
usage "check.sh"
|
||||||
|
exit ${EX_USAGE}
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
usage "check.sh"
|
usage "check.sh"
|
||||||
exit ${EX_USAGE}
|
exit ${EX_USAGE}
|
||||||
|
|
|
@ -21,6 +21,7 @@ AC_SUBST([LIGHTTPD_PORT], [])
|
||||||
AC_SUBST([RSYNC_DESTINATION], [])
|
AC_SUBST([RSYNC_DESTINATION], [])
|
||||||
AC_SUBST([UNTITLED_PATH], [])
|
AC_SUBST([UNTITLED_PATH], [])
|
||||||
AC_SUBST([UNTITLED_GIT_FOUND], [])
|
AC_SUBST([UNTITLED_GIT_FOUND], [])
|
||||||
|
AC_SUBST([WEBSITE_PREFIX], [])
|
||||||
|
|
||||||
# --enable-guix
|
# --enable-guix
|
||||||
AC_ARG_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""])
|
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
|
# Check dependencies
|
||||||
AC_CHECK_PROG([FOUND_AWK], [awk], [awk])
|
AC_CHECK_PROG([FOUND_AWK], [awk], [awk])
|
||||||
AS_IF([test x"$FOUND_AWK" = x""],
|
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_IF([test x"$UNTITLED_PATH" != x""],
|
||||||
[AS_ECHO([" UNTITLED_PATH: $UNTITLED_PATH"])])
|
[AS_ECHO([" UNTITLED_PATH: $UNTITLED_PATH"])])
|
||||||
|
|
||||||
|
AS_ECHO([" WEBSITE_PREFIX: $WEBSITE_PREFIX"])
|
||||||
|
|
|
@ -21,6 +21,6 @@
|
||||||
-- If not, see <https://www.gnu.org/licenses/>.
|
-- If not, see <https://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
<head>
|
<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>
|
</head>
|
||||||
</html>
|
</html>
|
|
@ -20,27 +20,26 @@ usage()
|
||||||
{
|
{
|
||||||
progname="$1"
|
progname="$1"
|
||||||
|
|
||||||
echo "${progname} <path/to/tarball> [PORT]"
|
echo "${progname} --website-prefix PREFIX <path/to/tarball> [PORT]"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $# -ne 1 ] && [ $# -ne 2 ] ; then
|
if [ $# -ne 3 ] && [ $# -ne 4 ] && [ "$1" != "--website-prefix" ] ; then
|
||||||
usage "serve.sh"
|
usage "serve.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
basedir="$(dirname $(realpath $0))"
|
basedir="$(dirname $(realpath $0))"
|
||||||
|
|
||||||
tarball="$1"
|
prefix="$2"
|
||||||
|
tarball="$3"
|
||||||
|
|
||||||
lighttpd_port=8086
|
lighttpd_port=8086
|
||||||
if [ $# -eq 2 ] ; then
|
if [ $# -eq 2 ] ; then
|
||||||
lighttpd_port="$2"
|
lighttpd_port="$4"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
destdir="site/software/gnuboot/"
|
mkdir -p "site/${prefix}"
|
||||||
mkdir -p "${destdir}"
|
tar xf "${tarball}" -C "site/${prefix}"
|
||||||
|
|
||||||
tar xf "${tarball}" -C "${destdir}"
|
|
||||||
|
|
||||||
sed -e "s#LIGHTTPD_PORT#${lighttpd_port}#g" \
|
sed -e "s#LIGHTTPD_PORT#${lighttpd_port}#g" \
|
||||||
"${basedir}/lighttpd.conf.tmpl" > \
|
"${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
|
# Permission is granted to copy, distribute and/or modify this document
|
||||||
# under the terms of the GNU Free Documentation License, Version 1.3
|
# 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.
|
# A copy of the license is included in the website/COPYING directory.
|
||||||
|
|
||||||
TITLE="GNU Boot"
|
TITLE="GNU Boot"
|
||||||
CSS="/software/gnuboot/web/global.css"
|
CSS="/WEBSITE_PREFIX/web/global.css"
|
||||||
DOMAIN="https://gnu.org/software/gnuboot/web/"
|
DOMAIN="https://gnu.org/WEBSITE_PREFIX/web/"
|
||||||
BLOGDIR="news/"
|
BLOGDIR="news/"
|
Loading…
Reference in New Issue