From: Angelo Compagnucci <angelo.compagnucci@gmail.com>
To: buildroot@buildroot.org
Cc: Angelo Compagnucci <angelo.compagnucci@gmail.com>,
Julien Olivain <ju.o@free.fr>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
James Hilliard <james.hilliard1@gmail.com>,
Fiona Klute <fiona.klute@gmx.de>
Subject: [Buildroot] [PATCH v3 5/6] package/python-web2py: rework the init script
Date: Thu, 19 Nov 2026 10:56:28 +0100 [thread overview]
Message-ID: <20261119095629.1990220-5-angelo.compagnucci@gmail.com> (raw)
In-Reply-To: <20261119095629.1990220-1-angelo.compagnucci@gmail.com>
Rework S51web2py on the model of the other init scripts:
- set DAEMON and PIDFILE, and read /etc/default/web2py, which can
change WEB2PY_ARGS;
- web2py.py is a python script, so the process is python. Start it as
"/usr/bin/python3 web2py.py", and give the same --exec on stop, so
that start-stop-daemon finds the process: a second start no longer
starts a second server, and stop really waits for the process;
- fix the shellcheck warnings, and remove the file from
.checkpackageignore.
Also use --no_gui instead of --nogui, which web2py 3.4.1 deprecates, in
the init script and in the systemd unit.
Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
---
Changes v2 -> v3:
- new patch
.checkpackageignore | 1 -
package/python-web2py/S51web2py | 75 ++++++++++++++++++++--------
package/python-web2py/web2py.service | 2 +-
3 files changed, 56 insertions(+), 22 deletions(-)
diff --git a/.checkpackageignore b/.checkpackageignore
index 25c668db54..06f308174e 100644
--- a/.checkpackageignore
+++ b/.checkpackageignore
@@ -738,7 +738,6 @@ package/python-pyzmq/0001-detect.py-fix-the-ZMQ-version-check-to-the-ZMQ-versi.p
package/python-scipy/0001-build-sh4-FE.patch lib_patch.Upstream
package/python-setuptools/0001-add-executable.patch lib_patch.Upstream
package/python-sip/0001-remove-join-from-sip-h-files-string.patch lib_patch.Upstream
-package/python-web2py/S51web2py Shellcheck lib_sysv.Variables
package/qextserialport/0001-Create-a-main-include-file-QExtSerialPort.patch lib_patch.Upstream
package/qextserialport/0002-Tell-qmake-to-add-a-pkgconfig-file-to-ease-usage-wit.patch lib_patch.Upstream
package/qt5/qt5base/0001-qtbase-Fix-build-error-when-using-EGL.patch lib_patch.Upstream
diff --git a/package/python-web2py/S51web2py b/package/python-web2py/S51web2py
index 11fe912afb..f0a16dc23f 100644
--- a/package/python-web2py/S51web2py
+++ b/package/python-web2py/S51web2py
@@ -1,25 +1,60 @@
#!/bin/sh
+DAEMON="web2py"
+PIDFILE="/var/run/$DAEMON.pid"
+
+# "<recycle>" keeps the admin password set at build time.
+WEB2PY_ARGS="--no_gui -a <recycle> -i 0.0.0.0 -p 8000"
+
+# shellcheck source=/dev/null
+[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
+
+# web2py.py is a python script, so the process to look for is python.
+start() {
+ printf 'Starting %s: ' "$DAEMON"
+ # shellcheck disable=SC2086 # we need the word splitting
+ start-stop-daemon --start --background --make-pidfile \
+ --pidfile "$PIDFILE" --chuid www-data \
+ --exec /usr/bin/python3 -- /var/www/web2py/web2py.py $WEB2PY_ARGS
+ status=$?
+ if [ "$status" -eq 0 ]; then
+ echo "OK"
+ else
+ echo "FAIL"
+ fi
+ return "$status"
+}
+
+stop() {
+ printf 'Stopping %s: ' "$DAEMON"
+ start-stop-daemon --stop --pidfile "$PIDFILE" --exec /usr/bin/python3
+ status=$?
+ if [ "$status" -eq 0 ]; then
+ echo "OK"
+ else
+ echo "FAIL"
+ return "$status"
+ fi
+ while start-stop-daemon --stop --test --quiet --pidfile "$PIDFILE" \
+ --exec /usr/bin/python3; do
+ sleep 0.1
+ done
+ rm -f "$PIDFILE"
+ return "$status"
+}
+
+restart() {
+ stop
+ start
+}
+
case "$1" in
- start)
- printf "Starting web2py: "
- start-stop-daemon -S -q -m -p /run/web2py.pid \
- -c www-data \
- -b -x /var/www/web2py/web2py.py \
- -- --nogui -a '<recycle>' -i 0.0.0.0 -p 8000
- [ $? = 0 ] && echo "OK" || echo "FAIL"
- ;;
- stop)
- printf "Stopping web2py: "
- start-stop-daemon -K -q -p /run/web2py.pid
- [ $? = 0 ] && echo "OK" || echo "FAIL"
- ;;
- restart)
- "$0" stop
- sleep 1
- "$0" start
- ;;
+ start|stop|restart)
+ "$1";;
+ reload)
+ # Restart, since there is no true "reload" feature.
+ restart;;
*)
- echo "Usage: $0 {start|stop|restart}"
- ;;
+ echo "Usage: $0 {start|stop|restart|reload}"
+ exit 1
esac
diff --git a/package/python-web2py/web2py.service b/package/python-web2py/web2py.service
index 0274bd8c53..dcf083d3ea 100644
--- a/package/python-web2py/web2py.service
+++ b/package/python-web2py/web2py.service
@@ -4,7 +4,7 @@ After=network.target
[Service]
Type=simple
-ExecStart=/var/www/web2py/web2py.py --nogui -a '<recycle>' -i 0.0.0.0 -p 8000
+ExecStart=/var/www/web2py/web2py.py --no_gui -a '<recycle>' -i 0.0.0.0 -p 8000
User=www-data
[Install]
--
2.53.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2026-11-19 9:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 11:53 [Buildroot] [PATCH] package/python-web2py: bump to version 3.3.3 Angelo Compagnucci
2026-10-30 20:26 ` Julien Olivain via buildroot
2026-10-31 14:36 ` [Buildroot] [PATCH v2 0/2] " Angelo Compagnucci
2026-10-31 14:36 ` [Buildroot] [PATCH v2 1/2] package/python-rocket3: new package Angelo Compagnucci
2026-10-31 14:36 ` [Buildroot] [PATCH v2 2/2] package/python-web2py: bump to version 3.3.3 Angelo Compagnucci
2026-11-19 9:56 ` [Buildroot] [PATCH v3 1/6] package/python-web2py: keep the admin password at boot Angelo Compagnucci
2026-11-19 9:56 ` [Buildroot] [PATCH v3 2/6] package/python-rocket3: new package Angelo Compagnucci
2026-11-19 9:56 ` [Buildroot] [PATCH v3 3/6] package/python-pydal: bump to version 20261107.0 Angelo Compagnucci
2026-11-19 9:56 ` [Buildroot] [PATCH v3 4/6] package/python-web2py: security bump to version 3.4.1 Angelo Compagnucci
2026-11-19 9:56 ` Angelo Compagnucci [this message]
2026-11-19 9:56 ` [Buildroot] [PATCH v3 6/6] support/testing: add python-web2py runtime test Angelo Compagnucci
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261119095629.1990220-5-angelo.compagnucci@gmail.com \
--to=angelo.compagnucci@gmail.com \
--cc=buildroot@buildroot.org \
--cc=fiona.klute@gmx.de \
--cc=james.hilliard1@gmail.com \
--cc=ju.o@free.fr \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.