# arg 1:  the new package version
#pre_install() {
#}

# arg 1:  the new package version
post_install() {
	# do something here
	cp /usr/share/ecz-remotesupport/files/ecz-remotesupport.service /etc/systemd/system/ecz-remotesupport.service
	cp /usr/share/ecz-remotesupport/files/ecz-remotesupport.desktop /usr/share/applications/
	cp /usr/share/ecz-remotesupport/files/ecz-remotesupport-link.desktop /usr/share/applications/
	systemctl daemon-reload
	systemctl enable ecz-remotesupport
	systemctl start ecz-remotesupport
	update-desktop-database
}

# arg 1:  the new package version
# arg 2:  the old package version
pre_upgrade() {
    systemctl stop ecz-remotesupport || true
}

# arg 1:  the new package version
# arg 2:  the old package version
post_upgrade() {
	cp /usr/share/ecz-remotesupport/files/ecz-remotesupport.service /etc/systemd/system/ecz-remotesupport.service
	cp /usr/share/ecz-remotesupport/files/ecz-remotesupport.desktop /usr/share/applications/
	cp /usr/share/ecz-remotesupport/files/ecz-remotesupport-link.desktop /usr/share/applications/
	systemctl daemon-reload
	systemctl enable ecz-remotesupport
	systemctl start ecz-remotesupport
	update-desktop-database
}

# arg 1:  the old package version
pre_remove() {
	systemctl stop ecz-remotesupport || true
	systemctl disable ecz-remotesupport || true
	rm /etc/systemd/system/ecz-remotesupport.service || true
}

# arg 1:  the old package version
post_remove() {
	rm /usr/share/applications/ecz-remotesupport.desktop || true
	rm /usr/share/applications/ecz-remotesupport-link.desktop || true
	update-desktop-database
}
