#!/bin/sh
set -e



stop_vpn () {
    if [ -x "/etc/init.d/openvpn" ]; then
	pathfind invoke-rc.d
	if [ $? = 0 ]; then
	    invoke-rc.d openvpn stop
	else
	    /etc/init.d/openvpn stop
	fi
    fi
  if [ -h /etc/service/openvpn ] && [ -f /run/runit.stopit ] && [ -z $nostop ]; then
    sv stop openvpn
  fi  
}


case "$1" in
  upgrade)
    # don't stop the vpn, it will be restarted after the upgrade
    true
  ;;
  *)
    stop_vpn
  ;;
esac

#DEBHELPER#

exit 0
