#!/bin/sh

post_install() {
  cat <<-EOM
	 > For instructions see section 'Usage' in:
	 >  /usr/share/doc/pacredir/README.md
	 > ... or visit:
	 >  https://github.com/eworm-de/pacredir#usage
	EOM
}

post_upgrade() {
  # return if old package version greater 0.6...
  (( $(vercmp $2 '0.6') > 0 )) && return

  # upgrade from pre-0.6 version, avahi service names changed
  cat <<-EOM
	 > This upgrade from pacredir $2 to pacredir $1 changes avahi service
	 > names. Make sure to update all your installations for compatibility.
	 > The services will be restarted post transaction.
	EOM

  # mark for restart
  for UNIT in pac{redir,serve}.service; do
    systemctl set-property --runtime "${UNIT}" Markers=needs-restart
  done
}
