systemctl 573 B

12345678910111213141516171819202122
  1. #!/bin/bash
  2. #
  3. # LEAK_DETECTIVE_LOG is set for automated runs, however, this is not passed
  4. # to a process started via systemctl. This wrapper is used to set the variable
  5. # for the strongswan.service unit.
  6. ORIG=/bin/systemctl
  7. CONF=/lib/systemd/system/strongswan.service
  8. if [[ "$2" != "strongswan" ]]; then
  9. $ORIG "$@"
  10. fi
  11. if [[ "$1" == "start" && -n $LEAK_DETECTIVE_LOG ]]; then
  12. sed -i "s:Type=:Environment=LEAK_DETECTIVE_LOG=$LEAK_DETECTIVE_LOG\nType=:" $CONF 2>/dev/null
  13. fi
  14. $ORIG "$@"
  15. if [[ "$1" == "stop" ]]; then
  16. sed -i '/LEAK_DETECTIVE_LOG/d' $CONF 2>/dev/null
  17. fi