mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-05 00:00:45 -04:00
When charon is started via service command LEAK_DETECTIVE_LOG is not set because the command strips the environment. Since we only want the variable to be set during the automated test runs we can't just set it in /etc/default/charon. Instead, we do so in this wrapper when charon is started and remove the variable again when it is stopped.
23 lines
495 B
Bash
Executable File
23 lines
495 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# LEAK_DETECTIVE_LOG is set for automated runs, however, `service` strips
|
|
# the environment. This wrapper is used to set the variable for the charon
|
|
# init script.
|
|
|
|
ORIG=/usr/sbin/service
|
|
CONF=/etc/default/charon
|
|
|
|
if [[ "$1" != "charon" ]]; then
|
|
$ORIG "$@"
|
|
fi
|
|
|
|
if [[ "$2" == "start" && -n $LEAK_DETECTIVE_LOG ]]; then
|
|
echo "export LEAK_DETECTIVE_LOG=$LEAK_DETECTIVE_LOG" >> $CONF
|
|
fi
|
|
|
|
$ORIG "$@"
|
|
|
|
if [[ "$2" == "stop" ]]; then
|
|
sed -i '/LEAK_DETECTIVE_LOG/d' $CONF 2>/dev/null
|
|
fi
|