File: rules

package info (click to toggle)
debian-edu-router 2.13.5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,616 kB
  • sloc: sh: 12,562; perl: 74; makefile: 35
file content (81 lines) | stat: -rwxr-xr-x 3,108 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/make -f
# -*- makefile -*-

# Copyright (C) 2010-2023 Pädagogisches Landesinstitut Rheinland-Pfalz
# Copyright (C) 2022-2023 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

include /usr/share/dpkg/pkg-info.mk

VER  = $(shell echo $(DEB_VERSION) | cut -d "~" -f1)
SHELL := /bin/bash

%:
	dh $@

override_dh_install:

	# run debhelper install first
	dh_install

	###
	### locale files
	###

	# Create .mo files from .po files...
	for pkgsuffix in config fai-l10n plugin.content-filter plugin.mdns-reflector plugin.ldap-connector plugin.krb5-connector; do \
	    domainsuffix="$$(echo $${pkgsuffix} | sed -e "s/-l10n//")"; \
	    cd po/; \
	    find * -name "debian-edu-router-$${domainsuffix}.po" | while read pofile; do \
	        mkdir -p "../debian/debian-edu-router-$${pkgsuffix}/usr/share/locale/$$(dirname $${pofile})/"; \
	        cp "$${pofile}" "../debian/debian-edu-router-$${pkgsuffix}/usr/share/locale/$$(dirname $${pofile})/"; \
	    done; \
	    cd - 1>/dev/null; \
	    cd debian/debian-edu-router-$${pkgsuffix}/usr/share/locale/; \
	    find * -name "*.po" | while read pofile; do \
	        sed -i $${pofile} -Ee "s/(^\"Project-Id-Version: )(PACKAGE VERSION)(.*\")/\\1$(VER)\\3/"; \
	        msgfmt --check -o $${pofile/.po/.mo} $${pofile}; \
	    done; \
	    cd - 1>/dev/null; \
	done

	# Drop *.po files finally from installation target.
	find debian/*/usr/share/locale/ -name "*.po" -delete

	# Finally, move the .mo files for debian-edu-router-fai to /var/lib/locale.
	# This is a hack for tricking fai-cd which leaves /usr/share/locale empty.
	# During fai/config/class/30-locales we inject these .mo files back into
	# /usr/share/locale/ of the FAI installer environment.
	mkdir debian/debian-edu-router-fai-l10n/var/lib/locale/ -p
	mv debian/debian-edu-router-fai-l10n/usr/share/locale/* \
	   debian/debian-edu-router-fai-l10n/var/lib/locale/
	rmdir debian/debian-edu-router-fai-l10n/usr/share/locale/

	# and, rename shell files and drop .sh suffix
	find debian/*/usr/sbin/ -name "*.sh" | while read shfile; do \
	    mv $${shfile} $${shfile/.sh/}; \
	done

override_dh_clean:
	# as developers, we might build from a DEB src:pkg containing i18n translation cruft...
	rm -f po/de/LC_MESSAGES/debian-edu-router-config.mo
	rm -f po/de/LC_MESSAGES/debian-edu-router-fai.mo
	rm -f debian/po/*.mo
	dh_clean