#!/usr/bin/make -f
#
# Univention Join
#  rules file for the debian package
#
# SPDX-FileCopyrightText: 2004-2026 Univention GmbH
# SPDX-License-Identifier: AGPL-3.0-only

version := $(shell dpkg-parsechangelog | sed -ne 's/Version: //p')
copyrightyear := $(shell date +%Y)

override_dh_install:
	dh_install
	sed -i "s/@%@copyright_lastyear@%@/${copyrightyear}/g;s/@%@package_version@%@/${version}/g" debian/univention-join/usr/share/univention-join/univention-server-join
	sed -i "s/@%@copyright_lastyear@%@/${copyrightyear}/g;s/@%@package_version@%@/${version}/g" debian/univention-join/usr/share/univention-join/univention-join
	sed -i "s/@%@copyright_lastyear@%@/${copyrightyear}/g;s/@%@package_version@%@/${version}/g" debian/univention-join/usr/share/univention-join/univention-run-join-scripts
	mv debian/univention-join/usr/share/univention-join/check_join_status.sh debian/univention-join/usr/share/univention-join/check_join_status

override_dh_fixperms:
	dh_fixperms
	chmod 755 debian/univention-join/usr/share/univention-join/univention-run-join-scripts

%:
	dh $@ --with python3,ucr
