From 7647e97f3dab0bc9ee584ef356484ff5d3beeec6 Mon Sep 17 00:00:00 2001 From: Andrei Belov Date: Tue, 14 Jan 2025 09:53:23 +0400 Subject: [PATCH] packages: fixed issues found by internal CI --- etc/chkconfig/amplify-agent | 23 ++++++++++++++++--- etc/init.d/amplify-agent | 18 ++++++++++++++- .../deb/debian/control.noble | 1 + tools/builders/deb.py | 1 + 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/etc/chkconfig/amplify-agent b/etc/chkconfig/amplify-agent index 2514f1c..a86ef45 100755 --- a/etc/chkconfig/amplify-agent +++ b/etc/chkconfig/amplify-agent @@ -75,9 +75,19 @@ start() { chown -f $user /etc/amplify-agent/agent.conf chown -f $user /var/log/amplify-agent/agent.log daemon --user=$user $binary start --config=$conffile --pid=$pidfile - fi; + fi + RETVAL="$?" echo - return $RETVAL + if [ "$RETVAL" -ne 0 ]; then + return "$RETVAL" + fi + for i in 1 2 3 4 5; do + if [ -e "$pidfile" ]; then + return 0 + fi + sleep 1 + done + return 1 } stop() { @@ -123,6 +133,13 @@ debug() { case "$1" in start) + if status -p $pidfile amplify-agent >/dev/null 2>&1; then + echo "amplify-agent is already running" >&2 + exit 0 + fi + if [ -e "$pidfile" ]; then + rm -f "$pidfile" + fi start RETVAL=$? ;; @@ -135,7 +152,7 @@ case "$1" in RETVAL=$? ;; status) - status -p $pidfile amplify-agent + status -p $pidfile amplify-agent RETVAL=$? ;; configtest) diff --git a/etc/init.d/amplify-agent b/etc/init.d/amplify-agent index 22f43a7..363d7bc 100755 --- a/etc/init.d/amplify-agent +++ b/etc/init.d/amplify-agent @@ -66,7 +66,16 @@ do_start() chown -f $USER /var/log/amplify-agent/agent.log start-stop-daemon --start --chuid $USER --exec $DAEMON start -- $DAEMON_ARGS RETVAL="$?" - return "$RETVAL" + if [ "$RETVAL" -ne 0 ]; then + return "$RETVAL" + fi + for i in 1 2 3 4 5; do + if [ -e "$PIDFILE" ]; then + return 0 + fi + sleep 1 + done + return 1 } do_stop() @@ -94,6 +103,13 @@ do_debug() { case "$1" in start) + if status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" >/dev/null 2>&1; then + echo " * $NAME is already running" >&2 + exit 0 + fi + if [ -e "$PIDFILE" ]; then + rm -f "$PIDFILE" + fi [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME" do_start case "$?" in diff --git a/packages/nginx-amplify-agent/deb/debian/control.noble b/packages/nginx-amplify-agent/deb/debian/control.noble index e0559ff..a649ae7 100644 --- a/packages/nginx-amplify-agent/deb/debian/control.noble +++ b/packages/nginx-amplify-agent/deb/debian/control.noble @@ -22,6 +22,7 @@ Architecture: any Depends: ${misc:Depends}, ${python3:Depends}, python3-daemon, + python3-pyasyncore, python3-setproctitle, python3-greenlet, python3-gevent, diff --git a/tools/builders/deb.py b/tools/builders/deb.py index 8ce8065..9091592 100644 --- a/tools/builders/deb.py +++ b/tools/builders/deb.py @@ -19,6 +19,7 @@ COMPAT_LEVELS = { 'bullseye': 13, 'jammy': 13, 'bookworm': 13, + 'noble': 13, }