website-build: make the lighttpd port configurable

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
This commit is contained in:
Denis 'GNUtoo' Carikli 2023-12-23 07:55:23 +01:00
parent aea970a3f7
commit 7380e12139
Signed by: GNUtoo
GPG Key ID: 5F5DFCC14177E263
5 changed files with 27 additions and 8 deletions

View File

@ -70,7 +70,7 @@ help:
@printf "%s\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n" \ @printf "%s\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n" \
"Available commands:" \ "Available commands:" \
"help # Print this help" \ "help # Print this help" \
"test # run lighttpd on localhost:8080" \ "test # run lighttpd on localhost:$(LIGHTTPD_PORT)" \
"check # Run automatic tests" \ "check # Run automatic tests" \
"deploy # Deploy the website to https://gnu.org/software/gnuboot" \ "deploy # Deploy the website to https://gnu.org/software/gnuboot" \
"website.tar.gz # Create a tarball of the website" "website.tar.gz # Create a tarball of the website"
@ -88,11 +88,11 @@ test: website.tar.gz
sed \ sed \
tar \ tar \
-- \ -- \
./serve.sh website.tar.gz ./serve.sh website.tar.gz $(LIGHTTPD_PORT)
else else
if WANT_LIGHTTPD if WANT_LIGHTTPD
test: website.tar.gz test: website.tar.gz
./serve.sh website.tar.gz ./serve.sh website.tar.gz $(LIGHTTPD_PORT)
else else
test: test:
@printf "%s %s\n" \ @printf "%s %s\n" \

View File

@ -13,7 +13,9 @@ $ ./autogen.sh
$ ./configure $ ./configure
$ make test $ make test
Then you can point a browser to http://localhost:8080/software/gnuboot/web/ Then you can point a browser to http://localhost:8080/software/gnuboot/web/ or
to http://localhost:PORT/software/gnuboot/web/ if you changed the port through
./configure options.
== Deployment on https://gnu.org/software/gnuboot/ == == Deployment on https://gnu.org/software/gnuboot/ ==

View File

@ -17,6 +17,7 @@ AC_INIT([gnuboot],[0.1],[gnuboot@gnu.org])
AM_INIT_AUTOMAKE([foreign]) AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([Makefile])
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], [])
@ -36,6 +37,14 @@ AC_ARG_ENABLE(lighttpd,
[lighttpd="yes"]) [lighttpd="yes"])
AM_CONDITIONAL( [WANT_LIGHTTPD], [test x"$lighttpd" = x"yes"]) AM_CONDITIONAL( [WANT_LIGHTTPD], [test x"$lighttpd" = x"yes"])
# --with-lighttpd-port
AC_ARG_WITH([lighttpd-port],
[AS_HELP_STRING([--with-lighttpd-port=PORT],
[Use a custom TCP port for lighttpd tests instead of the
default one (8080).])],
[LIGHTTPD_PORT=$withval],
[LIGHTTPD_PORT=8080])
# --with-rsync-destination # --with-rsync-destination
AC_ARG_WITH([rsync-destination], AC_ARG_WITH([rsync-destination],
[AS_HELP_STRING([--with-rsync-destination=DESTINATION], [AS_HELP_STRING([--with-rsync-destination=DESTINATION],
@ -156,6 +165,8 @@ AS_IF([test x"$guix" = x"yes"],
AC_OUTPUT AC_OUTPUT
AS_ECHO(["Configuration options:"]) AS_ECHO(["Configuration options:"])
AS_ECHO([" LIGHTTPD_PORT: $LIGHTTPD_PORT"])
AS_ECHO([" RSYNC_DESTINATION: $RSYNC_DESTINATION"]) AS_ECHO([" RSYNC_DESTINATION: $RSYNC_DESTINATION"])
AS_IF([test x"$UNTITLED_PATH" != x""], AS_IF([test x"$UNTITLED_PATH" != x""],

View File

@ -1,5 +1,5 @@
server.bind = "localhost" server.bind = "localhost"
server.port = 8080 server.port = LIGHTTPD_PORT
server.document-root = "TMPDIR" server.document-root = "TMPDIR"
dir-listing.activate = "enable" dir-listing.activate = "enable"
index-file.names = ( "index.html" ) index-file.names = ( "index.html" )

View File

@ -18,11 +18,11 @@ set -e
usage() usage()
{ {
echo "$0 <path/to/tarball>" echo "$0 <path/to/tarball> [PORT]"
exit 1 exit 1
} }
if [ $# -ne 1 ] ; then if [ $# -ne 1 ] && [ $# -ne 2 ] ; then
usage usage
fi fi
@ -30,12 +30,18 @@ basedir="$(dirname $(realpath $0))"
tarball="$1" tarball="$1"
lighttpd_port=8080
if [ $# -eq 2 ] ; then
lighttpd_port="$2"
fi
tmpdir="$(mktemp -d)" tmpdir="$(mktemp -d)"
mkdir -p "${tmpdir}/software/gnuboot/" mkdir -p "${tmpdir}/software/gnuboot/"
tar xf "${tarball}" -C "${tmpdir}/software/gnuboot/" tar xf "${tarball}" -C "${tmpdir}/software/gnuboot/"
sed "s#TMPDIR#${tmpdir}#g" \ sed -e "s#TMPDIR#${tmpdir}#g" \
-e "s#LIGHTTPD_PORT#${lighttpd_port}#g" \
"${basedir}/lighttpd.conf.tmpl" > \ "${basedir}/lighttpd.conf.tmpl" > \
"${basedir}/lighttpd.conf" "${basedir}/lighttpd.conf"