#!/usr/bin/make -f
# debian/rules for gnumed-server using dh
# Andreas Tille <tille@debian.org>, GPL

pkg := $(shell dpkg-parsechangelog | sed -n 's/^Source: //p')

%:
	dh $@ --with python2

override_dh_install:
	dh_install
	cp -a server/bootstrap/[a-z]* debian/$(pkg)/var/lib/gnumed/server/bootstrap
	for conffile in `find debian/$(pkg)/var/lib/gnumed/server/bootstrap -maxdepth 1 -type f -name \*.conf` ; do \
    	    sed -i 's/^\(interactive[[:space:]]*=[[:space:]]*\)yes/\1no/' "$$conffile" ; \
    	    sed -i 's/^\(password[[:space:]]*=[[:space:]]*\)/\1 gm-dbo/' "$$conffile" ; \
    	done
	for script in `ls server/gm-*.sh` ; do \
	    if [ "$$script" = "server/gm-remove_person.sh" -o \
	         "$$script" = "server/gm-move_backups_offsite.sh" ] ; then \
		cp -a "$$script" debian/$(pkg)/usr/bin/`basename "$$script" .sh` ; \
	    else \
		cp -a "$$script" debian/$(pkg)/usr/sbin/`basename "$$script" .sh` ; \
	    fi \
	done
	cp -a server/gm-fingerprint_db.py debian/$(pkg)/usr/sbin/gm-fingerprint_db ; \

