File debian.rules of Package talys-2.0-data
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
DH_VERBOSE = 1
# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
name = $(shell dpkg-parsechangelog | sed -n -e 's/^Source: //p')
version = $(shell dpkg-parsechangelog | sed -n -e "s/^Version:\ \+\(.*\)[-\ ].*/\1/p")
mname = talys
prevVersion = 1.96
buildroot = /usr/src/packages/BUILD/debian/$(name)
buildroot-multi = /usr/src/packages/BUILD/debian/$(name)-multi-version
_bindir = /usr/bin
_docdir = /usr/share/doc
_datadir = /usr/share
%:
dh $@
override_dh_auto_install:
install -d $(buildroot-multi)$(_datadir)/$(mname)-$(version)/structure
cp -r `ls -d * | grep -v debian` $(buildroot-multi)$(_datadir)/$(mname)-$(version)/structure/
cp -r $(_datadir)/$(mname)-$(prevVersion) $(buildroot-multi)$(_datadir)
echo '#!/bin/bash' > fdup.script
echo 'target="" ; declare -a sources ; fdupes -q -n -r $(buildroot-multi)$(_datadir) | while read line ; do if [ "$$line" == "" ] ; then if [ ! "$$target" == "" ] || [ ! $${sources[0]} == "" ] ; then if [ "$$target" == "" ] ; then target="$${sources[0]}" ; unset sources[0] ; fi ; for sourc in $${sources[@]} ; do rm -rf $$sourc ; ln -s -r $$target $$sourc ; done ; target="" ; unset sources ; fi ; else if echo "$$line" | grep -v "$(mname)-$(version).structure" ; then target="$$line" ; else sources+=("$$line") ; fi ; fi ; done' >> fdup.script
chmod 777 fdup.script
./fdup.script
rm -rf fdup.script
rm -rf $(buildroot-multi)$(_datadir)/$(mname)-$(prevVersion)
install -d $(buildroot)$(_datadir)/$(mname)-$(version)/structure
mv `ls -d * | grep -v debian` $(buildroot)$(_datadir)/$(mname)-$(version)/structure/