#!/bin/sh

# remove localstatedir -- compiled VCL and slab files will still be here.
post_remove() {
  rm -rf var/lib/varnish
}

post_install() {
  systemd-sysusers varnish.conf
}

post_upgrade() {
  if [[ $(vercmp 4.0.0-1 "$2") -eq 1 ]]; then
    echo ":: You must update your VCL to be compatible with 4.0.0. See the following"
    echo "   upgrade guide to port your configuration:"
    echo "   https://www.varnish-cache.org/docs/trunk/whats-new/upgrading.html"
  fi

  if [[ $(vercmp 4.1.0-1 "$2") -eq 1 ]]; then
    systemd-sysusers varnish.conf
  fi
}
