#!/usr/bin/make -f # -*- makefile -*- # Copyright (C) 2010-2023 Pädagogisches Landesinstitut Rheinland-Pfalz # Copyright (C) 2022-2023 Mike Gabriel # # 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