From 2787767bf093d83774f6e074bb18a03f3900bbcd Mon Sep 17 00:00:00 2001 From: "Galantsev, Dmitrii" Date: Mon, 9 Jan 2023 13:18:47 -0600 Subject: [PATCH] SYSTEMD: Remove set -e to allow failure 'set -e' flag doesn't allow to fall back to 'return 0' when a command fails. As installation/removal should not fail in most cases - 'set -e' flag has been removed. Below page recommends to be careful with 'set -e' usage: https://www.debian.org/doc/debian-policy/ch-opersys.html#writing-the-scripts Change-Id: If4439aaff66747bceabd3beb7e00ae12ce950e43 Signed-off-by: Galantsev, Dmitrii --- src/DEBIAN_postinst.in | 2 -- src/DEBIAN_prerm.in | 7 +++---- src/RPM_postun.in | 5 +++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/DEBIAN_postinst.in b/src/DEBIAN_postinst.in index 0902c4097a..37d6e90057 100755 --- a/src/DEBIAN_postinst.in +++ b/src/DEBIAN_postinst.in @@ -1,7 +1,5 @@ #!/bin/bash -set -e - # This will return 0 if an id is created and non-zero if # it already exists # https://www.debian.org/doc/debian-policy/ch-opersys.html#users-and-groups diff --git a/src/DEBIAN_prerm.in b/src/DEBIAN_prerm.in index 50b8fdc0e3..ffbbab79d0 100644 --- a/src/DEBIAN_prerm.in +++ b/src/DEBIAN_prerm.in @@ -1,7 +1,5 @@ #!/bin/bash -set -e - stop_rdc() { if [ -d /run/systemd/system ]; then #stop RDC if running @@ -11,8 +9,9 @@ stop_rdc() { } rm_rdc_service() { - if [ -e /run/systemd/system ]; then - unlink /lib/systemd/system/rdc.service + local LINK=/lib/systemd/system/rdc.service + if [ -L $LINK ]; then + unlink $LINK fi return 0 } diff --git a/src/RPM_postun.in b/src/RPM_postun.in index c6a0982332..601c346dfe 100755 --- a/src/RPM_postun.in +++ b/src/RPM_postun.in @@ -9,8 +9,9 @@ stop_rdc() { } rm_rdc_service() { - if [ -e /run/systemd/system ]; then - unlink @DISTRO_ROOT@/rdc.service + local LINK=@DISTRO_ROOT@/rdc.service + if [ -L $LINK ]; then + unlink $LINK fi return 0 }