Control: tags -1 patch

Lorenzo,

On Wed, May 01, 2024 at 10:59:36AM +0200, Lorenzo Puliti wrote:
> Package: openrc
> Version: 0.45.2-2
> Severity: normal
> X-Debbugs-Cc: plore...@disroot.org
> 
> Hi,
> 
> it appears that, at least under certain conditions, openrc postinstall
> script fails if a sysvinit script in /etc/init.d/ is not executable.
> 
> Note that recently debhelper started to chmod -x initscripts when a package is
> removed but not purged, so openrc should deal whit non executebles files under
> /etc/init.d/

Thanks. Does the attached patch help?

Mark
>From 7d20e19bf392869853fb7df884030c669d7ff641 Mon Sep 17 00:00:00 2001
From: Mark Hindley <m...@hindley.org.uk>
Date: Wed, 1 May 2024 11:16:44 +0100
Subject: [PATCH] d/openrc.postinst: ignore non-executable scripts in
 /etc/init.d

Closes: #1070167
---
 debian/openrc.postinst | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/debian/openrc.postinst b/debian/openrc.postinst
index 6e5cd7ae..3b62f026 100644
--- a/debian/openrc.postinst
+++ b/debian/openrc.postinst
@@ -25,7 +25,7 @@ if [ "${1}" = "configure" ] ; then
 			rclink=/etc/rc${rl}.d/${f}
 			initsh=$(readlink -f ${rclink})
 			svc=$(basename ${initsh})
-			if [ -f ${initsh} ]; then
+			if [ -x ${initsh} ]; then
 				case ${rl} in
 				1) orl="recovery" ;;
 				2) orl="default" ;;
@@ -33,8 +33,12 @@ if [ "${1}" = "configure" ] ; then
 				esac
 				rc-update add ${svc} ${orl}
 			else
+			    if [ -f ${initsh} ]; then
+				echo "*** WARNING: skipping non-executable $rclink"
+			    else
 				echo "*** WARNING: dangling link $rclink"
-				echo $dsvcs|grep -qw ${svc} || dsvcs="$dsvcs ${svc}"
+			    fi
+			    echo $dsvcs|grep -qw ${svc} || dsvcs="$dsvcs ${svc}"
 			fi
 		done
 	done
-- 
2.39.2

Reply via email to