Remove init script from haproxy

Package haproxy-config add the haproxy init script file, but,
in the debian package it already contains the script file.
In order to avoid using dpkg-divert on haproxy-config package,
this patch was created to remove the script file from original
debian package.

Test:

PASS: built image successfully
PASS: Installed image successfully (with haproxy)
PASS: Bootstrap and unlock successfull

Story: 2009964
Task: 45036

Signed-off-by: aoliveir <adriano.oliveira@windriver.com>
Change-Id: I93e9fd0d2e80d1fd7f509aebe995547fee502229
This commit is contained in:
aoliveir 2022-04-12 13:57:50 +00:00
parent 1b39149671
commit abf9605f2a
4 changed files with 243 additions and 0 deletions

View File

@ -0,0 +1,231 @@
From 9d94b37d7dfc382b6ee121c3e65f51eba7f0f64c Mon Sep 17 00:00:00 2001
From: aoliveir <adriano.oliveira@windriver.com>
Date: Mon, 11 Apr 2022 20:06:27 +0000
Subject: [PATCH] Remove init files from haproxy package.
---
debian/haproxy.init | 197 --------------------------------------------
debian/rules | 3 -
2 files changed, 200 deletions(-)
delete mode 100644 debian/haproxy.init
diff --git a/debian/haproxy.init b/debian/haproxy.init
deleted file mode 100644
index 6f4096b1..00000000
--- a/debian/haproxy.init
+++ /dev/null
@@ -1,197 +0,0 @@
-#!/bin/sh
-### BEGIN INIT INFO
-# Provides: haproxy
-# Required-Start: $local_fs $network $remote_fs $syslog $named
-# Required-Stop: $local_fs $remote_fs $syslog $named
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: fast and reliable load balancing reverse proxy
-# Description: This file should be used to start and stop haproxy.
-### END INIT INFO
-
-# Author: Arnaud Cornet <acornet@debian.org>
-
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-BASENAME=haproxy
-PIDFILE=/var/run/${BASENAME}.pid
-CONFIG=/etc/${BASENAME}/${BASENAME}.cfg
-HAPROXY=/usr/sbin/haproxy
-RUNDIR=/run/${BASENAME}
-EXTRAOPTS=
-
-test -x $HAPROXY || exit 0
-
-if [ -e /etc/default/${BASENAME} ]; then
- . /etc/default/${BASENAME}
-fi
-
-test -f "$CONFIG" || exit 0
-
-[ -f /etc/default/rcS ] && . /etc/default/rcS
-. /lib/lsb/init-functions
-
-
-check_haproxy_config()
-{
- $HAPROXY -c -f "$CONFIG" $EXTRAOPTS >/dev/null
- if [ $? -eq 1 ]; then
- log_end_msg 1
- exit 1
- fi
-}
-
-haproxy_start()
-{
- [ -d "$RUNDIR" ] || mkdir "$RUNDIR"
- chown haproxy:haproxy "$RUNDIR"
- chmod 2775 "$RUNDIR"
-
- check_haproxy_config
-
- start-stop-daemon --quiet --oknodo --start --pidfile "$PIDFILE" \
- --exec $HAPROXY -- -f "$CONFIG" -D -p "$PIDFILE" \
- $EXTRAOPTS || return 2
- return 0
-}
-
-haproxy_stop()
-{
- if [ ! -f $PIDFILE ] ; then
- # This is a success according to LSB
- return 0
- fi
-
- ret=0
- tmppid="$(mktemp)"
-
- # HAProxy's pidfile may contain multiple PIDs, if nbproc > 1, so loop
- # over each PID. Note that start-stop-daemon has a --pid option, but it
- # was introduced in dpkg 1.17.6, post wheezy, so we use a temporary
- # pidfile instead to ease backports.
- for pid in $(cat $PIDFILE); do
- echo "$pid" > "$tmppid"
- start-stop-daemon --quiet --oknodo --stop \
- --retry 5 --pidfile "$tmppid" --exec $HAPROXY || ret=$?
- done
-
- rm -f "$tmppid"
- [ $ret -eq 0 ] && rm -f $PIDFILE
-
- return $ret
-}
-
-haproxy_reload()
-{
- check_haproxy_config
-
- $HAPROXY -f "$CONFIG" -p $PIDFILE -sf $(cat $PIDFILE) -D $EXTRAOPTS \
- || return 2
- return 0
-}
-
-haproxy_status()
-{
- if [ ! -f $PIDFILE ] ; then
- # program not running
- return 3
- fi
-
- for pid in $(cat $PIDFILE) ; do
- if ! ps --no-headers p "$pid" | grep haproxy > /dev/null ; then
- # program running, bogus pidfile
- return 1
- fi
- done
-
- return 0
-}
-
-
-case "$1" in
-start)
- log_daemon_msg "Starting haproxy" "${BASENAME}"
- haproxy_start
- ret=$?
- case "$ret" in
- 0)
- log_end_msg 0
- ;;
- 1)
- log_end_msg 1
- echo "pid file '$PIDFILE' found, ${BASENAME} not started."
- ;;
- 2)
- log_end_msg 1
- ;;
- esac
- exit $ret
- ;;
-stop)
- log_daemon_msg "Stopping haproxy" "${BASENAME}"
- haproxy_stop
- ret=$?
- case "$ret" in
- 0|1)
- log_end_msg 0
- ;;
- 2)
- log_end_msg 1
- ;;
- esac
- exit $ret
- ;;
-reload|force-reload)
- log_daemon_msg "Reloading haproxy" "${BASENAME}"
- haproxy_reload
- ret=$?
- case "$ret" in
- 0|1)
- log_end_msg 0
- ;;
- 2)
- log_end_msg 1
- ;;
- esac
- exit $ret
- ;;
-restart)
- log_daemon_msg "Restarting haproxy" "${BASENAME}"
- haproxy_stop
- haproxy_start
- ret=$?
- case "$ret" in
- 0)
- log_end_msg 0
- ;;
- 1)
- log_end_msg 1
- ;;
- 2)
- log_end_msg 1
- ;;
- esac
- exit $ret
- ;;
-status)
- haproxy_status
- ret=$?
- case "$ret" in
- 0)
- echo "${BASENAME} is running."
- ;;
- 1)
- echo "${BASENAME} dead, but $PIDFILE exists."
- ;;
- *)
- echo "${BASENAME} not running."
- ;;
- esac
- exit $ret
- ;;
-*)
- echo "Usage: /etc/init.d/${BASENAME} {start|stop|reload|restart|status}"
- exit 2
- ;;
-esac
-
-:
diff --git a/debian/rules b/debian/rules
index 746759cd..f9809a4a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -86,9 +86,6 @@ override_dh_installdocs:
override_dh_installexamples:
dh_installexamples -X build.cfg
-override_dh_installinit:
- dh_installinit --no-restart-after-upgrade --no-stop-on-upgrade
-
override_dh_installsystemd:
dh_installsystemd --no-restart-after-upgrade --no-stop-on-upgrade
--
2.30.2

View File

@ -0,0 +1 @@
0001-Remove-init-files-from-haproxy-package.patch

View File

@ -0,0 +1,10 @@
---
debver: 2.2.9-2+deb11u3
dl_path:
name: haproxy-debian-2.2.9-2+deb11u3.tar.gz
url: https://salsa.debian.org/haproxy-team/haproxy/-/archive/debian/2.2.9-2+deb11u3/haproxy-debian-2.2.9-2+deb11u3.tar.gz
md5sum: 96c7273a58e42964cd4ffc0e2b3189d4
sha256sum: 6719658c7f47dbbd058999d089dd51d6ca38844c21f5ca7899bae729c2c5e09b
revision:
dist: $STX_DIST
PKG_GITREVCOUNT: true

View File

@ -2,6 +2,7 @@ base/base-passwd
base/cluster-resource-agents base/cluster-resource-agents
base/dhcp base/dhcp
base/dnsmasq base/dnsmasq
base/haproxy
base/libfdt base/libfdt
base/lighttpd base/lighttpd
base/linuxptp base/linuxptp