summaryrefslogtreecommitdiff
path: root/testing/hosts/default/usr/local/bin/systemctl
blob: bbe2bc9b3f5d79e2473c83684f3bd61f79fd8540 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
#
# LEAK_DETECTIVE_LOG is set for automated runs, however, this is not passed
# to a process started via systemctl. This wrapper is used to set the variable
# for the strongswan-swanctl.service unit.

ORIG=/bin/systemctl
CONF=/lib/systemd/system/strongswan-swanctl.service

if [[ "$2" != "strongswan-swanctl" ]]; then
	$ORIG "$@"
fi

if [[ "$1" == "start" && -n $LEAK_DETECTIVE_LOG ]]; then
	sed -i "s:Type=:Environment=LEAK_DETECTIVE_LOG=$LEAK_DETECTIVE_LOG\nType=:" $CONF 2>/dev/null
fi

$ORIG "$@"

if [[ "$1" == "stop" ]]; then
	sed -i '/LEAK_DETECTIVE_LOG/d' $CONF 2>/dev/null
fi