]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
testing: Fix systemctl wrapper and adapt enabling services on winnetou
authorTobias Brunner <tobias@strongswan.org>
Tue, 27 Jun 2023 16:01:29 +0000 (18:01 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 13 Jul 2023 08:48:53 +0000 (10:48 +0200)
The wrapper called the command twice for any unit but "strongswan" and
it didn't return the correct exit code.  This was noticed when an
if-updown script tried to check if systemd-resolved is active and always
succeeded, which caused failing attempts to configure it.

But now that the return code is correct, trying to enable bind9 won't
fail silently anymore if the unit doesn't exist (similar on older systems
for named), so this is adapted.

testing/hosts/default/usr/local/bin/systemctl
testing/scripts/build-guestimages

index 0fc264feecf47ea6dd7cd90d7c14ac7e2ad2ef56..51e188c0e0b274288909d993323e5e1264f2aca2 100755 (executable)
@@ -8,7 +8,7 @@ ORIG=/bin/systemctl
 CONF=/lib/systemd/system/strongswan.service
 
 if [[ "$2" != "strongswan" ]]; then
-       $ORIG "$@"
+       exec $ORIG "$@"
 fi
 
 if [[ "$1" == "start" && -n $LEAK_DETECTIVE_LOG ]]; then
@@ -16,7 +16,10 @@ if [[ "$1" == "start" && -n $LEAK_DETECTIVE_LOG ]]; then
 fi
 
 $ORIG "$@"
+STATUS=$?
 
 if [[ "$1" == "stop" ]]; then
        sed -i '/LEAK_DETECTIVE_LOG/d' $CONF 2>/dev/null
 fi
+
+exit $STATUS
index 3619b5e947af200fdce3eefaaccf4ab8e06e74d9..cef1a8297bc3883607b012784b996c37ea1be660 100755 (executable)
@@ -76,10 +76,19 @@ do
                execute_chroot "dnssec-signzone -K /etc/bind -o org. /etc/bind/db.org" 0
                execute_chroot "dnssec-signzone -K /etc/bind -o . /etc/bind/db.root" 0
 
-               # on bullseye, enabling via bind9 doesn't work, while disabling does, so
-               # use named there. on the other hand, older releases don't have named
-               # service files (systemctl returns 0 even if files are not found)
-               for service in apache2 slapd bind9 named
+               # on bullseye and newer, enabling via bind9 doesn't work, while
+               # disabling does, so use named here. on the other hand, older releases
+               # like buster don't have named service files
+               SERVICES="apache2 slapd"
+               case "$BASEIMGSUITE" in
+               buster)
+                       SERVICES="$SERVICES bind9"
+                       ;;
+               *)
+                       SERVICES="$SERVICES named"
+                       ;;
+               esac
+               for service in $SERVICES
                do
                        execute_chroot "systemctl enable $service" 0
                done